teleren/devto huggingface dataset:
[Opinion] Real reason why i use Vim editor
Published: 2023-05-02 12:48:12

# [Opinion] Real reason why i use Vim editor

This is purely my opinion. And I want you to think a little, as it makes sense.

But I think, that people who say "why it's hard to switch between mouse and keyboard to edit some code/text? why learning Vim and whole keyboard commands "

It's not about saving a few milliseconds or saving the hassle of reaching the mouse, the real hassle from action from reaching the mouse is losing focus.

Because when you are coding, writing and doing something on the keyboard, you type, think, etc. And the last thing you think about is where your mouse cursor is because it's irrelevant. if you lose the mouse cursor, just move the mouse a little, and you will find it.

But when you're coding, and thinking, you're in the zone, and you need first to find that little pointer, by moving a mouse just a little, to be able to notice it where it is.

Why, because you need to use that same little pointer that is shaky and reliably click with that pointer to the place where in the text you need it to be (to move the cursor in text editor to some other place, or just to delete some paragraph).

Mostly, I can't get 100% accuracy all the time to match that little pointer where I want it in the editor, and mostly if I click with the pointer, it's 1-5 chars far from where I want it, so I additionally need to move with arrow keys to that location.

So in contrast when I do Vim commands, it will get the job done 100% all the time. The only prerequisite is to know to use Vim. Which is the hardest part. But most rewarding.

It's about not moving your hand from the keyboard if it's not needed.

Vim is not a reason to ditch IDE or modern tools, but, something that can make workflow simpler. Like, why run IDE, if you can set up Vim to have functions that IDE have?

But I use IDE of course because they are more efficient than Vim at managing resources for things and functions they provide, but I can't work in IDE (write) without Vim mode (extension), because i just can't be bothered to reach the mouse I need focus. I have no problem reaching the mouse to use the debugger, but I do have a problem reaching the mouse every moment i do some (minor) edits in code which are often specific to some parts of text.

[would you want this power?](https://www.youtube.com/watch?v=-VchkiGMLGE)

---

do you know what this does in vim normal mode when your cursor is somewhere on text?

```plaintext
ciw
```

it removes that word, and you can input word in it's place

like (my cursor is **█** ):

**█**hello world hello world

and if i move it to:

hello wo**█**rld hello world

(like, i don't know how i got cursor there, but i know just, that i want to change this word into something else)

i am in Normal mode and type `ciw`

and this happens:

hello **|** hello world

so in insert mode cursor is like **|** , so I can type something (hello):

hello hello | hello world

type Esc to get back to Normal mode

hello hello**█** hello world

And wow ! Isn't that amaizing !
Run dev env in cloud, Github codespaces
Published: 2023-05-02 12:47:52

# Run dev env in cloud, Github codespaces

Check out [GitHub codespaces](https://github.com/codespaces) for having a development environment in a virtual machine, so you don't have to run it locally.

Aside from [Google cloud shell](https://shell.cloud.google.com/?pli=1&show=ide%2Cterminal), this one is cool.

Also, it has VSCode extension, so you can run it in VSCode, not in browser
download music from youtube
Published: 2023-05-02 12:47:01

# download music from youtube

you don't need to use other (often paid) programs to download music from youtube.

You just need [youtube-dl](https://github.com/ytdl-org/youtube-dl), or it's a better fork, [youtube-dlp](https://github.com/yt-dlp/yt-dlp) (have better speed download ! )

To download mp3 you also need to install [ffmpeg](https://ffmpeg.org/) (and include it in $PATH )

• download mp3

`yt-dlp -x --audio-format mp3 <link>`

• download **video with subtitles** (auto-generated) :

`yt-dlp --write-auto-sub --convert-subs srt --write-sub <url>`

-----------------

## GUI
Now there is good GUI for this
[Tubeconverter](https://flathub.org/apps/org.nickvision.tubeconverter)

----------

There is app for android:
[Seal](https://f-droid.org/packages/com.junkfood.seal/)
Pacman
Published: 2023-05-02 12:46:48

# Pacman

### Common commands

pacman -**Syy** # *update* the software database

pacman -**S** &lt;pkg&gt; # Install only

pacman -**Rsc** &lt;pkg&gt; # Uninstall

pacman -Rsc**n** &lt;pkg&gt; # Uninstall (and remove configuration files)

pacman -S**s** &lt;keywords&gt; # Search

pacman **\-Syu** # Upgrade everything

pacman -Syu &lt;pkg&gt; # Install (and update package list (and upgrade everything *else* ! )

pacman -S**w** &lt;pkg&gt; # Download a package without installing it

pacman -**U** &lt;local\_path&gt; # install from local (e.g. package is from the *AUR*)

### Query

pacman -Qe # List explictly-installed packages

pacman -Ql &lt;pkg&gt; # What *files* does this package have?

pacman -Qii &lt;pkg&gt; # List *information* on package

pacman -Qo &lt;file&gt; # Who owns this file?

pacman -Qs &lt;query&gt; # Search installed packages for keywords

### Orphans

pacman -Qdt # List unneeded packages

pacman -Rns ili pacman -Qdtq # Uninstall unneeded packages

### Other

pactree &lt;pkg&gt; # What does *pkg* depend on?

pactree -r &lt;pkg&gt; # What depends on *pkg*?

pacman -Sc # remove all the cached packages that are not currently installed

pacman -Scc # remove all files from the cache

## Configuration file

Configuration file is in: /etc/pacman.conf

Look:

[man 5 pacman.conf](https://archlinux.org/pacman/pacman.conf.5.html)
Test your PC hardware in GNU/Linux
Published: 2023-05-02 12:45:50

# Test your PC hardware in GNU/Linux

1. Check the system's specifications: Use the `lshw` command to get detailed information about the system's hardware components, such as the processor, memory, storage devices, and network interfaces.
    
2. Test the processor: Use the `lscpu` command to check the processor's specifications, such as the number of cores, clock speed, and architecture.
    
3. Test the memory: Use the `free` command to check the amount of free and used memory on the system. You can also use the `memtest86+` tool to perform a more thorough test of the system's memory.
    
4. Test the storage devices: Use the `lsblk` command to check the storage devices connected to the system, including their size and file system type. You can also use the `smartctl` tool to check the health of the storage device.
    
5. Test the network interfaces: Use the `ifconfig` or `ip addr` command to check the network interfaces on the system. You can also use the `ping` command to check if the system can communicate with other devices on the network.
    
6. Test the GPU: Use the `lspci | grep VGA` to check the Graphics card.
    
7. Check the temperature: Use the `sensors` command to check the temperature of different hardware components
    
8. Check the power supply: Use the `upower -i /org/freedesktop/UPower/devices/battery_BAT0` to check the current status of the battery, if the PC is a laptop, otherwise check the power supply using a multimeter.
    

---
Centralized logging with rsyslog
Published: 2023-05-02 12:45:34

# Centralized logging with rsyslog

# Configuring the server to receive logs

Edit server config file:

```plaintext
sudo nano /etc/rsyslog.conf
```

Find the following lines:

```plaintext
# provides UDP syslog reception
#module(load="imudp")
#input(type="imudp" port="514")

# provides TCP syslog reception
#module(load="imtcp")
#input(type="imtcp" port="514")
```

Uncomment second, to use TCP connection.

Don't forget to enable port on firewall.

Check if port is open:

```plaintext
sudo ss -tulnp | grep "rsyslog"
```

### To change default log storage location

In order not to store (and mix) all logs in /var/log , use this, defined in main conf file ( /etc/**rsyslog.conf** ):

```plaintext
$template RemoteLogs,"/var/log/%HOSTNAME%/%PROGRAMNAME%.log"
*.* ?RemoteLogs
& ~
```

The *$template RemoteLogs* directive instructs Rsyslog to store all incoming log entries in the location that is defined by the third parameter.

In our case, the remote logs will continue to be stored in /var/log directory, but each client will have its own subdirectory with a name equivalent to client *hostname*.

This subdirectory will store each log entry in a file that matches the client program that generated it.

On the following line, the *. ?RemoteLogs* directive applies the RemoteLogs configuration rule at all facilities with all priority levels (in other words, to all logs).

Finally, the *& ~* directive defines that Rsyslog stops processing log input after it is stored to a file defined in previous lines.

The default configuration will overwrite the previous rule without this line.

•

# Forwarding logs from an Rsyslog client

edit /etc/rsyslog.d/50-default.conf

Add:

```plaintext
*.* @@<your_rsyslog_server_ip_address>:514
```

If you use @ it will use UDP port, @@ will use TCP port

 *such as cron.* @@0.0.0.0:514 or apache2.\* @@0.0.0.0:514.

You can also forward logs to more than one server

```plaintext
*.* @@0.0.0.0:514

*.* @@192.168.122.235

cron.* @@192.168.122.237:514
```
HP elitebook 820G1 linux fixes
Published: 2023-05-02 12:43:32

# HP elitebook 820G1 linux fixes

Some HP laptops have a graphics issue with `UEFI Native (Without CSM)` mode and Debian

### Prerequisites

- Installation Media of Debian 
- External Display 

### Procedure:

1. Connect an external display via Display Port.
2. Turn on the PC and close the lid.
3. If you see the splash screen (HP logo) on the display, open the lid and press F9. 
4. Continue to the installation process.

### Other issues

- No system error after the HP logo.
    - You can add custom boot option with `EFI\debian\grubx64.efi` in the UEFI menu. 
    - [InstallingDebianOn/HP/EliteBook 840 G1 - Debian Wiki](https://wiki.debian.org/InstallingDebianOn/HP/EliteBook%20840%20G1)
    - [HP EliteBook 840 G1 - ArchWiki](https://wiki.archlinux.org/index.php/HP_EliteBook_840_G1)
- The system installed still suffers from the glitch.
    - When you troubleshoot or use an encrypted root, it can be a problem.
    - However, you can type the disk password and start using the system. 
    - Installing `Plymouth` might solve the problem. (UPDATE 2019-02-17)


### Other workarounds

- Use `UEFI Hybrid (with CSM)` OR `Legacy`
Mediatek (MTK) Auto Philz recovery porter
Published: 2023-05-02 12:40:40

# Mediatek (MTK) Auto Philz recovery porter

## Requirements
- Stock recovery.img (extracted from the firmware or by dumping the phone's ROM using Miracle Box, SP Flash tool etc )
- Download MTK Auto Philz recovery porter by Team Hovatek 


## STEPS:
1. Extract the MTK Auto Philz recovery porter zip
2. Copy the stock recovery.img into the stock folder
3. Double-click Auto Philz Recovery Porter.exe
4. Tap Enter to confirm that you've copied your stock recovery.img into the stock folder
5. Enter the option for your Android version (5 for Lollipop, 6 for Marshmallow & 7 for Nougat) and tap Enter
6. Type Y or N (depending on whether or not you have an external SD card in your phone) then tap Enter
7. Wait while our tool ports the Philz recovery
8. You'll find your ported Philz recovery in the output folder.
9. Flash the recovery image to your device

---------------

## Links

[V1.4 with support for android 5, 6, 7 & 8.1go](https://github.com/Linuxiness/TWRP-auto-porter/blob/master/Mediatek%20(MTK)%20Auto%20Philz%20recovery%20porter/V1.4%20with%20support%20for%20android%205,%206,%207%20&%208.1go%20@.zip?raw=true)

[V1.5 GUI with support for android versions same as v1.4 above](https://github.com/Linuxiness/TWRP-auto-porter/blob/master/Mediatek%20(MTK)%20Auto%20Philz%20recovery%20porter/V1.5%20GUI%20with%20support%20for%20android%20versions%20same%20as%20v1.4%20above%20.zip?raw=true)
Unisoc Spreadtrum (SPD) TWRP auto porter
Published: 2023-05-02 12:39:56

# Unisoc Spreadtrum (SPD) TWRP auto porter

# Requirements
- Stock recovery.img (You can download the firmware then extract the contents of the pac file, use rashr.apk or flashify.apk if rooted or dump the phone's ROM using a box/dongle etc )
- Download [SPD Auto TWRP recovery](https://github.com/Linuxiness/TWRP-auto-porter/blob/master/%20Unisoc%20Spreadtrum%20(SPD)%20auto%20TWRP%20recovery%20porter%20by%20Team%20Hovatek/V1.0%20(Stable)%20with%20support%20for%20android%204,%205,%206%20&%207%20:%2064bit.zip?raw=true) porter by Team Hovatek 



## How to port TWRP recovery for Spreadtrum Android using Team Hovatek's SPD Auto TWRP recovery porter

1. Extract the SPD Auto TWRP recovery porter zip
2. Copy the stock recovery.img into the stock-recovery folder
3. Double-click SPD Auto TWRP Recovery Porter.exe
4. Tap Enter to confirm that you've copied your stock recovery.img into the stock-recovery folder
5. Enter the option for your Android version (4 for Kitkat, 5 for Lollipop, 6 for Marshmallow & 7 for Nougat) and tap Enter
6. Wait while our tool ports the TWRP recovery
7. You'll find your ported TWRP recovery in the output folder.
8. Flash the recovery image to your device (you can use fastboot or rashr / flashify if rooted)


-----------------------

# Links

[V1.0 (Stable) with support for android 4, 5, 6 & 7 : 64bit](https://github.com/Linuxiness/TWRP-auto-porter/blob/master/%20Unisoc%20Spreadtrum%20(SPD)%20auto%20TWRP%20recovery%20porter%20by%20Team%20Hovatek/V1.0%20(Stable)%20with%20support%20for%20android%204,%205,%206%20&%207%20:%2064bit.zip?raw=true)

[V1.0 (Stable) with support for android 4, 5, 6 & 7 : 32bit](https://github.com/Linuxiness/TWRP-auto-porter/blob/master/%20Unisoc%20Spreadtrum%20(SPD)%20auto%20TWRP%20recovery%20porter%20by%20Team%20Hovatek/V1.0%20(Stable)%20with%20support%20for%20android%204,%205,%206%20&%207%20:%2032bit.zip?raw=true)

[V1.2 GUI (Beta testing) with support for same android versions as v1.0](https://github.com/Linuxiness/TWRP-auto-porter/blob/master/%20Unisoc%20Spreadtrum%20(SPD)%20auto%20TWRP%20recovery%20porter%20by%20Team%20Hovatek/V1.2%20GUI%20(Beta%20testing)%20with%20support%20for%20same%20android%20versions%20as%20v1.0%20above.zip?raw=true)

[V1.4 GUI (Beta testing for Oreo & Pie only)](https://github.com/Linuxiness/TWRP-auto-porter/blob/master/%20Unisoc%20Spreadtrum%20(SPD)%20auto%20TWRP%20recovery%20porter%20by%20Team%20Hovatek/V1.4%20GUI%20(Beta%20testing%20for%20Oreo%20&%20Pie%20only)%20.7z?raw=true)
Loading repositories to docker and testing them!
Tags: osdc, docker, python
Published: 2023-05-02 12:30:30

My code-maven mentor: @szabgab 

Today I got hands-on experience with docker and containers.
I have downloaded the docker desktop program so that it will be visually more clearer. 

I run a container for each repository that I found interesting in Python coding language. For more than 5 repositories, I run their tests, sent PRs to update their README file to have much more clearer instructions so that users who wants to contribute and check their tests, will have a better understanding.

You can feel the fast and reliable containers running, you stop them at any time and start them at any time. It is way much better and faster than using VmWare.

The repositories that I tested with docker are:
- [tomlkit](https://github.com/sdispater/tomlkit)
- [dialogy](https://github.com/skit-ai/dialogy)
- [teiphy](https://github.com/jjmccollum/teiphy)
- [python-automation-framework](https://github.com/mreiche/python-automation-framework)
- [python-bitcoinlib](https://github.com/petertodd/python-bitcoinlib)
- [overloaded_iterables](https://github.com/Arkiralor/overloaded_iterables)
- [xapi-python](https://github.com/pawelkn/xapi-python)
- [nats-python](https://github.com/Gr1N/nats-python)

I have learned a lot about how to use docker and containers, some libraries that are known to be required to run the basic operations. Those libraries are poetry and pytest (for now).

After using these repositories in their containers, I decided to send PRs to some of them, making their README much more clearer:
- [tomlkit](https://github.com/sdispater/tomlkit/pull/287)
- [dialogy](https://github.com/skit-ai/dialogy/pull/195)
- [teiphy](https://github.com/jjmccollum/teiphy/pull/71)
- [xapi-python](https://github.com/pawelkn/xapi-python/pull/1)
- [nats-python](https://github.com/Gr1N/nats-python/pull/27)

That is my contribution for today,
Thank you everyone :)
HTML Code for Random Name Generator
Published: 2023-05-02 12:28:14

You can use this code to make your own random name generator for free:

```
<!DOCTYPE html>
<html>
  <head>
    <title>Random Name Generator</title>
    <link rel="stylesheet" href="style.css">
  </head>
  <body>
    <h1>Random Name Generator</h1>
    <p id="name"></p>
    <button onclick="generateName()">Generate</button>
    <script src="script.js"></script>
  </body>
</html>
```

```
body {
  font-family: Arial, sans-serif;
  text-align: center;
}

h1 {
  font-size: 2rem;
}

p {
  font-size: 1.5rem;
  margin-top: 2rem;
}

button {
  font-size: 1.2rem;
  padding: 0.5rem 1rem;
  margin-top: 2rem;
  border: none;
  background-color: #007bff;
  color: #fff;
  border-radius: 5px;
  cursor: pointer;
}

button:hover {
  background-color: #0062cc;
}
```

```
function generateName() {
  const names = [
    "Alice", "Bob", "Charlie", "David", "Eve", "Frank",
    "Grace", "Heidi", "Ivan", "Judy", "Kevin", "Linda"
  ];
  
  const index = Math.floor(Math.random() * names.length);
  const name = names[index];
  
  const nameElement = document.getElementById("name");
  nameElement.innerText = name;
}
```
This code is generated by Daniel Davis from [https://packagology.com/](https://packagology.com/)
Use your Javascript and Typescript skills in Salesforce
Tags: javascript, typescript, programming, backend
Published: 2023-05-02 12:00:03

Salesforce functions - a new game changer by Salesforce, allows you to extend the platform logic in Javascript, Typescript and Java.


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

An illustrated overview of what Salesforce functions are —

1/ Your Javascript functions are hosted in isolated but salesforce managed infrastructure.

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

2/ Develop business logic in Javascript, Typescript and Java and use any Open source or external libraries.

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

3/ Call functions from your Apex. But forget Authentication! Salesforce handles it implicitly.

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

4/ Offload heavy computation tasks to functions. The infrastructure auto scales without manual intervention upon load.

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

---

Liked the illustrated concepts? 

[Follow](https://twitter.com/Rajasneha_dev) and share in twitter to help the Salesforce and Javascript community. 

Visit https://rsforce.net for more illustrations!
AWS VPC Explained with Terraform
Tags: aws, terraform, cloud, devops
Published: 2023-05-02 11:44:06

{% youtube QgbIoJr7Yng %}

Amazon Web Services (AWS) lets you build and run Virtual Private Clouds (VPCs) with different parts. VPCs are virtual networks that are separate from each other in the AWS cloud. They let you start resources like EC2 servers, RDS databases, and more. 

In this lab session, we are gonna take a look on setting up following using Terraform - 

1. How to setup VPC?
2. How to setup Subnet?
3. How to setup Internet Gateway?
4. How to setup NAT gateway?
5. How to setup Route Table
6. How to setup Elastic IP?

**VPS**

VPC, or Virtual Private Cloud, is a virtual network that is specific to your AWS account and keeps your resources separate and under your control. It is conceptually different from other VPCs, so you can set up your own IP address ranges, subnets, and routing tables.

**Subnet** 

Subnet is a part of the IP address range for your VPC. Subnets can cross multiple Availability Zones (AZs), so you can spread out your resources to make sure they are always available and can handle problems.

**Internet Gateway**

Internet Gateway: A gateway that connects your VPC to the internet and can be scaled horizontally and used more than once.

**NAT Gateway**

NAT Gateway is a controlled network address translation (NAT) service that lets instances in a private area connect to the internet or other AWS services, but stops the internet from connecting to those instances.

**Route Table:**

Route Table A set of rules, called routes, that tells your VPC where to send network data.

**Elastic IP: **

Elastic IP: A public IPv4 address that is always the same and that you can link to an instance, a network device, or a NAT gateway. Elastic IPs help you keep track of your resources that are available to the public and let you remap numbers to other resources in case something goes wrong.


After making and setting these parts, your VPC will have public and private subnets, an Internet gateway for public access, a NAT gateway for private access, custom route tables, and Elastic IPs for static public addresses.

▬▬▬▬▬▬ ⭐️ Follow me ⭐️ ▬▬▬▬▬▬ 

Linkedin - https://www.linkedin.com/in/rahul-wagh/
Twitter - https://twitter.com/wagh_rahul

To learn more on DevOps visit - https://jhooq.com/