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

November 3, 2021

How to Compare Two Directories on Linux

While migrating a couple of Bazaar repositories to git, I experienced some problems with one Bazaar repository, or let’s say the exporter did not work properly on one of its commit. In order to find out what exactly happened, I needed to compare both the tip of the git and the Bazaar repository. Turns out, diff can not only compare files, but also directories… recursively! $ diff -qr bzr/wadllib/ git/wadllib/ Only in bzr/wadllib/: ....

November 2, 2021

How to Set a New Git Default Branch Name

While GitHub’s default branch name for newly-created repositories is main since the end of October 2020, what about when you create a new git repository locally? first things first git made the default branch name configurable in version 2.28 and higher. So, when you run e.g. Ubuntu 20.04 like me, you may have an older version installed. Usually, you can’t install a newer version without updating the distribution. But there is hope, you can install a newer git version via a PPA (personal package archive):...

October 26, 2021

How to Quickly Shuffle Some Names

For the daily standup, we have a random order who starts, who follows next, and so on. How to shuffle a couple of names? Well, obviously, you could fire up a Python repl and use the random library, e.g. >>> from random import shuffle >>> members = ["Me", "TeamMate1", "TeamMate2", "TeamMate3", "TeamMate4"] >>> shuffle(members) >>> members ['TeamMate3', 'TeamMate4', 'TeamMate1', 'TeamMate2', 'Me'] While this works, it is a lot of typing, and a lot of quotes :-)...

October 5, 2021

How to Debug SSH Issues

In order to set up a development environment for Launchpad, I needed to install and run lxd. After launching my first container, I wanted to ssh into it, but was not successfull. Basically, now you have two ways to find out what is going on. Run the ssh command again with -v, so you see more output. ssh -v user@host The other choice is to go into the container and start the ssh server in debug mode....

October 5, 2021

How to Fix Caching Issues With MoinMoin wiki

After making two changes to a MoinMoin powered page, the first change showed up immediately, the second one did not show up at all. Though the changes were visible both in the edit view, and in the history. Turns out this was a server-side caching issue which could be solved by chosing “More Actions” and then “Delete Cache” from the page’s menu.