May 12, 2021How to Create an Empty Git BranchWhat do I mean by an empty branch? Simply, a branch with no commits. Why on earth… Why would one even need an empty branch? There are not many reasons which come to my mind, but imagine you start a rewrite of an existing project, and you want to start from scratch, but you want to keep the rewrite in the same repository. For example tox does this: the current main version is on master the upcoming version 4, which is a complete rewrite, is on the rewrite branch....
May 5, 2021How Can You Reclaim Some Disk Space From DockerIf you use Docker containers, and who doesn’t these times, you need to take care that Docker does not accumulate a lot of cruft. remains of docker run If you start a container via docker run, and without the highly recommended option --rm, the exited Docker container will still leave some remains on your system. In my case oO… ❯ docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES c14c0bd0d850 jetbrains/youtrack:2020....
April 30, 2021What Is the Meaning of Dollar Dollar in BashI stumbled upon a colleague’s bash script which contained the following line, which in isolation, made not much sense to me. WRKDIR=~/app/work$$ But after some googling and having a look at the complete scope of the script, I finally got it. ... WRKDIR=~/app/work$$ ... mkdir $WRKDIR ... ... ... ... rmdir $WRKDIR $$ is a reference to the PID (process id) it was used to create a unique temporary file All good?...
April 29, 2021How to Run a Bash Script in a Sane WayWhen you never had problems with running/debugging a bash script, you might wonder what I am talking about. Instead of introducing the possible problems, and then the way to counter them, let’s start with the solution. All your bash scripts should probably start with… #!/usr/bin/env bash … wait… it goes on… set -euxo pipefail Wat? Ok, let’s go through the options, one by one. set -e This makes a bash script to stop on error immediately, and exit....
April 29, 2021How to Configure a Webserver to Be Less SecureThis question sounds odd. Why would you want a less secure web server? Well, maybe you have to support older clients. e.g. IE 11 on Windows 8.1 or Java 7 (cough) cannot connect to a web server, which only uses modern and secure ciphers. From a Java application, which cannot be updated, but has to work, I got the following exception: Exception in thread "main" javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure at sun....
April 27, 2021How to Globally Gitignore Configuration FilesUntil today, I did not make up my mind about what to do with configuration files, created by e.g. VS Code. Certainly, I do not want to commit them, but putting it into every’s repository .gitignore file is also cumbersome - and sometimes it is not possible. I always do a git add -u to avoid accidentally adding a venv or similar, so it did not really matter. Except… ❯ ....
April 24, 2021How to Test Log Output With zope.testrunnerHow to test log output with zope.testrunner? While pytest makes it very easy to work with log files via the caplog fixture, I was not aware how to test them with zope.testrunner, which is used for almost all Zope repositories. When I asked during yesterday’s Zope sprint, I got no answer. But coincidentally, I stumbled upon a broken doctest which… tests the log output of a function! So… thanks for failing… I guess :-)...
April 19, 2021How Many Zope Repositories Are Compatible With Pypy?Today, Johannes Raggam asked on the Plone/Zope community forum whether Zope is able to run on PyPy. While I am not entirely sure, and I have some vague memories about potential problems with RestrictedPython, I can certainly grep the almost 300 Zope repositories for signs of PyPy support. The best sign of PyPy support is IMHO that we run tests for it :-) In order to grep in all repositories I use all-repos written by Anthony Sottile....
April 19, 2021How to List All Open Pull Requests for One GitHub OrganizationWhile most developers probably know, that you can list all your open pull requests on GitHub via https://github.com/pulls, how can you list all open pull requests for one GitHub organization? I was on holiday for two weeks, and I want to get up to speed which pull requests need to be reviewed in my company… Luckily, there is no need to do a complicate query or work with GitHub’s GraphQL API…...
April 17, 2021How to Capitalize HeadingsEspecially in English texts… I am no native English speaker, and there are so many subtleties in the English language, so when I was about to prepare my lightning talk submissions for both PyOhio and PyCon US, I was super happy that my friend Miroslav Šedivý sent me the following link: https://capitalizemytitle.com/ At this site you can just paste your heading’s text, and you receive it properly capitalized, even in different styles, e....