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.
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).
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.
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.
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:
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:
When you close the lid on your laptop (using Manjaro i3), the laptop goes to suspend mode. But the screen doesn’t lock. You have to write a script for systemd. i3lock Manjaro i3 ships with i3lock and a custom blur screen out of the box. If you use this tool, you have to create a suspend script as etc/systemd/system/suspend@.service (with root): [Unit] Description=User suspend actions Before=sleep.target [Service] User=%I Type=forking Environment=DISPLAY=:0 ExecStart=/usr/bin/blurlock ExecStartPost=/usr/bin/sleep 1 [Install] WantedBy=sleep.
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.
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.