January 22, 2026 - Using .casefold() for Case-Insensitive String Comparison in Python

When you need to compare string in Python, a lot of us reach for .strip().lower() by default to pre-normalize the strings. But it turns out that .lower() doesn’t really work when you start thinking about non-ASCII characters. For example, the German letter “ß” (Eszett) should probably be equivalent to “ss” in a case-insensitive comparison, but .lower() doesn’t handle that correctly. So how can we do better? Python has a method ....

January 22, 2026 · 1 min · 196 words

July 29, 2024 - Running CRON Jobs on Modal

Recently, I’ve been working to migrate my own personal infrastructure off of Kubernetes, given that it has become quite expensive to run for just a single hosted website. For example, on Linode, the smallest cluster (3 nodes), along with a load balancer, and several disks, was approaching 50$ a month. Indeed, what did I actually use my cluster for? I used it for hosting one-off websites for a couple of days, and then tearing them down, I used it for my own personal website, and I used it for a host of CRON jobs that have to run every hour or every couple of days....

July 29, 2024 · 2 min · 404 words

June 11, 2024 - Using K9s to Manage Kubernetes Clusters

I use Kubernetes (K8s) to manage both my personal website, and some client-facing projects. Recently, however, I’ve discovered something that is making my life a whole lot easier: K9s - a terminal-based UI (think htop) for managing Kubernetes clusters. Some of the awesome features: I can actually see all of my pods running at once, their CPU/memory usage, and what their internal IPs are I can tail logs using a UI, and I don’t have to remember all of the kubectl commands to do so I can see if things are dead, or died, at a glance....

June 11, 2024 · 1 min · 133 words

March 18, 2024 - Adding a tag to an older commit

To add a tag to an older commit, you can use the following command: git tag -a {{ Tag Name }} {{ Commit Hash }} -m "Message here" For example, if you wanted to add a tag to the commit with the hash a1b2c3d4, you would use the following command: git tag -a v1.0 a1b2c3d4 -m "Version 1.0" This will add a tag called v1.0 to the commit with the hash a1b2c3d4, and the message “Version 1....

March 18, 2024 · 1 min · 104 words

January 29, 2024 - Appending content to a database using Notion's API

Sometimes, I want to visualize some of my experimental results, or share them with others. One of the easiest ways to do this is using notion: which is capable of handling a variety of data types, and can be published to a relatively nice looking website, with minimal effort. Step 1: Creating a notion integration To do this, you first have to create a notion integration, which you can do here....

January 29, 2024 · 3 min · 554 words

January 24, 2024 - Using UUID for Unique Identifiers in Python

In lots of situations, we may need a unique identifier for an object, for example, when running a database transformation, we may want to create a unique key for each record, or when creating a database, we might want a unique key for each object in the database. In these situations, I’ve seen a lot of people use some variant of the following code: import random import string def generate_random_unique_identifier(length=10): return ''....

January 24, 2024 · 2 min · 378 words

January 23, 2024 - Detecting COCO Objects with Detectron2 API

Sometimes you need to run an object detector as part of a larger system. One of the best tools for bringing in a pre-trained detector may be the detectron2 framework from Meta. Installation To install detectron2, it’s as easy as a pip install: python -m pip install git+https://github.com/facebookresearch/detectron2.git Detectron2 API It’s amazingly easy to being to extract objects from images using their pre-trained models. First, you get a model from the model zoo:...

January 23, 2024 · 2 min · 265 words

January 22, 2024 - Handling basePath in next.js client components

It turns out that hosting a next.js application in a subdirectory isn’t as easy as it should be. There are two major issues that I’ve run into when doing this: (1) Handling links to local pages and (2) Handling links to static assets. The right way to handle this is to set the basePath in the next.config.js file. This will cause the next.js router to prepend the basePath to all links:...

January 22, 2024 · 2 min · 273 words

January 19, 2024 - Cloudfront Egress is pretty cheap!

This isn’t really a TIL, but it turns out that Amazon provides 1TB of free egress from S3 buckets with a CloudFront CDN front-end (instead of the standard 100GB available for free with S3 alone). To get started, I followed this tutorial – but it assumes a pretty high level of prior understanding of AWS, so if you’ve never used CloudFront, AWS, or S3 before, it might be best to google around for another tutorial....

January 19, 2024 · 1 min · 139 words

January 11, 2024 - Configuring AWS CLI Endpoint URL

So, for a long time, it wasn’t possible to configure the AWS CLI to use a custom endpoint url by default. Since I usually use Wasabi for my S3 storage, I had to use the --endpoint-url flag every time I wanted to use the CLI, pretty annoying, right? Well, turns out at some point Amazon added a set of useful configs to their CLI. To configure the CLI to use a custom endpoint url, you can add the following to your ~/....

January 11, 2024 · 1 min · 102 words