blog Sharing notes with the internet

Dynamic Tracing on OpenBSD 7.3

A couple years ago a new device silently entered the OpenBSD source tree. The dt(4) device first appearing in OpenBSD 6.7 with very sparse information. In the releases since, it's gained quite a bit of functionality and now has tools to manipulate it properly. The documentation has gotten better over the last couple years, but there isn't much info about how to leverage it to do anything useful.

Lesser Known IRB Features

While poking around in IRB and looking at the autocompletion results, I found some functions that I didn't recognize and decided to take a look at what they do. I found some pretty interesting stuff. It looks like some of these commands have been added recently to come up to par with pry, and others have been kicking around for a while and just flying under the radar.

Testing Rails Components That Require Cache

If you're in the default testing environment your rails cache is ActiveSupport::Cache::NullStore which will always succeed but it doesn't actually store or return anything. There's an almost completely undocumented method called with_local_cache on NullStore that lets you run a block with a MemoryStore instead of a NullStore for the duration of the block. This happens because it prepends the ActiveSupport::Cache::Strategy::LocalCache class. This lets you test one or two things that require caching without enabling it on all tests and slowing everything down.

Mounting FreeNAS Shares on OpenBSD

This is something that took me a while longer to figure out than I'd like admit, and I was only able to figure it out because of a forum post. For whatever reason, I'm only able to mount the share if used the TCP option. I'm not sure if this is a me issue, an OpenBSD issue, or a FreeBSD issue, but I'm putting it out there in case anyone else runs into the same problem.

Creating a High Quality GIF with Transparency

I spent quite a bit of time trying to figure out the process to create the gif at the top of my How BSD Authentication Works blog post, so I thought I'd share it. Here's how to create a small, high quality gif with transparency using a video and an image as source material. I'd wanted to combine the image of puffy (the blowfish) and the spinning gears to represent the OpenBSD internals.

Exploring OpenType Font Features

I just bought a new font to use as my primary face in Emacs. It's a cool one called MonoLisa, I think it looks great. It has a nice looking script variant that lets you turn your italics into a cursive looking font. Unfortunately it's a fancy OpenType feature that most things, including Emacs don't support properly yet. In their FAQ they mention that you can use a tool called OpenType Feature Freezer to modify the font so that the optional glyphs become the default.

How BSD Authentication Works

History The way OpenBSD authenticates users is quite different from other Unix-like operating systems. Most other systems like AIX, Solaris, Linux, the other BSDs, and MacOS, use a framework called Pluggable Authentication Module (PAM). The two main implementations are Linux PAM and OpenPAM. PAM modules are created as dynamically loaded shared objects, which communicate using a combination of common and implementation specific interfaces (Linux-PAM and OpenPAM). It's configured using the pam.

Reverse engineering a thermal printer's WiFi setup commands

Introduction I recently purchased a thermal receipt printer off of AliExpress for a project. It features both WiFi and USB connectivity which I thought was really cool for the price. To my dismay, I realized after purchasing that the drivers and configuration application only run on Windows. This wasn't a huge deal, as thermal printers generally use the somewhat kinda standardized command set called ESC/POS. Unfortunately while many of the formatting commands are shared between printers, the commands to setup the WiFi connection don't seem to be documented anywhere, and I suspect are device-specific.

An Improved Emacs Frame Title Format

I've often found that the default Emacs frame title is a little bizarre. emacs@host Seems a little useless at describing what's going on in the actual window in my opinion, and I believe the space could be put to much better use. Perhaps it's designed for environments where X11 forwarding is common practice, or where GNU Emacs shares a system with XEmacs. Taking inspiration from both Emacs and Firefox, I came up with a frame title format that I think is much more useful.

How to get all Emacs daemon buffers from a shell script

A while back I posted a response to someone's question on reddit about how to get a list of all Emacs daemon buffers from a shell script. It was a pretty interesting problem so I thought I'd explain my answer here. The question was "Is it there a way to export the list of opened buffers to STDOUT?". In the comments I left a rather byzantine looking snippet of code that I'd managed to produce.