Recent Posts

See also posts by tag or search with DuckDuckGo:

Django: serve a security.txt file

When a security researcher finds a vulnerability in your site, they need a way to tell you about it. Without a clear contact, they may resort to guessing at addresses like security@<yourdomain>, messaging random folks on social media, or give up. And of course, in the worst case, they might just publish the details, leaving you to find out when attackers do.

Read more...

Zsh: sort globs in natural order with the (n) glob qualifier

Globs sort filenames character by character, so numbered files often come out in a surprising order, with 10 before 2. Zsh has a neat fix for this: the n glob qualifier, which applies a “natural” sort, treating any run of digits as a number rather than a string of characters.

Read more...

Software Engineering: join my meetup in Lisbon, 8th October

I previously announced my Python optimization workshop in Lisbon, on 10th October (which still has a few places). I am now pleased to add a Python/Django meetup on the Thursday before.

Read more...

Zsh: find the largest files with the (OL) glob qualifier

Got a directory that you want to tidy up bloat from? Whether you’re trying to find bad build artifacts in your work repository or clear out old cat videos from your home directory, Zsh’s (OL) glob qualifier can help you find the largest files.

Read more...

macOS: use caffeinate to keep your computer on

If you’re starting a long job on your Apple Macintosh Computer and wandering off for a coffee, the machine may go to sleep before it finishes due to inactivity. To prevent that from happening, also give your computer a boost with the caffeinate command, a macOS built-in since 2012 (OS X Mountain Lion).

Read more...

Python: join my optimization workshop in Lisbon, 10th October

I’m running a workshop in Lisbon next month, and you’re invited!

Read more...

Django: serve the change password well-known URL

When a password manager detects that a user’s password has been leaked or reused, it can prompt them to change it, but the password change URL varies by site. The web’s answer to such discovery problems is the reserved /.well-known/ URL namespace (RFC 8615), home to machine-readable files and endpoints like security.txt. A Well-Known URL for Changing Passwords is the web specification that uses this namespace to fix password page discovery. It reserves the URL path /.well-known/change-password to redirect to your actual change password page, wherever that lives.

Read more...

Django: introducing django-mcpz, for making MCP servers

I made another package! Say hello to django-mcpz, for building Model Context Protocol (MCP) servers in your Django project.

Read more...

Zsh: manipulate filenames with modifiers like :r (root) and :e (extension)

Zsh modifiers are a family of suffixes that transform words as they’re expanded. Several of them are dedicated to slicing up filenames, replacing fiddly calls to dirname, basename, and friends. Let’s take a look at them now!

Read more...

Django: django-upgrade 1.32.0 out now, with 44 AI-assisted bug fixes

django-upgrade is my tool for automatically upgrading your project code for new Django versions. It rewrites your Python files to fix deprecations and adopt some new features, taking a chunk of the monotony out of upgrading between Django versions.

Read more...

Python: use re.prefixmatch() instead of re.match() from Python 3.15

Take this validation function:

Read more...

Python: fix SyntaxWarning: invalid octal escape sequence

Take this code:

Read more...

Python: fix TypeError: NamedTuple() got an unexpected keyword argument

Take this code, defining a small NamedTuple with a keyword argument per field:

Read more...

Python: introducing emojet, a fast emoji lookup library

New package just landed!

Read more...

Python: tprof 1.3.0: now with less overhead

Back in January, I introduced tprof, a targeting profiler for Python 3.12+ that measures the time spent in specific functions, rather than your whole program. As a reminder, here’s the basic usage, specifying a target function with -t and a script to run:

Read more...

Django: introducing django-msgspec

It’s another day, another new package day here. Say hello to django-msgspec, a package of drop-in replacements for Django and Django REST Framework (DRF) components backed by msgspec.

Read more...

Git: my git stash -p optimization in Git 2.55

I got another commit merged in Git 2.55 (2026-06-29), yay! The release note reads:

Read more...

Git: list files at a given commit with ls-tree

To list all files in your repository as they were at a given commit, use git ls-tree with its -r and --name-only options:

Read more...

Zsh: select files with arbitrary code in (e) or + glob qualifiers

Zsh glob qualifiers can select files by many built-in attributes: type, size, modification time, and more. But when no built-in qualifier fits, you can bring in the e or + qualifiers to run arbitrary code, making globs a fully programmable file filter. With great power comes great responsibility!

Read more...

Git: exclude commits by an author in git log with --perl-regexp

git log has an --author option to limit the output to commits from matching authors:

Read more...

Zsh: list recently modified files with (m0) glob qualifiers

My downloads directory is a junk pile that I just never get around to fully clearing. So if I’ve just downloaded a bunch of files, I normally want to work with them and ignore the rest of the files.

Read more...

Python: how time-machine is O(1) where freezegun is O(n)

time-machine is my library for mocking the current date and time in Python tests. Its headline advantage over freezegun, the library that inspired it, is speed.

Read more...

Python: time-machine 3.3.0 lets your tests time-travel even faster

time-machine is my library for mocking the current date and time in Python tests. I’ve just released version 3.3.0 with a decent number of changes, so here’s a lovely summary for you.

Read more...

Python: fix ValueError: day of month directive '%d' may not be used without a year directive

Take this code, parsing the date of an annually recurring event that only has a month and day, such as a work anniversary:

Read more...

Python: fix TypeError: NotImplemented should not be used in a boolean context

Take this class, which implements __eq__() and derives __ne__() from it:

Read more...