Awesome psql tips

Today I learned about psql-tips.org by Lætitia Avrot, an excellent repository of psql (the CLI tool, not the database itself) tips. I like how one randomized tip is playfully served on the home page while the complete list is always at hand.

February 23, 2023

Making the latest C# language features available in older .NET versions

In a C# library I’ve been working on, I wanted to use C# 9.0’s init keyword. Quoting the documentation: The init keyword defines an accessor method in a property or indexer. An init-only setter assigns a value to the property or the indexer element only during object construction. This enforces immutability so that once the object is initialized, it can’t be changed again. Consider the following class: public class Person { public string FirstName { get; init; } } You can initialize it like this:...

February 4, 2023

On implementing the ASP.NET Core 7 rate-limiting middleware

Today, my last self-assigned duty before the Christmas break was to migrate our in-house rate-limiting implementation (based on the AspNetCoreRateLimiting third-party package) to the new, shiny rate-limiting middleware introduced by ASP.NET Core 7. While the process was relatively straightforward, I stumbled upon a few quirks I want to annotate here. Our use case is simple. We use what the ASP.NET Core 7 documentation defines as a “fixed window limiter.” It uses a specified time window to limit requests....

December 23, 2022

Brazilian Ju-Jitsu and me

I attended my first BJJ class a little more than a month ago. Going into it, I was hesitant. After many years doing what most people today call calisthenics, I wanted to try something new and challenging. But would it be appropriate for me to get into martial arts at the age of fifty-two? When I discovered that we have a branch of the renowned Roger Gracie Academy here in my hometown, I thought it was time to find out....

October 27, 2022

How to avoid unwanted calls on iPhone

Oh, joy. After many years with an iPhone, today I learned how to stop spam calls with a single, not-really-super-secret move. Settings > Phone > Silence Unknown Callers That’s it. Unknown callers now go straight to my recent calls list for me to (eventually) review. Most importantly, the phone doesn’t ring. I initially had True Caller installed and enabled, which worked for a while. Spammers use throw-away numbers anyway, so it’s super-hard for tools like that to keep track....

October 20, 2022

The Docker Event Monitor

I added a new tool to my amateurish DevOps toolbox. Developed in the open by Tom Williams, the Docker Event Monitor is a “tiny container that monitors the local Docker event system in real-time and sends notifications to various integrations for event types that match the configuration. For example, you can trigger an alert when a container is stopped, killed, runs out of memory or health status change.” At its core sits a simple python script that monitors the docker....

September 8, 2022

How to copy a file's path in macOS Finder

No matter how long I’ve possessed a Mac and how hard I try, there will always be a helpful keyboard shortcut hidden somewhere that I don’t know about. Today I learned about holding the Option key while clicking on the Copy command in Finder. It activates the super-useful (and super-secret) “copy as pathname” feature. I spotted this trick on Jamie Smith’s website, where other handy shortcuts (and the pretty gif above) reside....

April 4, 2022

The curious origins of Bluetooth's name

When Giulia came home from school today, she was anxious to tell me what she learned about a Viking King and his legacy. She told me the story of King Harald Gormsson, who ruled Denmark and Norway from c. 958 to c. 986. Harald is mainly known for introducing Christianity to Denmark and consolidating his rule over most Jutland and Zealand. However, what sparked my interest is that Harald was nicknamed “Bluetooth”, and, in 1997, the Bluetooth wireless specification design was named after him....

February 9, 2022

Automatic deletion of older records in Postgres

We have a Postgres cluster with a database for each user. Each database has a table that records events, and we want this table to only record the last 15 days. If we were on MongoDB, we could use a capped collection, but we are in Postgres, which does not have equivalent functionality. In Postgres, you have to make do with something homemade. My first idea was to install a cron job in the system....

January 16, 2022

Migrating a Windows 10 VM to Windows 11 in Parallels Desktop: a story of TPM chips and BIOS upgrades

This weekend assignment was to upgrade a couple of old Windows 10 VMs to Windows 11 in Parallels Desktop 17. I couldn’t do that right away because Windows Update was complaining about the lack of the TPM chip. A little research revealed that TPM chips only work on UEFI BIOS. To check which BIOS version was being used in my VMs, I used the msinfo32 (System Information) application. It showed the BIOS to be of “Legacy” type....

December 11, 2021