April 22, 2022How to Cargo Install a Package With Additional FeaturesMeanwhile you may have heard that there are a couple of new CLI apps out there written in Rust - blazing fast and with additional features. While I rarely use them, as I do not want to get used to tools, which are not available on all Linux machines I work on, I do use ripgrep regularly, as it really makes a difference, especially in speed. Yesterday, I wanted to use ripgrep with PCRE2 (Perl Compatible Regular Expressions), but when I tried it, I got this error message:...
April 14, 2022Highlight All Matches in FirefoxModern 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, 2022add-apt-repository Does Not Support Private PPAsWhen 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, 2022How to Update a Force Pushed Remote BranchImagine 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, 2022How to Gracefully Rename a Command Line Argument in an Argparse ApplicationThe 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, 2022How to Create a Host Dependent Bash ConfigurationI 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, 2021How to Grep in PDF DocumentsThe 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, 2021How to Create an Ubuntu USB Install MediumIn 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, 2021Why Do We Get Different Results From MypyMy 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, 2021How to Properly Configure Isort and BlackWhen 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....