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 successful. 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 choosing “More Actions” and then “Delete Cache” from the page’s menu.

August 11, 2021

How to Surround Highlighted Text With a Custom Snippet

In order to mark strings as “translatable” in Flask via Flask-WTF, you need to apply a special syntax. This means, e.g. in a Jinja template a string like Conference has to be transformed into {{ _('Conference') }}. This is a very tedious work, so I created a shortcut for it. Add the following lines to your keybindings.json: "key": "ctrl+shift+alt+0", "command": "editor.action.insertSnippet", "when": "editorHasSelection || editorHasMultipleSelections", "args": { "snippet": "{{ _('${TM_SELECTED_TEXT}') }}" } I used “ctrl+shift+alt+0” as on keyboard with a German layout the closing curly brace is on the same key as the 0....

August 5, 2021

How to Make Subversion Repositories Read Only

Finally, at work all other teams gave up Subversion and migrated to git. The migration went pretty smooth thanks to git svn and a couple of bash scripts, which made sure tags and branches were transferred correctly. After the migration had been finished, I wanted to shutdown the inherited Subversion server for good - but, I was told to keep it running in read-only mode - for reasons. Ok, can’t be too hard, right?...

August 2, 2021

How to Make a Traceback Less Verbose in Jupyter Notebooks

For a project I wanted to try out something new - using Jupyter Notebook to document its XML-RPC API, so documentation and specification cannot drift apart. This worked out great. Except - as the API also has to handle invalid input, Jupyter Notebook shows - correctly - the traceback. The traceback is super verbose. request server.get_licenses("not-existing-id") current print out in Jupyter Notebook --------------------------------------------------------------------------- Fault Traceback (most recent call last) <ipython-input-5-366cceb6869e> in <module> ----> 1 server....

August 2, 2021

How to Setup a Cronjob for a Tool Installed via pipx

The company I work for finally says good-bye to Subversion, and while migrating to git, we also decided to move to GitHub and no longer host the repositories inhouse. While I think GitHub should be pretty reliable, data loss still could happen, so I decided we need some backup. I use all-repos to manage open source repositories on a daily basis. Its all-repos-clone command looks like a great fit to backup the repositories to a local virtual machine....

July 31, 2021

How to Find Out Which Files Changed Most Often in a Git Repository

I found this helpful command while cleaning up my Desktop - I cannot recall where I got it from :-/ git log --since 6.months.ago --numstat | awk '/^[0-9-]+/{ print $NF}' | sort | uniq -c | sort -nr | head This will list the top 10 most often changed files in your git repository. Why would you want to know this? Well, several things come to my mind: you get a quick overview what was changed in the last couple of months this could indicate problems such as a god class, when a file shows up you did not expect What do you think?...