April 14, 2022

Highlight All Matches in Firefox

Modern browsers are pretty similar, so switching from Chrome to Firefox was no big issue… … except that when I searched something on a page with STRG + F / Ctrl + F, only the first match was highlighted. This was a major annoyance. Was? Yep. Turns out there are two ways to enable highlighting for all matches. Via Keyboard Shortcut In search mode you just need to hit Alt + A....

March 30, 2022

add-apt-repository Does Not Support Private PPAs

When you are a regular user of Ubuntu, you are probably familiar with the term PPA: Personal Package Archive Interlude Ubuntu offers packages via different package repositories ( Main, Universe, Restricted, Multiverse). Whenever you enter e.g. apt install <package> the mentioned repositories are queried. Though, while Ubuntu offers many packages, not all are available via apt. Also, for a given version of Ubuntu the packages usually only get security and bug fixes, but no version updates....

March 10, 2022

How to Update a Force Pushed Remote Branch

Imagine your colleague works on a new feature, and you have checked out their branch for a local review, and after an initial round of feedback and fixes, your colleague performs a git push --force to the remote branch. When you just do a git pull, you’ll end up in a mess like this… $ git pull remote: Enumerating objects: 19, done. remote: Counting objects: 100% (19/19), done. remote: Compressing objects: 100% (11/11), done....

February 7, 2022

How to Gracefully Rename a Command Line Argument in an Argparse Application

The CI runner I am currently working on can be used as follows: lpcraft run --output Now, what is output? A boolean? In the sense of “do create output”? A path to a directory? Something else? disambiguate --output can be used to specify a directory for the build artifacts. So, let’s rename it to --output-directory - problem solved. Yes, but what about all the users out there… argparse magic to the rescue We all know argparse is magic, and sometimes that even helps....

February 7, 2022

How to Create a Host Dependent Bash Configuration

I use LXD containers to develop locally. To ease development, I share my home directory with the containers. This is convenient, but brings along a couple of issues on its own, especially for .bashrc modifications, which only apply to the host. e.g. activating bash completion for pipx. eval "$(register-python-argcomplete pipx)" This certainly only works on my host, where the binary is on the path, but not in my development containers....

December 27, 2021

How to Grep in PDF Documents

The end of the year usually also means having some fun with the tax declaration. One of the tedious tasks is to match payments for insurances with bank statements. As all my bank statements are PDF documents, I wondered how to search/grep in them. pdfgrep for the rescue Turns out there is pdfgrep, which you might need to install via sudo apt install pdfgrep or similar, depending on your operating system....

November 14, 2021

How to Create an Ubuntu USB Install Medium

In Germany the corona numbers go through the roof, many school classes are already under quarantine, so there is no more time to waste and I need to setup a laptop for my son. I still own a 2012 Samsung 900X4D A02DE, which after upgrading RAM and SSD still works decently. As the laptop has no CD drive, I need to setup a USB stick to install a new operating system....

November 12, 2021

Why Do We Get Different Results From Mypy

My colleague added mypy as a test environment for our tox setup. When I checked out his branch and ran it on my machine, it failed. The error does not matter, but fwiw it was about that one upstream package has forgotten to include a py.typed file, a topic which I dedicated a whole blog post. The interesting part was… why did it work on his machine, but not on mine?...

November 10, 2021

How to Properly Configure Isort and Black

When you both use black and isort, which you probably should, you will notice that they both touch the import statements. When you now use both tools e.g. via pre-commit, it could happen that both tools play ping-pong with each other, as both tools modify the source code, and then report a failure. This is especially “funny”, when both tools report modified source and a failure, but basically at the end you have a git repository with no modifications, as the one tools fixes the other’s changes....

November 4, 2021

How to Add a Menu to the Sidebar With Sphinx

Currently I am publishing the documentation on https://readthedocs.org/ for a lot of projects. I was asked that the menu, which is shown at the bottom of the main page, should be also listed in the sidebar. You need to know that menus are tocs in the Sphinx world, short for table of content. initial sitution one long document with code examples (index.rst) menu at the bottom (keyword: toctree), referencing CONTRIBUTING....