teleren/devto huggingface dataset:
🕹️ How to prettify your cat command
Tags: unix
Published: 2023-04-22 19:28:42

---
title: 🕹️ How to prettify your cat command
published: true
date: 2023-02-24 00:00:00 UTC
tags: Unix
canonical_url: https://bstefanski.com/how-to-prettify-your-cat-unix-command
---

I have always used the `cat` command to quickly preview some files or to copy the contents of them to a clipboard. The second part was always working great, but previewing a let's say JavaScript file or RC file was painful, because of the lack of syntax highlighting.

I was too lazy to search for solutions, but my colleague recently showed me something called [bat](https://github.com/sharkdp/bat), which is a cat, but on steroids. Here's a little preview of what it looks like:

 ![Preview of bat command](https://bstefanski.com/_next/image?url=%2Fposts%2Fhow-to-prettify-your-cat-unix-command%2Fbat-preview.png&w=1200&q=75)
<small></small>
<section><h3 id="installation-and-theme-setup">Installation and theme setup</h3>
<p>You can install it through brew, just like this:</p>
<div data-language="bash">
<div></div>
<pre><div><span><span>$ brew </span><span>install</span><span> bat</span></span></div></pre>
</div>
<p>and if you don't like the default theme, you can choose some that are installed out of the box or <a target="_blank" href="https://github.com/sharkdp/bat#adding-new-themes">install the custom one</a>. I decided to use Nord, which was already installed, here's how I did it:</p>
<div data-language="bash">
<div></div>
<pre><div><span><span>$ </span><span>mkdir</span><span> ~/.config/bat </span></span></div><div><span><span>$ </span><span>sudo</span><span> </span><span>vim</span><span> ~/.config/bat/config </span><span># remember to run it in sudo mode</span></span></div></pre>
</div>
<p>then paste this line into the config</p>
<div data-language="bash">
<div></div>
<pre><div><span><span>--theme</span><span>=</span><span>"Nord"</span></span></div></pre>
</div>
<p>and exit vim with <code>:wq</code> and you're done!</p>
<p>P.S you can still copy the contents of the file with <code>bat something.txt | pbcopy</code>! <span role="img" aria-label="cowboy hat face">🤠</span></p></section>
Content & Tooling Team Status Update
Tags: puppet, content, community
Published: 2023-02-24 18:28:42

---
title: Content & Tooling Team Status Update
published: true
date: 2023-02-24 00:00:00 UTC
tags: puppet, content, community
canonical_url: https://puppetlabs.github.io/content-and-tooling-team/blog/updates/2023-02-24-status-update/
---

# Hello all!!

Hello again everyone! Another week done and dusted, so in good old CAT team fashion we are back again with another update.

# Work is continuing

Not much too speak about this week, but rest assured the work is continuing on in the background. There are some bits of work worth mentioning, like [Lukas’s](https://github.com/lukasaud) continued effort in preparing our modules for the new puppet release.

Lukas has audited each of our supported modules for instances of soon-to-be deprecated features, such as legacy facts, so that our modules will continue to work when puppet 8 is released.

There has been plenty of community interaction on this one, so thank you all for your efforts!

# That’s all for this week

That’s all for this week im afraid, have a nice weekend everyone!


## Community Contributions

We’d like to thank the following people in the Puppet Community for their contributions over this past week:

- [`puppetlabs-apache#2389`](https://github.com/puppetlabs/puppetlabs-apache/pull/2389): “Fix typo in help text”, thanks to [faxm0dem](https://github.com/faxm0dem)

- [`puppetlabs-apt#1090`](https://github.com/puppetlabs/puppetlabs-apt/pull/1090): “Adopt new parameter defaults in template”, thanks to [tuxmea](https://github.com/tuxmea)

- [`puppetlabs-tomcat#510`](https://github.com/puppetlabs/puppetlabs-tomcat/pull/510): “Update commons-daemon-native version to match Tomcat bundled version”, thanks to [uoe-pjackson](https://github.com/uoe-pjackson)
Zustand, simplified redux
Tags: statemanagement, react, redux, webdev
Published: 2023-02-23 23:37:11

Having Used Redux toolkit, it really does the job well having no issues with it. Setting Up the store makes using it in the rest of your project quite Easy.

But one thing about creating the Redux stores is that it's really verbose and you have to write a lot more boilerplate code.

This is the part where Zustand comes in, Doing what redux is doing but with really less code. ill be creating a simple project to show you how easy it is to use Zustand

first, create a folder in the root directory that will contain the costume Hook for our state

`touch store/useItemsStore.js`

in that file, the hook is created as follows

```
import {create} from 'zustand';

const useMyStore = create((set) => ({
  items: [], // initial state
  addItem: (newItem) => set((state) => ({ items: [...state.items, newItem] })),
  deleteItem: (index) =>
    set((state) => ({ items: state.items.filter((_, i) => i !== index) })),
}));
```

this will create an empty list and two functions for adding and deleting items

when you want to use the above state and functions in you components you'll do the following

```
import { useMyStore } from './store/useItemsStore';

function MyComponent() {
  const addItem = useMyStore((state) => state.addItem);

  const handleClick = () => {
    addItem('New Item');
  };

  return (
    <>
      <button onClick={handleClick}>Add Item</button>
      {/* Render the list of items here */}
     <ul>
        {items.map((item, index) => (
          <li key={index}>
            {item} <button onClick={() => handleDelete(index)}>Delete</button>
          </li>
        ))}
      </ul>
    </>
  );
}
```


And that's it. not a lot of code and still functions similarly to redux. it has been fun using it for small side projects so far

here is a simple Todo App that i use Zustand to manage my state: https://react-zustand.netlify.app/
The Science Of Allocating Dev Resources In 2023
Tags: devops, productivity, programming, podcast
Published: 2023-02-23 23:24:32

The days of growth at all costs are over; your 2023 engineering strategy needs to be about scaling efficiently.

In the first Labs episode of the year, Dan invites LinearB's VP of Product, Eran Shitrit, to discuss how teams are proactively addressing concerns around cost reduction and efficiency through smarter project allocation.

Dan and Eran also discuss the rollout of LinearB's resource allocation dashboard and the success of the Scaling Developer Efficiency workshop.

{% spotify spotify:episode:7xx7JKQWPGyDOqcUR08b1l %}

## Episode Highlights:
* (1:36) Introduction
* (5:18) What is project allocation?
* (9:46) Why companies should be thinking about project allocation
* (13:46) The metrics used to measure resource allocation
* (17:44) Good vs bad project allocation
* (22:24) Dan's hard lessons
* (26:52) Building the resource allocation features
* (30:23) Workflow relationship between VPE, VP Product & CEO

***While you’re here, check out this video from our [YouTube channel](https://www.youtube.com/c/DevInterrupted?sub_confirmation=1), and be sure to like and [subscribe](https://www.youtube.com/c/DevInterrupted?sub_confirmation=1) when you do!*** 

{% youtube Qt3XHNNOGkE %}

### Want to cut code-review time by up to 40%? Add estimated review time to pull requests automatically!
*gitStream is the free dev tool from LinearB that eliminates the No. 1 bottleneck in your team’s workflow: pull requests and code reviews. After reviewing the work of 2,000 dev teams, LinearB’s engineers and data scientists found that pickup times and code review were lasting 4 to 5 days longer than they should be.* 

*The good news is that they found these delays could be eliminated largely by adding estimated review time to pull requests!*

### Learn more about how gitStream is making coding better [HERE](https://linearb.io/blog/why-estimated-review-time-improves-pull-requests-and-reduces-cycle-time/?utm_source=Substack%2FMedium%2FDev.to&utm_medium=referral&utm_campaign=gitStream%20-%20Referral%20-%20Distribution%20Footers).

![Start using gitstream today!](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xg1l6hxt134px501bf7d.png)
Creating a simplified Dungeons and Dragons Character Generator
Published: 2023-02-23 23:14:55

I am learning python and wanted to start to challenge my skills. I have created a simplified dungeons and dragons character generator that is partially based on the Five Torches Deep system.

I have currently got the generator to create a level 1 character including their name, stats (roll either 3d6 or 4d6 drop lowest), and class (outputting their characters HP and proficiencies).

Looking forward I want to allow the user to pick their starting equipment, be able to refer to this on the character sheet, and then also provide the character's AC based on their armour and dexterity, and their attack attributes based on their weapon choice and relevant stat.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p8rq9dr6ejh294tywxht.PNG)

[Link to GitHub](https://github.com/jak6955/Character-generator.git)
Automate your dependency updates!
Tags: cve
Published: 2023-02-23 23:00:19

## Don’t feel like upgrading, what if?

But what if the upgrades do the complete opposite? What if the new version introduces a new security issue?

For example, a new version of a dependency could be victim of a supply chain attack. If you never update your dependencies, you won’t get the infected version. Sounds fair, right?

It’s a valid argument, but your application doesn’t exist in a vacuum; many external factors could force you to upgrade at some point, and when it happens it’s usually at the wrong time.

![XKCD comic 2347](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b2hzf05amc6gx042kin3.png)

XKCD comic 2347 is always relevant when talking about dependencies.

Renovate is a tool that automates dependency updates for software projects. It continuously scans the project's dependencies, checks for new releases, and creates pull requests (PRs) to update the dependencies to their latest versions. Renovate supports a wide range of dependency managers, including NPM, Yarn, Maven, NuGet, and many others.

## Why use Renovate?
- Get pull requests to update your dependencies and lock files
-     Reduce noise by scheduling when Renovate creates PRs
-     Renovate finds relevant package files automatically, including in monorepos
-     You can customize the bot's behavior with configuration files
-     Share your configuration with ESLint-like config presets
-     Get replacement PRs to migrate from a deprecated dependency to the community suggested replacement (npm packages only)
-     Open source

## Running Renovate
As a Renovate end user, there are two main categories of use:

1. self-host Renovate, e.g. (Checkout https://gitlab.com/renovate-bot/renovate-runner ) for gitlab.
2. Someone else is hosting Renovate
Now you need a global config and authentication, you are good to go. 

Usually, Renovate raises pull requests and it waits for codeowners to review and approve. However, if you need ,
Automerging is a Renovate feature that you can use to automate upgrading dependencies. When enabled, Renovate tries to merge the proposed update once the tests pass.

Keep in mind that keeping your dependencies up-to-date is not just about the tooling, it’s also about having a process:

- When will you merge this PR?
-     How will you handle the PR that doesn’t build?
-     The new major version of an external library that’s not yet compatible with the rest of your libraries?
-     When will you release this constant flow of library updates?
-     Do you want PRs during the day? During the night? Or on weekends only?

Reference : https://www.npmjs.com/package/renovate
Format large numbers to corresponding abbreviations
Tags: webdev, javascript, programming, typescript
Published: 2023-02-23 23:14:33

Table Of Contents
        * 🚀[INTRO](#intro)
        * 🏁[SOLUTION](#solution)
        * 🙏[THANK YOU](#thank-you)


## 🚀 Intro <a name="intro"></a>

Hey all! If you ever worked in fintech - or any other number-related field - you probably came across a requirement like this:

> Format a number to the abbreviated version but only if that-and-that criteria are met.

I had such a requirement and the criteria were something like this:

- If a number is less than 1000 show as-is, and no decimal points
- If a number is greater than 1000, abbreviate it to the corresponding string value e.g. 1K, and always use two decimal points e.g. 1233 -> 1.23K.
- If a number is greater than a million do it like 1M, 1.33M
- If a number is a billion do it like 1B, 10.45B, 123.12B
- Same goes for a trillion

## 🏁 Solution <a name="solution"></a>

Here is a simple, short, and sweet solution, and If you tweak it right you can accommodate your own criteria.

{% jsfiddle https://jsfiddle.net/devlazar95/7cahvm81/52/ js,result,html,css %}


## 🙏 THANK YOU FOR READING!<a name="thank-you"></a>

Hope this helps you in your future work. Cheers! 🍻
O que é e para o que serve Nginx?
Published: 2023-02-23 23:04:58

O NGINX é um servidor web de alta performance, que foi projetado para lidar com uma grande quantidade de tráfego e conexões simultâneas. Ele foi lançado em 2004 e tem sido amplamente adotado como uma solução de servidor web para empresas de todos os tamanhos, desde pequenas startups até grandes corporações.

O servidor web NGINX é muito popular por suas características de escalabilidade, velocidade e confiabilidade. Ele é usado como um servidor proxy reverso, que pode receber as solicitações de clientes e redirecioná-las para servidores de aplicativos ou backends de serviços.

Além disso, o NGINX é capaz de servir arquivos estáticos diretamente para o cliente, o que pode melhorar significativamente o tempo de carregamento das páginas da web e reduzir a carga do servidor de aplicativos. Ele também suporta vários protocolos, incluindo HTTP, HTTPS, SMTP, POP3 e IMAP.

**Para que serve o NGINX?**

O NGINX é uma solução versátil e pode ser usado para uma variedade de finalidades, como:

**Servidor Web**
O NGINX pode ser usado como um servidor web para hospedar sites e aplicativos da web. Ele é frequentemente usado como uma solução de servidor de produção, em ambientes de alta disponibilidade e alto tráfego.

**Proxy Reverso**
O NGINX pode atuar como um proxy reverso para encaminhar as solicitações de clientes para servidores de aplicativos ou backends de serviços. Ele pode ajudar a melhorar a escalabilidade, a confiabilidade e a segurança do sistema.

**Balanceamento de Carga**
O NGINX pode ser usado como um balanceador de carga para distribuir o tráfego de entrada entre vários servidores de aplicativos. Ele pode ajudar a melhorar o desempenho do sistema, evitando a sobrecarga em um único servidor.

**Cache**
O NGINX suporta caching de conteúdo para melhorar a velocidade e a eficiência do sistema. Ele pode armazenar em cache as respostas de solicitações para acelerar o tempo de resposta subsequente.

**Servidor de Mídia**
O NGINX pode ser usado como um servidor de mídia para transmitir conteúdo de vídeo e áudio. Ele é frequentemente usado para transmissão ao vivo de eventos esportivos, shows e conferências.

Em resumo o NGINX é um servidor web poderoso e altamente configurável, que pode ser usado para uma variedade de finalidades, desde hospedagem de sites até balanceamento de carga e transmissão de mídia. Ele é amplamente adotado por empresas de todos os tamanhos, devido à sua escalabilidade, velocidade e confiabilidade. Se você está procurando uma solução de servidor web robusta, o NGINX é uma excelente opção a ser considerada.
Remove AWS sensitive data from GitHub commit history
Tags: aws, cloud, awscommunity, 100daysofcloud
Published: 2023-02-23 22:34:07

[54/100] #100DaysOfCloud Today, I removed AWS sensitive data from GitHub commit history.

Sometimes we accidentally add our AWS sensitive data like account id, Access keys, etc in in GitHub as a string maybe in a json file or some sort and then when we realize it, we delete it from the GitHub. The problem is even though we delete it, It will be present in the commit history. To remove that from the commit history we use a tool called BFG Repo-Cleaner.

You can try do it by yourself by following the steps from the link below: [GitHub](https://github.com/aaditunni/100DaysOfCloud/blob/main/Journey/054/Readme.md)
dcpd
Published: 2023-02-23 22:26:35

Đẳng cho phép đàn bà sẽ trở nên thương hiệu cung cấp các thành phầm làm đẹp và trông nom sức khỏe tín nhiệm với trang thương mại điện tử đủ đầy tin tức trung thực, đáng tin cậy, tối đa bởi Việt Nam https://dcpdvn.tumblr.com/archive
https://www.instagram.com/dangcapphaidepvn/
dcpd
Published: 2023-02-23 22:26:11

Đẳng cấp phép phái nữ sẽ trở nên tên cấp phát các thành phầm chăm sóc sắc đẹp và chăm nom sức khỏe khoắn uy tín với trang thương nghiệp điện tử đủ đầy tin tức trung thực, xứng đáng tin tưởng, cao nhất tại Việt Nam https://www.pinterest.com/dangcapphaidepvn/
https://www.pinterest.com/dangcapphaidepvn/dangcapphaidepvn/
dcpd
Published: 2023-02-23 22:25:38

Đẳng cấp đàn bà sẽ trở thành nhãn hiệu cung cấp các sản phẩm làm đẹp và săn sóc sức khỏe mạnh uy tín với trang thương nghiệp điện tử đủ đầy thông tin trung thực, xứng đáng tin tưởng, cao nhất bởi Việt Nam https://twitter.com/DangCapPhaiDep
https://www.linkedin.com/in/dangcapphaidepvn/
CodeNewbie Podcast S23E2 **Discussion**!!
Tags: beginners, codenewbie, podcast, career
Published: 2023-02-23 22:09:34

Hey y'all! 

We released a new episode of the CodeNewbie Podcast yesterday and after listening, we decided we wanted to talk about some of it with you all. 

**SO— what did you think?**

We came up with some discussion questions if you'd like to drop your thoughts below, anything is welcome!

- **When have you felt imposter syndrome before?**
- **How can we stop comparing ourselves to people who are the best?**
- **What does having a growth mindset mean to you?**
- **How can we normalize failing?**
- **How can we make learning new things less scary?**
- **How can we encourage people to learn by playing?**

And if you haven't listened, take this as your sign to go do it! Take a break from the grind and grab your favorite drink and hop in [here](https://www.codenewbie.org/podcast), or wherever you listen to your podcasts.
My First Portfolio
Tags: webdev, programming, portfolio
Published: 2023-02-23 22:02:56

Hello Everyone, i hope y'all doing good, just wanna let u know that finally after a long time of creating projects, i finally managed to post my first portfolio online.. 
I would like y'all to go and visit my portfolio and give a reviews about it, any suggestion and other stuff.. 
THank you a lot. 
Link of My portfoli : https://www.clapycodes.info/
What is wrong with my Python code ?
Tags: help, python, programming
Published: 2023-02-23 21:21:22

I am new to python and trying to use python for learning DSA. While trying this code it is not working properly.

`test.addOne()` should increase the `num` value but it is not .
and also the while loop is infinite

It will be great if somebody could help me. Thanks in advance.

 
```
class Test:
    def __init__(self):
        self.num = 1
    
    def addOne(self):
        if self.num >= 1 and self.num <= 10 :
            self.num+1
        else:
            self.num = 0

    def getNum(self):
        return self.num
    

test =Test()

while test.getNum() != 0:
    test.addOne()
    print( test.getNum() )

```
Unexpected end of JSON input error in Visual Studio Code for sfdx
Tags: salesforce, sfdx
Published: 2023-02-23 21:12:14

If you are reading this blog post, I assume you must be having similar issue which I have faced when trying to authorize a saleforce org from VS Studio code to change orgs.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/v8285cp0xjfvibzqye4p.png)

Why I am getting above error ?

In your root folder, where we have a .sfdx/ folder, there might be a json file which has a zero byte file. You might be wondering how to detect a zero byte file in .sfdx/ folder if you have more than 100 files. Please execute below command in bash terminal
`$ find . -type f -empty`

Once you execute above command, please remove files which has been detected as zero byte.
`$ rm -rf <NAME OF YOUR FILE>`

Now SFDX behind the scenes is happy and feel free to try to reauthorize or change orgs. You should be good
Mobile menu logic
Tags: beginners, react, webdev, design
Published: 2023-02-23 20:33:43

Hello,

I'm using Next.js 13, so I'm new to react.  I designed a simple header with Tailwind.  When I log in from mobile, I hide the menu and show a hamburger.

When I clicked on this, I prepared a component called MyModal to use it in different operations in many places (for login, register, search, etc.) Because it will be a 90% mobile-based website.

When I use MyModal in the header component and click on the hambuger, I write a mobile-friendly ul menu in it.

Is this kind of approach bad or used for mobile menu?  What is your opinion?
Codecademy CS101. Python terminal game. A gun shop.
Tags: python, codecademy, terminal, gamedev
Published: 2023-02-23 20:16:57



![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ox3rn85k1chd8g7ecuk9.gif)

Hello there.

I have written a simple python terminal game for a computer science course portfolio project. A game is about buying and selling weapons you stock up on merchandise and attempt to sell it to customers. 

The games code revolve around for `classes `(`Store`, `Supplier`, `Customer `and `Market`) which interact with one another throughout a game by a main while loop.

The gameplay follows this path:
- A short intro sequence in which you name your store and stock up on merchandise.
- You open up store for a day and try to sell your stock( 3 customers per day).
- Each customer has his own randomized preferences and will state them.
- You can attempt to sell a chosen weapon. The success of sale depends on customers preference and the price you set
- After you close shop you restock and wait for another day.

Here is a link to GitHub repository:
{% embed https://github.com/Dade321/CS101-Terminal-game-Gun-shop %}
How to trigger a LiveReload on a remote machine
Published: 2023-02-23 19:54:30

Use this extension in Chrome (RemoteLiveReload, not LiveReload):
https://chrome.google.com/webstore/detail/remotelivereload/jlppknnillhjgiengoigajegdpieppei/related?hl=en-GB


Make sure the LiveReload server is running on port 35729 and that this port is accessible from your local machine (e.g., using telnet).