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....

Detect dark mode in javascript

A reminder to myself, because I’ve forgotten this too many times and had to look it up again and again. if (window.matchMedia) { if (window.matchMedia('(prefers-color-scheme: dark)').matches) { const body = document.getElementsByTagName('body')[0]; body.classList.add('dark'); } } ...

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 ....

Switching from Jekyll to Hugo

As you can tell, I’ve switched this blog from Jekyll to Hugo since its entire toolchain comes in a single downloadable binary. I don’t need bells and whistles, and the Paper theme makes it look like I still know how to make pretty things. While Hugo has the hugo new generator, and it works really well, I wanted to preserve the hugo import jekyll migrated filename pattern. Time for a new skeleton script, this time in ruby because I used bash in the last one....