week 25, 2023

Completely purge files from a git repository

I have occasionally ended up with files I did not want in my git repositories. These can both take up a lot of space, and contain sensitive data that we just want to remove (such as MySQL dumps, deploy keys etc).

Git keeps a history of all files, so just deleting the file doesn’t “make it go away”. The only way to completely remove the file is to scan through all history, removing all references to (and history of) those files, and finally pruning the git repo (physically removing references to what we just deleted). Finally you have to force-push the repo changes back to the remote, overwriting the remote.

Source: Completely purge files from a git repository (including history), an article by Ralph Slooten.

Big O Notation: A Simple Explanation With Examples

It’s hard to create efficient algorithms without understanding the time and space complexity of various operations. The concept of Big O notation helps programmers understand how quickly or slowly an algorithm will execute as the input size grows.

In this article, we’ll cover the basics of Big O notation, why it is used and how describe the time and space complexity of algorithms with example.

Source: Big O Notation: A Simple Explanation With Examples.

Clearing up some misconceptions about Passkeys

I am unreasonably excited about passkeys, I’ve long been looking for a better/more convenient way than passwords to do authentication, and I think passkeys are finally it.

However, whenever I see passkeys mentioned (for example on the recent Tailscale post about them), there are always a lot of misconceptions that surface in the debate. I’d like to clear some of them here, and hopefully explain a bit better what passkeys are.

Source: Clearing up some misconceptions about Passkeys, an article by Stavros Korokithakis.

The Bubble (2022)

A group of actors and actresses stuck inside a pandemic bubble at a hotel attempt to complete a film.

In the evening Alice, Esme, and I watched The Bubble. I didn't like the movie much and give it a 5 out of 10.

Even in the Wild, Mice Run on Wheels

In 2009, neurophysiologist Johanna Meijer set up an unusual experiment in her backyard. In an ivy-tangled corner of her garden, she and her colleagues at Leiden University in the Netherlands placed a rodent running wheel inside an open cage and trained a motion-detecting infrared camera on the scene. Then they put out a dish of food pellets and chocolate crumbs to attract animals to the wheel and waited.

Wild house mice discovered the food in short order, then scampered into the wheel and started to run. Rats, shrews, and even frogs found their way to the wheel—more than 12,000 animals over 3 years. The creatures seemed to relish the feeling of running without going anywhere.

Source: Even in the Wild, Mice Run on Wheels, an article by Emily Underwood.

Carry on Screaming! (1966)

The sinister Dr Watt has an evil scheme going. He's kidnapping beautiful young women and turning them into mannequins to sell to local stores.

In the evening Adam, Alice, Esme, and I watched Carry on Screaming!. Adam had proposed to watch this this very old movie together. I didn't like it much and give it a 6 out of 10.

The Body Farm

Little Emily Steiner left a church meeting late one afternoon and strolled toward home along a lakeside path; a week later, her nude body was discovered, bound in blaze-orange duct tape. Called by the North Carolina authorities, forensic pathologist Kay Scarpetta recognizes similarities to the gruesome work of a serial killer who has long eluded the FBI But as she tries to make sense of the evidence, she is left with questions that lead her to the Body Farm, a little known research facility in Tennessee where, with the help of some grisly experiments, she might discover the answer.

It is Scarpetta alone who can interpret the forensic hieroglyphics that eventually reveal a solution to the case as staggering as it is horrifying. But she must also endeavor to help her niece, Lucy, who is embroiled in controversy at Quantico. And Scarpetta, too, is vulnerable, as she opens herself to the first physical and emotional bond she has felt in far too long a time.

In the afternoon I started in The Body Farm, Kay Scarpetta book 5 by Patricia Cornwell.

Understanding Quantum Secrecy

We begin with describing the core problem of quantum communication: the encoding (and decoding) of information. We distinguish between the classical elementary unit of information (bit) and the quantum elementary unit of information (qubit).

We end with a description of the core problem of quantum secrecy: quantum key generation and distribution.

Source: Understanding Quantum Secrecy, an article by Declain Thomas.

Extraction II (2023)

After barely surviving his grievous wounds from his mission in Dhaka, Bangladesh, Tyler Rake is back, and his team is ready to take on their next mission.

In the evening Esme and I watched Extraction II. I liked the movie more than the first one and give it an 8 out of 10.

Custom giraffe caret

Recently, a colleague asked me if there is a way to customize an input caret using CSS. I knew you could change the color of it, but it got me thinking if we could completely replace it. The problem seemed interesting to solve.

Source: Custom giraffe caret, an article by Stanko Tadić

Making Python 100x faster with less than 100 lines of Rust

A while ago at $work, we had a performance issue with one of our core Python libraries.

This particular library forms the backbone of our 3D processing pipeline. It’s a rather big and complex library which uses NumPy and other scientific Python packages to do a wide range of mathematical and geometrical operations.

Our system also has to work on-prem with limited CPU resources, and while at first it performed well, as the number of concurrent physical users grew we started running into problems and our system struggled to keep up with the load.

We came to the conclusion that we had to make our system at least 50 times faster to handle the increased workload, and we figured that Rust could help us achieve that.

Source: Making Python 100x faster with less than 100 lines of Rust, an article by Ohad Ravid.

Bit Hacking (with Go code)

At a fundamental level, a programmer needs to manipulate bits. Modern processors operate over data by loading in ‘registers’ and not individual bits. Thus a programmer must know how to manipulate the bits within a register.

Source: Bit Hacking (with Go code), an article by Daniel Lemire.


As a programmer, you use hash functions every day. They're used in databases to optimise queries, they're used in data structures to make things faster, they're used in security to keep data safe. Almost every interaction you have with technology will involve hash functions in one way or another.

Hash functions are foundational, and they are everywhere.

But what is a hash function, and how do they work?

Source: Hashing, an article by Sam Rose.

Compiling typed Python

It’s been nine whole years since PEP 484 landed and brought us types from on high. This has made a lot of people very angry and been widely regarded as a bad move[1]. Since then, people on the internet have been clamoring to find out: does this mean we can now compile Python to native code for more speed? It’s a totally reasonable question. It was one of my first questions when I first started working on Python compilers. So can we do it?

Source: Compiling typed Python, an article by Max Bernstein.

Introducing the Nix Flake Checker

Quite possibly the best thing about the Nix ecosystem is that there's a small army of people hard at work improving Nixpkgs, the largest software package repository in existence and one of the most active repos on GitHub, every single day. Not only are they constantly adding brand new packages for stuff that you might want to use—over 80,000 packages and counting!—they're also updating existing packages, which sometimes even includes fixes for critical security vulnerabilities.

But to take full advantage of this steady drumbeat of progress, it's important that you follow some best practices. To help you adopt those practices, we at Determinate Systems have created a tool called Nix Flake Checker and we're excited to release it to the Nix community.

Source: Introducing the Nix Flake Checker, an article by Luc Perkins.

NATS: building a Nix binary cache

For the past month or so, I’ve been experimenting with Nits, a different approach to NixOS deployments that is pull rather than push-based. And as part of that effort, I needed to address how exactly I would push NixOS system closures to the machines under management.

Typically, in a push-based deployment approach, you can copy the system closure directly via SSH whenever you’re deploying. But with Nits, the agent process running on the target machine needs to be able to connect and download the latest closure on demand, sometimes days or weeks after the deployment was triggered.

“Use a Binary Cache”, I hear you say. And yes, I did. But instead of spinning up an instance of Harmonia, configuring an S3 Bucket or hitting up Domen over at Cachix, instead, I decided to roll my own.

Source: NATS: building a Nix binary cache, an article by Brian McGee.

Error vs. Exception

There has been confusion about the distinction between errors and exceptions for a long time, repeated threads in Haskell-Cafe and more and more packages that handle errors and exceptions or something between. Although both terms are related and sometimes hard to distinguish, it is important to do it carefully.

Source: Error vs. Exception.