April 6, 2021How to Replace an URL in All RepositoriesRecently Anthony Sottile, one of the maintainers of Flake8, announced on Twitter that the source code repository of Flake8 was moved from GitLab to GitHub. Those of us, who also use Anthony’s pre-commit, now should update their .pre-commit-config.yaml file. Though there is no hurry, as the repository on GitLab will stay as a mirror. For one of my repos the .pre-config-config.yaml looks like this: repos: ... - repo: https://gitlab.com/pycqa/flake8 rev: 3....
March 29, 2021How to Restrict All Repos Grep to Specific FilesBack at the end of 2020, when Travis announced you need to move your open source projects from https://travis-ci.org to https://travis-ci.com, I wanted to know in which README files I used the link to the org-site - of the many, many repositories I manage. That is a textbook example what you can do with all-repos. A naive way would be to grep in all repositories like … all-repos-grep travis-ci.org Instead of grepping in all files, it is a better idea to restrict the search to only README files....
March 26, 2021How to Avoid Vscode From Causing High Cpu Load When You Have Directories With Many FilesOnce I opened this one project, CPU load went through the roof and just did not stop. There is not much source code in the repository, but a lot of build artifacts get generated by it. I am using VS Code now for quite a while, and especially for this one repository, and I never noticed problems, until recently. As most of the time extensions are the cause for problems, the VS Code team even provides a kind of bisecting mechanism to help find faulty plugins....
March 24, 2021How to Find Duplicate WordsWhen contributing to a new open source project, from time to time I searched the codebase for occurrences of the the. This is a common mistake in comments in English codebases. My friend Miroslav came up with an even better way: Use a regex to find duplicate words! rg --pcre2 "\b(\w+)\s+\1\b" rg stands for ripgrep, which is a blazing fast implementation of a regex command line tool, written in Rust....
March 23, 2021How to Fix a Broken Rollback on Nixos, caused by mixed Python EnvironmentsToday I tried to update a Nixos channel to 20.09.xxx, but the virtual machine was still running on 15.09, and seemingly the nix-version was pinned. I got an error saying something like the nix version is too low. I then tried to do a rollback, but then I got another following error: ERROR: ./batou --help Return code: 1 STDOUT Running unclean installation from requirements.txt Ensuring unclean install ... .batou/unclean/bin/python -m pip install -r requirements....
March 5, 2021How to Find All Repositories in a GitHub Organization Which Do Not Follow the Src Layout?Let’s say, while not everybody is convinced, that the so-called src layout is a great idea, at least it is a trend in the Python eco system. And, e.g. Hynek has written about good reasons to use the src layout. While my personal and work repositories (mostly) follow the src layout, what about the almost 300 Zope repositories? all-repos to the rescue I really love to play with all-repos, an awesome tool to manage and manipulate a large amount of git repositories....
February 25, 2021How to Restrict All Repos to One Github OrganizationEspecially, when maintaining many, many git repositories at once, Anthony Sottile’s all-repos is a bliss. You can easily grep for text or find files in, or even apply patches to hundreds or thousands of repositories at once, which I already described in a blog post. all-repos has a configuration option, which allows you to clone and manage all of your GitHub repositories at once. Mine looks like… { "output_dir": "output", "source": "all_repos....
February 22, 2021How to Check the Expiry Date of an SSL/TLS CertificateFor a couple of years now, I use the fantastic (and free*) service by Let’s Encrypt in order to generate SSL/TLS certificates. One of the main differences to paid certs is that the ones of Let’s Encrypt are only valid 90 days. This sounds bad at first, but actually this is a good thing from a security perspective, and anyway, you do not create / renew certs manually, but one of the many clients do this for you automatically....
February 22, 2021How to Update All Installed Rust PackagesRust is not only known for its memory safety, but also for being (almost) on par with C, speed-wise. In the last couple of years quite some interesting tools were created, which may replace common Linux command line tools, e.g. bat instead of cat, ripgrep instead of grep, … I installed a handful of them via cargo, Rust’s package manager. I can list all packages with cargo install --list …...
February 15, 2021What Is the Difference Between Transaction Abort and Transaction DoomZope is using the transaction package to manage - you guess - transactions. More specifically, a transaction starts when Zope receives a request, and the transaction succeeds when the action triggered by the request works out. When the action causes an exception, the transaction will be rolled back. This means, usually you very rarely have to interfere with the transaction management manually. Last week I was implementing a new XML-RPC API, which basically looks like the following code:...