Welcome to nickb.dev, a blog by Nick Babcock! Below are my most recent articles. You can find the history of all my writings in the archive or just find out more about me.


Replacing an unavailable ZFS drive

The day I’ve known for a while has come: a drive in my ZFS array has become degraded. How come I didn’t know about this for four months and what am I doing to improve monitoring? What steps did I take to identify and replace the drive?

Read more...


A workaround for Rust's lack of structural subtyping

Compared to other languages, the lack of structural subtyping in Rust can be considered a hindrance. Here I show that it can be worked around so that one can end up with idiomatic solutions in Rust and in languages like Typescript that support structural subtyping.

Read more...


Reality check for Cloudflare Wasm Workers and Rust

With native Rust support announced for Cloudflare Workers, one may be eager to jump in head first. I know I wanted to. However, I tested out a few use cases and found it too limiting. Either the desired APIs weren’t available, code size was too large, or the program couldn’t run within resource constraints. I remain excited and will continue watching this space

Read more...


Simulating the EU4 map in the browser with WebGL

There are several ways one can replicate EU4’s map. The most popular methods have been to either create a bitmap image and suffer from scaling issues or derive a bitmap tracing routine to convert into vector graphics. However to create the most realstic and performant render, one should turn to the GPU. I talk about how we accomplished this in Rakaly.

Read more...


Git Rebase to Squash Commits to Most Recent Message

You’ve been working on a development branch over a couple days, testing things out and exploring solutions. You aren’t comfortable losing work, so you create superficial commits. Your final commit on this branch is a beautifully worded message. But something is wrong. The commits with superficial messages are still present. So how do you squash several commits into one and take the most recent commit message? Solution within.

Read more...


Wasm and Native Node Module Performance Comparison

Deploying code via Wasm is convenient as one can run the same code in the browser, nodejs, or via one of the several Wasm runtimes. What, if any, performance is sacrificed for this convenience? I demonstrate the tradeoffs in a real world example where I can take Rust code and benchmark the performance difference between running it as a node native module and Wasm compiled under varying configurations.

Read more...


Stumbling with WebGL Image Processing

I’ve tried to learn WebGL to reimplement an image processing pipeline that I have setup on the CPU that involves indexed colors, edge detection, pixel-art upscaling, and more but the steep learning curve combined with other life changes has caused me to temporarily abandon the effort. I thought I’d document my thoughts so that I have a point of reference when explaining to others.

Read more...


Cargo Workspace and the Feature Unification Pitfall

In Rust, workspaces help organize a project into smaller packages. The downside is if there are shared dependencies that list different features, then one will most likely see unexpected behavior when compiling just a single package. This post shows an example of when this can occur and what solutions exist.

Read more...


Leveraging Rust to Bundle Node Native Modules and Wasm into an Isomorphic NPM Package

I recently published highwayhasher as an npm package. It exposes Google’s HighwayHash to the JS world through the pure Rust reimplementation. Browsers will use the Wasm implementation while nodejs installations will use native modules built against hardware intrinsics. Both implementations expose the same API so clients don’t need to worry about which implementation is selected.

Read more...


Writing a Secure Systemd Service with Sandboxing and Dynamic Users

This post will walk one through a real world migration on how to apply the principle of minimal privilege to a systemd service. This is accomplished by extracting sensitive configuration fields into an environment file, templating the config, running the service as a dynamic user, and sandboxing the application with systemd primitives.

Read more...