Python CGI: a lost and poorly-documented art

I’ve been playing with webhooks in Codeberg (i.e. Forgejo). Forgejo have a very nice php example webhook handler. I know that I can write it as either a python or a golang webapp but what if I don’t want to write another webapp and I just want something to process the JSON POST in the same way as the php script. Aside from the fact that the cgi module is deprecated since python 3....

Bump semver tag in git

There are a number of scripts and git aliases that allow you to bump a semver tag in git, but none of them completely suit my needs. Consequently, I wrote my own bash script to do exactly what I need for my own admittedly-simple workflows. #!/usr/bin/env bash set -e USAGE_TEXT="Bump and tag the current repository using semantic versioning (https://semver.org/). Usage: git-bump [options] [major|minor|patch] Default: patch Options: -n|--no-update Don't update repository before tagging....

Where is this IP coming from?

Sometimes you really want to know where an IP is coming from. Whether you are doing abuse or threat hunts, or just want to know who owns that IP blocked by fail2ban for spamming your SSH server. Each IP belongs to a specifc Autonomous System. An autonomous system (AS) is a very large network or group of networks with a single routing policy. Each AS is assigned a unique ASN, which is a number that identifies the AS....

Another password manager

I’ve been playing with password managers on and off for a long time. The first personal desktop app that I wrote was called JPasskeep and was written in Java Swing to explore Java’s cryptography and UI design and interaction patterns. It was a good experience and helped me get a gig as the UI engineer on a nifty Android project many years later. I’ve used JPasskeep on and off over the years, mostly on consulting gigs when I needed to store passwords on various development machines, and storing them as ....

I'm being stubborn

I’ve been writing a lot of Go code for the past few years and I have really come to appreciate the code generation patterns that Go developers use. In this case, the excellent Moq library to generate test doubles for unit tests. No third-party code is necessary to use these test doubles, which is an unusual joy nowadays with masses of transitive dependencies frequently required for anything interesting. One thing that has been bugging me for a while with moq is that in its documentation and generated code it calls these test doubles mocks when they are clearly stubs....

Golang webapp skeleton

I’ve been writing webapps for a long time, and over that time I’ve written them in as may ways as possible. Currently my default is to create a simple server-side-rendered webapp in whatever language I use the most. Right now that is Go (or golang) so I’ve created a basic web application skeleton to make it easier to get something rolling without trying to figure out (or remember) how to link all the bits together....

Gotchas with static sites on S3 via CloudFront

There’s a ton of posts already on how to set up static sites hosted on S3 via CloudFront. This isn’t going to be one of them. What I want to discuss is some weirdness that I encountered with setting up this blog. For the purpose of this post we’re going to assume that you are going to create a hypothetical static site: https://example.com If you host a static site on hardware, or a VPS (be it an EC2 instance or a DigitalOcean Droplet) you’ll most likely do this with one of the various available web servers, like nginx or apache, and use a service like Let’s Encrypt to create the TLS certificate....

Diceware passphrase generator

There are many ways to generate passwords, and to avoid passwords in the first place (which you really should do), but I wanted a little practice in writing interactive bash scripts. So I chose to create a password generator based on the Diceware algorithm, even though I don’t carry any dice with me. Find of the day is the excellent gum tool that makes it easy to create pretty user interaction....

Good-enough leader election with MySQL

Leader election, in distributed computing, is the process of designating a single process as the organizer of some task distributed among several computers (nodes). Before the task has began, all network nodes are either unaware which node will serve as the “leader” (or coordinator) of the task, or unable to communicate with the current coordinator. After a leader election algorithm has been run, however, each node throughout the network recognizes a particular, unique node as the task leader....

GitHub Actions for Build & Release

I like to write code, build, and release tooling, for my brain at 3 AM. No surprises, no clever bits to trip me up. Lately I’ve been playing with GitHub Actions to build and deploy some of my public projects. It took a little while to figure out something that I could copy and paste between them, and I’d like to share what I’ve managed to come up with. Build Actions Committed to your project as ....