TIL: How to Run Your Scripts From Everywhere

I've been writing a few bash scripts and some Nim command line utilities. You can run a script from the folder which contains the script. Here's an example file structure: ~/bin/ ├── git-reset-author.sh └── readme_template When I'm inside the ~/bin directory, I can type into the terminal: readme_template. But what if I want to navigate to a different folder on my machine and run the script from that location? fish: unknown command readme_template The shell doesn't find the program.
Read more →

How to Setup an IKEv2 VPN Connection on Arch Linux (Example: NordVPN)

Connect your Linux machine to a VPN Gateway using strongSwan In this blog post I'll show you how to connect your local machine to a remote VPN server using the IKEv2 and IPSec protocol. Instead of the deprecated ipsec.conf we'll use the modern swanctl.conf. Why IPSec/IKEv2? IKEv2 offers high speed and good data security with a stable connection. The protocol is one of the best. strongSwan provides an open-source implementation of IPSec.
Read more →

TIL: strongSwan using bypass-lan Plugin Can Fix Docker Routing

Let Docker access the internet by passing through the VPN connection My host machine, a laptop running Manjaro Linux, is connected via VPN to the internet. I use strongSwan, the open-source IPsec-based VPN solution. IPsec with the IKEv2 protocol is fast and secure. Now, Docker doesn't work. Networking issues are a common problem with VPN and Docker. You can piggyback your Docker container on the host network. That technique only works on Linux machines.
Read more →

How I Manage My SSH Keys

Setup SSH keys with Manjaro i3 and keychain The following blog post details how I setup my SSH keys. I always forget some of the moving parts. Then I have to painstakingly debug why ssh-add doesn't remember my keys or why ssh-agent doesn't work. Create ssh-keys with ssh-keygen. cd ~/.ssh ssh-keygen -t ed25519 -o -a 100 Make sure to save both public and private key inside ~/.
Read more →

Suspend Vim to the Background or What Is Linux Job Control

Vim has an inbuilt terminal, which you can start with :terminal. That means that you don't have to leave your Vim editor to run commands in the shell. Sometimes, it's still useful. If you quickly want to switch to your shell, suspend the Vim editor with Ctrl+z. That sends the process into the background (on Linux). Now you have access to your standard terminal and can run commands. Type jobs or jobs -l to see a list of the background processes.
Read more →

Handle Python Dependency Management With Virtual Environments

Create isolated Python projects with virtual environments What is a virtual environments and why should I use it? A virtual environment allows you to develop several Python projects with different versions of packages on the same computer. Python usually installs the latest versions of your dependencies globally. You'll run into problems, if one of your projects requires a different package version. venv Python ships with venv out of the box since version 3.
Read more →

Install psycopg2-binary With Docker

How to build a Python app with PostgreSQL I'm currently setting up a Flask app with PostgreSQL and Docker. Like most examples you'll find on the internet, the course I'm following uses Alpine Linux as a base image. Alpine's selling point is the small image size. But Alpine uses a different C library, musl, instead of glibc. That's one of the reasons why the website Pythonspeed recommends Debian Buster as the base image for Python (as of 2019).
Read more →

Downgrade Packages With Pacman

Today I broke my Manjaro system. I wanted to update my pacman-mirrors and somehow landed on an unstable branch. Usually, I use the stable branch. I mistakingly used Arch Linux's Pacman Mirrorlist Generator instead of Manjaro's mirrors. I had upgraded my system with: sudo pacman -Syyu. After a reboot, I encountered many errors: lightdm didn't work anymore, pacman-mirrors broke, etc.: ModuleNotFoundError: No module named 'pacman_mirrors' That was a catch-22 because I couldn't update my pacman-mirrors.
Read more →

Fish Plugins I Like

Updated: December 5th, 2019 Fish shell is my favorite shell. It's awesome. Fish comes with useful features out of the box. For example, excellent auto-completion and syntax highlighting make my life easier. Fish is a joy to use. What Is a Shell? From technopedia: A shell is software that provides an interface for an operating system's users to provide access to the kernel's services. On Unix-based or Linux-based operating systems, a shell can be invoked through the shell command in the command line interface (CLI), allowing users to direct operations through computer commands, text or script.
Read more →

Tool: fd - The Faster Alternative to find

fd is a “simple, fast, and user-friendly alternative to find". This neat tool offers a more intuitive syntax for finding files and operating on them. The author wrote fd in Rust. Thus, it's quite fast. Let's say we want to find all mp3 files in a directory. With find, you have to do something like this: find -name "*.mp3" fd looks simpler: fd -e mp3 Here's an example command that converts all jpg files to png files:
Read more →