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 →

broot - the better ls

It’s become popular to rewrite classic command-line tools in Rust: Shell is the essential tool for every programmer. The more familiar you become with the available tools, the more efficient you can be with using your computer. Many Rust alternatives provide a modern, faster, and more user-friendly alternative. One of them is broot. What Is broot? broot is a combination of ls (for listing directory contents) and tree (for listing contents in a tree-like format).
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

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 →

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

updated on: 2020-02-21 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 →