🦜 Adam Johnson
@adamj.eu@rss-parrot.net
I'm an automated parrot! I relay a website's RSS feed to the Fediverse. Every time a new post appears in the feed, I toot about it. Follow me to get all new posts in your Mastodon timeline!
Brought to you by the RSS Parrot.
---
Your feed and you don't want it here? Just
e-mail the birb.
“Boost Your GitHub DX” out now
https://adamj.eu/tech/2025/11/11/boost-your-github-dx-out-now/
Published: November 11, 2025 00:00
My new book, Boost Your GitHub DX is out now!
This is a book about using GitHub more effectively, touring you through the fundamental features with my experience-based commentary. It covers settings, keyboard shortcuts, hidden features, syntax, techniques,…
Django: Introducing django-http-compression
https://adamj.eu/tech/2025/10/10/introducing-django-http-compression/
Published: October 9, 2025 23:00
HTTP supports response compression, which can significantly reduce the size of responses, thereby decreasing bandwidth usage and load times for users.
It’s a cheap and valuable technique for improving website performance.
Lighthouse, Google’s web…
Django: Introducing django-watchfiles, for more efficient runserver autoreloading
https://adamj.eu/tech/2025/09/22/introducing-django-watchfiles/
Published: September 21, 2025 23:00
Django’s runserver automatically reloads when you change Python files.
Without this autoreloading feature, you’d need to manually restart the server every time you made a code change.
However, the default autoreloading implementation is inefficient, as it…
Git: check if a commit exists on a given branch
https://adamj.eu/tech/2025/09/03/git-check-commit-exists-on-branch/
Published: September 2, 2025 23:00
To check if a commit SHA exists on a given branch, you have a couple of options.
git merge-base --is-ancestor
For a low-level query about commit existence, use git merge-base with its --is-ancestor option.
This command only returns the result through its…
Python: fix SyntaxWarning: 'return' in a 'finally' block
https://adamj.eu/tech/2025/08/29/python-fix-syntaxwarning-finally/
Published: August 29, 2025 17:13
Take this code:
import random
def d6() -> int:
try:
return random.randint(1, 6)
except Exception:
# Ignore issues in random number generation
pass
finally:
# Fallback value chosen by a fair dice roll
…
Python: capture stdout and stderr in unittest
https://adamj.eu/tech/2025/08/29/python-unittest-capture-stdout-stderr/
Published: August 29, 2025 15:49
When testing code that outputs to the terminal through either standard out (stdout) or standard error (stderr), you might want to capture that output and make assertions on it.
To do so, use contextlib.redirect_stdout() and contextlib.redirect_stderr() to…
Git: count files in a repository
https://adamj.eu/tech/2025/08/29/git-count-files/
Published: August 28, 2025 23:00
When you want to count the number of files within a Git repository, it's generally best to use Git itself for the task because it will skip over any generated or downloaded files.
Here is a command chain to use to count all committed files within the…
Django: write a custom URL path converter to match given strings
https://adamj.eu/tech/2025/08/01/django-custom-url-converter-string/
Published: July 31, 2025 23:00
Here’s a little tip based on some work that I did recently.
The project has a URL pattern where the first part of the URL matches the current role the user is viewing the site as.
Let’s say the roles are “chef”, “gourmand”, and “foodie”—example URLs might…
Python: check a package version with importlib.metadata.version()
https://adamj.eu/tech/2025/07/30/python-check-package-version-importlib-metadata-version/
Published: July 30, 2025 17:33
Sometimes, it’s useful to branch the behaviour of your code based on the version of a package that you have installed.
This may be to support an upgrade in your project, or for your own package to support different versions of a dependency.
Historically,…
Django: split ModelAdmin.get_queryset() by view
https://adamj.eu/tech/2025/07/30/django-modeladmin-split-get-queryset/
Published: July 29, 2025 23:00
Within Django’s popular admin site, you can override ModelAdmin.get_queryset() to customize the queryset used by the admin views.
It’s often used for performance optimizations, such as adding a select_related() call to batch-fetch related objects:
from…