November 4, 2021How to Add a Menu to the Sidebar With SphinxCurrently 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.rst and NEWS....
November 3, 2021How to Compare Two Directories on LinuxWhile 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, 2021How to Set a New Git Default Branch NameWhile 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, 2021How to Quickly Shuffle Some NamesFor 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, 2021How to Debug SSH IssuesIn 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, 2021How to Fix Caching Issues With MoinMoin wikiAfter 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, 2021How to Surround Highlighted Text With a Custom SnippetIn 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, 2021How to Make Subversion Repositories Read OnlyFinally, 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, 2021How to Make a Traceback Less Verbose in Jupyter NotebooksFor 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, 2021How to Setup a Cronjob for a Tool Installed via pipxThe 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....