Emptty — a Minimal Display Manager

My daily driver for my home laptop is Manjaro Linux. Manjaro is a derivative of Arch Linux. It offers convenience and a more beginner-friendly approach at the cost of some bloat. While Manjaro is slightly more stable than upstream Arch Linux, it’s still possible to bonk a system update. That’s what happened to me three days ago. I was able to fix almost all issues except my display manager. My Manjaro i3 installation came with LightDM, a login manager with a GTK-based greeter that fit the Manjaro aesthetic.
Read more →

I Started My New Job (And Have MacOS Woes)

Today I started my first job in tech. While I’m pretty excited, it’s a big step. I have to learn new workflows and tools (Jira) and become familiar with a new code-base (Angular nx workspace). Plus, I now have a Mac for work. I underestimated the differences between my Linux box and MacOs. As terminal user with lots of scripts and shell modifications, I heavily rely on my dotfiles. I came to the realization that my files are not as portable as I’ve thought.
Read more →

TIL: How to Remove Headers From ps Command on MacOs

Today I’ve started to setup my MacBook Pro for work. It’s my first Mac and I’m not amused. If you only know Linux, there are some pitfalls. My .bashrc script contains the following lines: # # ~/.bashrc # # Fish if [[ $(ps --no-header --pid=$PPID --format=cmd) != "fish" ]] then exec fish fi I use bash as my login shell, but fish as my main interactive shell. Fish is not POSIX-compliant which can lead to problems.
Read more →

How I Remove Duplicate Lines From a File With awk

One of the repositories I maintain is a beginner’s GitHub repo. New developers can make their first pull request by adding their GitHub handle to a simple text file. When pull requests get merged into the master branch, they often contain duplicates. The file has more than 7,000 lines. Names are not sorted alphabetically. I needed a simple way to remove all duplicates lines from the file without sorting the lines.
Read more →

TIL: Pass Multiple Commands to Xargs

I’m using fd, an alternative to the Unix native find, to find a list of files and copy them to a different location, using xargs. On Unix, we use cp to copy the files, but the command is silent. I don’t know which files cp will copy. Maybe I could use echo to log the files? How can I pass multiple shell commands to xargs? Previous command: fd --changed-within 1hour -0 | xargs -I cp {} /new/location/ fd -0 --changed-within: find all files changed within a time frame, separate results by null character |: pipe previous command as stdin to the next command xargs -I cp {} /new/location/: takes the input from previous command (fd) and uses cp to copy the files; {} is a placeholder What does not work:
Read more →

TIL: How to Set Multiple GOPATHs

How to set multiple workspaces (GOPATH) A Go Workspace is how Go manages our source files, compiled binaries, and cached objects used for faster compilation later. It is typical, and also advised, to have only one Go Workspace, though it is possible to have multiple spaces. The GOPATH acts as the root folder of a workspace. 1 Why multiple workspaces? I’d like to install my global binaries into a central location.
Read more →

How to Install Docker Compose v2 on Linux (2021)

In the video Docker Compose v2: What’s New in 2021: DevOps and Docker Live Show (Ep 126) Bret Fisher introduces compose v2. compose is an instrument for running multiple docker containers on your local machine. I use it often to spin up a database container and a separate application container. compose v2, a plugin for docker, is written from the ground up in Go and integrates better with existing tools.
Read more →

The Terminal Sparks Joy

The Terminal Sparks Joy
Today I realized that using tools like the terminal, Vim or Tmux “spark joy” for me. The term comes from Marie Kondo’s bestselling book about tidying up. It loosely translates from original Japanese to ”the feeling of excitement and pleasure”. I thoroughly enjoy using Unix and its tools. For me, it’s like a mini game where I can always learn something new and feel more productive. For example, you can be productive with Vim after a few days.
Read more →

Fake Webcam Background for Arch Linux With Docker (Using akvcam)

Fake Webcam Background for Arch Linux With Docker (Using akvcam)
Note: Updated to work with latest release (2021-06-23). Fake virtual backgrounds for your online meeting on Linux I’ve been attending a lot of video conference calls lately — like so many of us. Others had nice-looking virtual backgrounds. But there was no option to create those backgrounds on my Linux machine. For example, the Zoom version for Linux only allows me to “touch up my appearance”. But there is no option to set a virtual background.
Read more →

TIL: How to Watch YouTube Videos With mpv and Keyboard Shortcuts

Distraction-free YouTube (and other videos) on your computer The free YouTube version has ads and suggestions what to watch. Those try to keep the user on YouTube’s website. Tons of useful videos exist. If you’re like me, you’ll soon fall into the rabbit hole and spend too much time on YouTube. Today I learned how to use a distraction-free method of watching YouTube with mpv and (optionally) Vimium.
Read more →

How to Restart Systemd (Strongswan VPN) Service After Suspend

I’m running a VPN service via systemd on my machine. The service provides a systemd script for me. I can query the service with the standard commands, for example: sudo systemctl status strongswan.service This works fine, except when the computer went to sleep (suspend or hibernate). My machine also stops the wi-fi connection on sleep. When I wake up the machine, the wi-fi connection automatically starts again. My VPN service does not resume.
Read more →

TIL: How to Replace Backslashes (grep, sed, ripgrep, sd, ruplacer)

Today I needed to remove backslashes from a number of files. I have yaml frontmatter that should look like this: tags: - React.js - JavaScript I had some files that had backslashes before the dash: tags: \- React.js \- JavaScript You can use Unix tools like grep or sed to search all files that match a pattern. Then you can replace that pattern. But you have to remember that a backslash is a special character.
Read more →

Friday Picks 079

Read more →

Friday Picks 076

Read more →

Friday Picks 072

Read more →

Fan Speed Control on Manjaro Linux With Nbfc

I have an Acer Nitro 5 notebook with two fans that I can’t control directly. But sometimes I want to manually control the fan speed: set them up to 100% for a short time, or slow them down to avoid noise. On Arch Linux (or Manjaro Linux) there are some tools that can help with that. (For more information, refer to the Arch Linux wiki.) One of options for fan speed control is nbfc, a cross-platform service for notebooks.
Read more →

F# Language Support for Vim on Linux

Last week I had the crazy idea to build a basic web server with F# on my Linux system. I’m spoiled by Vim’s language support for other languages: hover information, autocomplete, etc. The experience is nearly as good as using VS Code. But (Neo)Vim doesn’t come with all the cruft of Microsoft’s Electron-based editor. I thought it would be trivial to get decent language support F#. After all, I’ve already done the work of setting up the necessary plugins and configuration for Vim.
Read more →

Friday Picks 063

Read more →

TIL About Makefiles

Today I learned that you can use Makefiles to create simple task-runners. Stuart Feldman invented Make in 1976 to automate build processes for C programs. But you can use it for other languages, too. For example, Vladislav Supalov uses this Makefile for Docker commands: all: @echo "Usage: build or run" build: docker build -t test . run: docker run --rm -it test Now run the file with your terminal: make > Usage: build or run Build the Docker container via make build or run the container via make run.
Read more →

NativeScript With Android Emulator on Arch Linux

Today I wanted to try out NativeScript: NativeScript enables you to build truly native apps for iOS, Android, and the Web, from a single JavaScript code base. With support for TypeScript, CSS, and popular frameworks like Angular and Vue.js. Install NativeScript Either use Arch’s native packager or npm. With the AUR: yay -S nativescript If you choose to install NativeScript via Node, do it like this: npm i -g nativescript Now you can bootstrap a NativeScript:
Read more →

How I Set Up Redshift

Redshift is a free utility program for Linux that allows you to adjust the computer screen’s color temperature. You’ll want to use the software to reduce eye strain, especially at night. The bluish color of the computer display is hard on your eyes. Redshift colors the screen in a warmer, reddish color. Minimal Installation of RedShift and Setup (Arch Linux) Installation Using the Arch package manager with yay: yay -S redshift-minimal xorg-xbacklight Setup Go to http://www.
Read more →

TIL About the i3 Scratchpad

Today I learned about the i3 scratchpad. The scatchpad is a special i3 window. You can use it as a window that opens your favorite program, e.g., a music player or editor. Examples: # Make the currently focused window a scratchpad bindsym $mod+Shift+minus move scratchpad # Show the first scratchpad window bindsym $mod+minus scratchpad show The first command moves the current window to the scratchpad and makes it invisible. With the second command you open the scratchpad and cycle through all windows.
Read more →

Spotify in the Terminal With spotify-tui and spotifyd

Spotify TUI is a Spotify client for the terminal, written in Rust. In conjuction with Spotifyd, a lighteight Unix daemon, you’ll get a fully-featured terminal application that connects to your Spotify Premium account. Install Spotifyd Installation There are pre-build libraries for different operating systems. For Arch, you can find several packages in the AUR. I use pulseaudio as my sound server, so I chose spotifyd-pulseaudio-git from the AUR: yay -S spotifyd-pulseaudio-git Installation takes a while.
Read more →

Get Your Touchpad Working on Manjaro i3 (2020)

Update: I’ve realized that the problem stems from using the x86-input-evdev-ahm driver. The driver allows you to modify keys, for example, to allow a “space/shift dual role key”. The driver creates a file /etc/X11/xorg.conf.d/80-ahm.conf which overrides the default touchpad settings in /etc/X11/xorg.conf.d/30-touchpad.conf. To fix, just give the touchpad configuration a higher number than the ahm config, for example, 90-touchpad.conf. Now you can use the default libinput library for the touchpad.
Read more →

TIL About Finding the Path Environment Variables With Fish Shell

The fish_user_paths are the alternative for $PATH in fish shell. But how do I find out, what’s in my fish path? echo $fish_user_paths | tr " " "\n" | nl This gives you an array of path environment variables. You can erase a path with set -e fish_user_paths[1]. Be aware that the array is mutable, so if you delete an item, another one will take its place. Further Reading How to remove a path from $PATH variable in fish?
Read more →

How to Get Flutter and Android Working on Arch Linux

Getting Flutter and Android working together is no small feat. Linux may be a first-class citizen when it comes to developing with Flutter, but setting up Java, Android and the Android tool-chain can be a real hassle. This blog post shows how get Flutter working with Android SDK without installing Android Studio. Android Studio is a fully-fledged IDE. If you want to use a different development editor (like Vim or VS Code), Android Studio is only good for eating space on your hard drive.
Read more →

TIL: Linux - Delete Files Older Than X Days

Today I learned that you can pass a date argument to find. I wanted to delete all files that were older than 10 days using the command line. We can use find which ships with every Linux distribution. find . -type f -mtime +20 Find all files that are older than 20 days in the current directory. Now let’s delete them: find . -type f -mtime +20 -exec rm -f {} \; I use fd as an alternative to find:
Read more →

Friday Picks 040

Read more →

TIL: How to Search and Replace Text in All Files With rg and sed

Read more →

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 strongSwan 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

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 →

Change The Default Browser in i3 Manjaro Linux

I’m test-driving a different browser right now: Brave. Brave offers a fast browsing experience while being compatible with Chrome extensions. The cost of switching a browser isn’t that high. So, I installed the browser, but my default browser is still Chromium. How to change that? Configure i3 i3 is my window manager. The configuration file lives in ~/i3/config. For example, Manjaro i3 binds the F2 key to opening the browser:
Read more →

Update ca-certificates

Read more →

Manjaro i3 Lock Screen When Lid Closed

When you close the lid on your laptop (using Manjaro i3), the laptop goes to suspend mode. But the screen doesn’t lock. logind.conf Go to /etc/systemd/logind.conf. You’ll find a configuration option there: #HandleLidSwitch=suspend The commented out lines show you the default behavior. So, suspend on lid close should already work. If not, adjust to your liking. See Power Management with systemd for more information. i3 Configuration Let’s see what’s inside the i3 configuration file.
Read more →

Keyboard Layout Tweaks In Manjaro i3

Why Colemak? In short: better coding experience. The standard Germany keyboard layout (QUERTY) is not helpful for my coding flow. Many keys are hard to reach, for example, the backslash (\). I chose Colemak as my keyboard layout. Colemak offers support for multiple languages is more ergonomic than the standard layout and reasonably easy to learn. Adjust Keyboard With XKB For Linux Damiano Venturin wrote an excellent guide on XKB for Linux that explains XKB.
Read more →

256color $TERM With st, tmux and fish

It can be difficult to get your terminal colors working correctly between your terminal emulator, tmux and your shell. st, tmux and fish shell sometimes don’t play nice together when it comes to setting a 256 color scheme. First, check the TERM variable in the fish shell: $ echo $TERM Ideally, it should be either screen-256color, st-256color, xterm-256color or something like that. You shouldn’t set the TERM variable with fish.
Read more →

Bash and $PATH

I was always confused about where to put my config for the bash shell on Linux. I shoved everything into ~./bashrc because that seemed to be the easiest solution. What is .bashrc? .bashrc is a shell script that Bash runs whenever it is started interactively. It initializes an interactive shell session. You can put any command in that file that you could type at the command prompt. You put commands here to set up the shell for use in your particular environment, or to customize things to your preferences.
Read more →

Fira Code Font Ligatures in Emacs/Spacemacs on (Arch) Linux

I’m playing around with editors. It seems like some Elixir people use Spacemacs instead of Vim for their needs. Spacemacs is an Emacs distribution that comes with default configuration and (optional) Vim keybindings - the best of both worlds! I dabbled in Emacs a while ago when I learned Clojure. But the keybindings were mind-boggling. Even more insane than Vim. So, lets set up Spacemacs with Fira Code Font Ligatures.
Read more →

Setting up Fish Shell With Unicode Glyphs

Fish Shell is an interactive and user-friendly command shell for all platforms. The default shell on Linux (and macOS?) is bash. But fish is much nicer. It looks better, it has great autocomplete features and it just works out of the box with no fuss. You can install beautiful (and useful) themes and prompts which make working with git a breeze. For example, this is the bobthefish theme: You can easily see the git branch you’re working on and other information (i.
Read more →

Sign up for the newletter!

powered by Buttondown