RSSAmplifier

Blog

pboyd.io

Recent content on pboyd.io

pboyd.ioRSS feed ↗28 posts

Latest posts

The death of the programmer

I “hand wrote” code the other day. That is, I used my very own fingers to tap out Python code on a keyboard without any AI assistance. Normally, I use Claude Code or OpenCode for this task, but due to an administrative snafu at work my team temporarily lost access. The code was nothing exciting, but it fixed a real bug. It felt so good to write code again that I told my teammates about…

Project Mithridates Preview

Today, I’m announcing the Project Mithridates Preview program to provide early access to my new video game, Project Mithridates. I would love to tell you all about the game—unfortunately, even describing it would be dangerous. Let me explain. As I was wrapping up development, I recruited playtesters on social media. Each tester was sent a copy of the game, and they all replied with an…

Redefining Go Functions on Mac OS: The Easy Way

My last post showed a complicated way to monkey patch Go functions on Darwin/arm64. The problem I was trying to solve is getting write access to the program’s text segment (the memory containing the machine code). In the first post of this saga, I only needed to call mprotect . But, on Apple silicon, mprotect alone is insufficient to make the text segment writable. I tried some simple…

Redefining Go Functions on Mac OS

UPDATE: After publishing this, I found a much simpler way to do the same thing. I’m leaving this post mostly unchanged, with its unnecessary insanity is intact. Everything here still works, but it’s more complicated than necessary. I’ve been building a package to redefine Go functions at runtime ( monkey patching , if you like). I started with amd64, but since Macs are such a…

Redefining Go Functions

I once wrote a Perl subroutine that would memoize the subroutine that called it. That much was useful, but then it inserted a copy of itself into the caller, so that its callers would be memoized too. A well-placed call to aggressively_memoize could back-propagate to the whole codebase, spreading functional purity like a virus. The resulting program would get faster as it used more memory and…

How to walk safely near buses

What would happen if the one engineer who really knows how it all works in your company were hit by a bus? I’ve never lost a coworker to a bus accident, but given how often I’ve heard the question, thousands of developers must die every year beneath the wheels of a bus. Yet we only focus on limiting the impact of losing that single precious engineer. I say, enough! We have to stop…

Coming to terms with AI Coding Tools

I love writing code. My professional titles have almost always been Software Developer or Software Engineer , but I always considered it a pity that I couldn’t be a plain-old Programmer . I know why: I’m paid to build software, not write code. Software can be sold, code cannot. But it’s the code, not the software, that I love. Don’t misunderstand me. I like it when people…

What is UDP?

Imagine a holiday dinner with the Internet Protocol family: IP is at the head of the table, TCP is to the right, and UDP is to the left. ICMP is in the kitchen, SMTP couldn’t make it (IMAP delivered the apology), and Uncle ARP sits quietly after the introductions. But otherwise, there’s a lot of chatter (protocols, am I right?). TCP entertains everyone with the latest accomplishments…

Introduction to rewriting Git history

I hope you had a chance to play the old Metroid games at least once. If not, find an SNES emulator (I promise it will be more fun than this blog post), or just imagine a 2D side-scroller with a character who shoots aliens and finds power-ups for her spacesuit (I could never figure out why the aliens had power-ups for a space suit they can’t wear). During the occasional breaks in fighting,…

How to avoid one C++ foot gun

I don&rsquo;t think C++ is nearly as bad as some people would make you believe, but it has no shortage of ways to shoot yourself in the foot. I recently wrote some code in the pattern of the following snippet: class CheeseShop { public : CheeseShop(){} CheeseShop(std :: string configPath) { auto cfg = toml :: parse(configPath); auto cheeses = toml :: find < std :: vector < std :: string >> (cfg,…

Follow up to the Reluctant Sysadmin's Guide

Hacker News had a lot to say about my article on securing a server. Oddly, it was one of my more popular articles, but the comments on HN were nearly all negative (2 of 30 top-level comments were positive, and the rest were neutral or critical). But I like being told I&rsquo;m wrong. Not at first, of course&ndash;I am human, after all. But looking back, I nearly always learn something, even if I…

Go Concurrency: Fan-out, Fan-in

The flower bed in the front of my house. Yes, it&rsquo;s overgrown. I&rsquo;m sure an upstanding citizen concerned with suburban respectability, such as yourself, will agree with my wife that I &ldquo;should really do something about that.&rdquo; I had plenty of time this week, so naturally, I used that time to ignore the flower bed and write a mosaic generator . That way, I can give you this…

5 Ways to Write a Go Database Model

When I interview software developers, one of my go-to icebreakers is, &ldquo;How did you get started in programming?&rdquo; Sometimes the answer is that the candidate just had to declare a major. Which is fine&ndash;it&rsquo;s just an icebreaker. But the responses I like most are about the candidate&rsquo;s earliest project. The one that made them want to a programmer. The project varies, but…

Limits of Programmer Productivity

Fred Brooks published The Mythical Man-Month in 1974, describing the lessons he learned leading IBM&rsquo;s OS/360 project during the 1960s. As technology goes, it&rsquo;s ancient. Consider the workflow for a &ldquo;debugging run&rdquo;: We centralized all our machines and tape library and set up a professional and experienced machine-room team to run them. To maximize scarce S/360 time, we ran…

At this company, we are family

Dear Timmy, As I shared at our last family meeting, current economic conditions have forced family leadership to make many difficult decisions. I myself have reduced my golf outings to every other week, and you, undoubtedly, noticed that your mother&rsquo;s car is no longer the current model year. Unfortunately, even these deep cuts, painful as they are, have not been enough. After much…

The Reluctant Sysadmin's Guide to Securing a Linux Server

I wrote a follow-up to this guide, which you should probably consider along with this article. I&rsquo;m not a sysadmin, and I don&rsquo;t want to be. But I write software for the web, which means I&rsquo;m never far from a server, and sometimes I&rsquo;m the only one around. So even if I didn&rsquo;t want the job, I have it, and I need to take the security of these hosts seriously. If…

Designing Good Interfaces

Technician: Welcome to Custom Lube, how can I help you? Me: I need an oil change. Technician: OK, you can hop on out. Where is the oil you want to use? Me: I didn&rsquo;t bring any oil. I expected you would supply that. Technician: That&rsquo;s a common misunderstanding. At Custom Lube, we don&rsquo;t supply oil or anything else. We want our customers to have exactly what&rsquo;s right for them…

Anatomy of a Useless Program

I&rsquo;m sure we&rsquo;ve all been here, just staring at a list of numbers on the screen of your Apple //e, thinking &ldquo;Man&hellip; I wish I knew the sum of those numbers. I know it&rsquo;s less than 65,535, none of them are negative, and gee whiz, I just don&rsquo;t want to open the calculator app on my smartphone.&rdquo; Well, consider this age-old problem solved. Just load this handy…

Back to basics with the Apple II

I have a confession: I don&rsquo;t think very much about memory when I&rsquo;m programming. I know it&rsquo;s there, of course, but only in an abstract way. I&rsquo;m far removed from the details. If a program manages memory particularly badly, then I have to get involved with the details. But, even then, the job is to get the usage back down to something reasonable so I can move on to something…

The day I wiped a production database table

It seems everyone has a story like this, but I&rsquo;ll give you mine anyway. I was 6-months into my first real developer job, trying to fix a bug. Our application would sometimes insert rows with an invalid &ldquo;foreign key&rdquo; (we used MySQL with MyISAM, which didn&rsquo;t have foreign key constraints&ndash;but it had an ID for another table anyway). Of course, the bug was only seen in…

The regex [,-.]

I stumbled on this regex recently: \d{2}[,-.]\d{2} . The intention is clear enough: match two sets of two digits separated by a comma, a dash, or a period. Of course, it shouldn&rsquo;t work. Dashes in character classes are special because they&rsquo;re used for ranges (like [a-z] to match lower-case ASCII letters). If you want - in a character class you put it at the beginning, or the end, never…

Let's build a virtual machine

I once heard about a High School student who thought Europe was the capital of France. Of course that&rsquo;s ridiculous, but how long, do you suppose, someone can go believing Europe is in France and not the other way around? If you&rsquo;re far from Europe physically and mentally, I&rsquo;d bet you could go a lifetime, and it wouldn&rsquo;t even matter. It&rsquo;s only a problem when someone…

Text Encoding: The Thing You Were Trying to Avoid

Programmers tend to treat text encoding like the office bore. You weren&rsquo;t planning on a 2-hour conversation about your co-worker&rsquo;s lawnmower today? Well too bad, because it&rsquo;s happening now. Text encoding is much the same, it&rsquo;s always around, but we&rsquo;d rather avoid it. From time to time it pops over anyway to mess up your day and fill you in about the latest nuance…

An experiment on code structure - Part 2

This is a follow-up to an experiment on code structure . To recap, I built two versions of a back-end for a simple web app with statistics about commercial airline flights. backendA had no real design behind it, it was just whatever fell out of keyboard. backendB was a structure that I&rsquo;ve been using for the past couple years, it isolates dependencies, and uses interfaces with dependency…

How Not to Store Passwords

Here&rsquo;s a fun list to look through: Dumb Password Rules . Most of the rules seem arbitrary, like only allowing digits, but some hint at deeper problems. For instance, preventing single-quotes. They aren&rsquo;t inserting passwords into a database without a SQL placeholder, right? Nearly every site on that list has a needlessly short maximum password size. If they&rsquo;re storing passwords…

An experiment on code structure

Let&rsquo;s say you want some software built. So you hire a team of smart developers, tell them what to build, and leave them alone. Inputs will be needed in the form of computer hardware, pizza and coffee. Of course, you expect outputs in the form of status updates (no one outside the team will understand the updates, but that&rsquo;s beside the point). Since you hired smart developers and gave…

Kinda okay generated text

I recently wrote a Markov chain package which included a random text generator. The generated text is not very good. Here&rsquo;s a sample, based on War and Peace : everything Make way to a child till late and was ready or to crush the Kiev And what he said Prince I will write a leather apron under this We shall go and pressed close up that’s why they are you spent every word from advancing to…

Markov Chains

The first time I ever heard of a Markov chain was overhearing a conversation at work. My coworker was reading generated text from a Markov chain of the King James Bible, and was commenting on how ghastly the produced text was. Here&rsquo;s a sample, Thus saith the children of the liver of God and the tabernacle and forsake my doors of the breast and she sitteth in Seir most holy in at an homer of…