Welcome to my personal site. In addition to the posts you see below, feel free to explore other places where I stash content here. The now page is an occasionally-updated page about long-term plans and activities. I try to post several times a week and those updates appear on the journal page. Sometimes I post tidbits about things I learn in the til page. More info in: toolkit, readings, to learn, gallery, and colophon.

Exporting Indigo device list to CSV

Indigo device list

Sometimes I find myself needing to code something for Indigo, the macOS home automation application, and I would like to have my list of devices available. Rather than connect to my Indigo server to look up each device’s name or ID, it would be convenient to have a list at hand whenever I need it.

You can run the following script in the Indigo scripting shell, opened via Plugins > Open Scripting Shell in Indigo. The script exports device names, IDs, and descriptions to a CSV file, sorted alphabetically by folder and then by device name. Device descriptions appear in the Notes column. Devices outside a folder appear under (no folder).

Replace YOUR_USER_NAME in output_path with your macOS account’s short username. The file is written to the Desktop on the Mac running the scripting shell; you can change the path to another existing, writable folder if you prefer. Running the script again overwrites the previous export.

import csv

folders = {}

for folder in indigo.devices.folders:
    folders[folder.id] = folder.name

folders[0] = "(no folder)"  # unfiled devices

output_path = "/Users/YOUR_USER_NAME/Desktop/indigo_devices_by_folder.csv"

rows = []
for dev in indigo.devices:
    folder_name = folders.get(dev.folderId, f"Unknown folder {dev.folderId}")
    rows.append((folder_name, dev.name, dev.id, dev.description))

rows.sort(key=lambda r: (r[0].lower(), r[1].lower()))

with open(output_path, "w", newline="") as f:
    writer = csv.writer(f)
    writer.writerow(["Folder", "Device", "Device ID", "Notes"])
    writer.writerows(rows)

indigo.server.log(f"Wrote {len(rows)} devices to {output_path}")

The resulting CSV gives me a searchable reference that I can keep open in a spreadsheet while writing Indigo scripts. It is a snapshot of the device list, so I just rerun the export after adding, renaming, or moving devices to keep it current.

If you have questions or suggestions, please get in touch through my contact page.

fancy_quote shortcode for Hugo for fancier quotes

The fancy quote shortcode displaying highlighted passages from James C. Scott

I often include quotations in blog posts, but a plain Markdown blockquote does not give much control over the presentation and attribution. I wanted a reusable component that would keep the quote, author, source and publication year visually consistent without requiring me to reproduce the same HTML in every post.

The result is a fancy_quote shortcode, which adds large typographic quotation marks, centres the source and author beneath the quotation, and allows one or more passages to be highlighted with a simple ==highlighted text== notation.

Features

  • The quotation can be written between the shortcode’s opening and closing tags or supplied through a text parameter.
  • author, source and year are optional named parameters.
  • Any number of ranges can be highlighted.
  • Highlighted passages use the semantic HTML <mark> element rather than a purely decorative <span>.
  • Highlights can wrap across lines without losing their padding.
  • Existing quotations without highlights continue to render normally.
  • The appearance is controlled entirely by CSS and can be adapted to any theme.

Hugo version

The shortcode requires Hugo 0.16 or newer. The limiting feature is replaceRE, which converts the highlight delimiters into <mark> elements and was added in the Hugo 0.16 release. The other pieces use the standard shortcode .Get and .Inner methods and the long-established safeHTML alias for safe.HTML.

I developed and tested this version with Hugo 0.165.0. It does not require Hugo Extended, JavaScript, or any external library.

The shortcode

Create layouts/shortcodes/fancy_quote.html in the root of the Hugo project:

{{ $year := .Get "year" }}
{{ $text := .Get "text" | default .Inner }}
{{ $author := .Get "author" }}
{{ $source := .Get "source" }}
{{ $text = replaceRE `==([^=]+?)==` `<mark class="quote-highlight">$1</mark>` $text }}

<div class="fancy-quote">
  <p class="quote-text">{{ $text | safeHTML }}</p>

  {{ if or $source $year }}
  <div class="quote-meta">
    {{ if $source }}
    <span class="quote-source">{{ $source }}</span>
    {{ end }}
    {{ if $year }}
    <span class="quote-year">({{ $year }})</span>
    {{ end }}
  </div>
  {{ end }}

  {{ if $author }}
  <div class="quote-author">{{ $author }}</div>
  {{ end }}
</div>

The regular expression looks for text enclosed by pairs of equals signs. Each match is replaced by a <mark class="quote-highlight"> element. Piping the result through safeHTML prevents Hugo from escaping the generated element.

safeHTML should be used only with content that I control. If quotation text comes from an untrusted visitor, CMS user, or external feed, it should be sanitised rather than passed through this shortcode unchanged.

The CSS

Here is the complete stylesheet:

.fancy-quote {
  font-family: "Georgia", "Times New Roman", serif;
  line-height: 1.6;
  max-width: 100%;
}

.quote-text {
  position: relative;
  text-align: justify;
  margin-bottom: 1rem;
  padding: 0.2rem 2.4rem 0.35rem;
  font-size: 1.05rem;
}

.quote-text::before,
.quote-text::after {
  position: absolute;
  color: #999;
  font-size: 2.75rem;
  font-weight: bold;
  line-height: 1;
}

.quote-text::before {
  content: "“";
  top: -0.15rem;
  left: 0.8rem;
}

.quote-text::after {
  content: "”";
  right: 0;
  bottom: -0.8rem;
}

.quote-highlight {
  color: inherit;
  background-color: #fff0a6;
  padding: 0.05em 0.12em;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

.quote-meta {
  display: flex;
  justify-content: center;
  align-items: baseline;
  gap: 0.25em;
  text-align: center;
  line-height: 1.3;
}

.quote-year {
  font-style: normal;
  font-size: 1.25rem;
  white-space: nowrap;
}

.quote-source {
  font-style: italic;
  font-size: 1.25rem;
}

.quote-author {
  display: block;
  text-align: center;
  margin-top: 0.25rem;
  margin-left: auto;
  margin-right: auto;
  font-size: 1.1rem;
}

The stylesheet can be saved as static/css/fancy-quote.css and included in the site’s <head>:

<link rel="stylesheet" href="/css/fancy-quote.css">

Sites already using Hugo Pipes can instead keep the file under assets/css and add it to their existing CSS bundle.

Using the shortcode

A complete quotation looks like this:

{{< fancy_quote
  author="James C. Scott"
  source="Two Cheers for Anarchism"
  year="2012" >}}
The point is simply that ==huge disparities in wealth, property, and status make a mockery of freedom.== A second range can be ==highlighted independently==.
{{< /fancy_quote >}}

The highlight markers are optional. Without them, the entire quotation is displayed in the same style:

{{< fancy_quote author="Ursula K. Le Guin" >}}
The creative adult is the child who survived.
{{< /fancy_quote >}}

For a short quotation, the text can be supplied as a parameter and the closing tag omitted:

{{< fancy_quote
  text="The creative adult is the child who survived."
  author="Ursula K. Le Guin"
>}}

Optional adaptations

The shortcode parameters are independent. A quote can have an author but no source, a source and year but no author, or no attribution at all. The highlighting feature is also entirely optional.

The CSS is deliberately uncomplicated. The highlight colour can be changed through background-color, and the font, quotation-mark size, spacing and attribution alignment can all be altered without touching the shortcode. A dark theme might override the highlight colour inside its existing dark-mode media query:

@media (prefers-color-scheme: dark) {
  .quote-highlight {
    background-color: #665500;
  }
}

The shortcode intentionally treats its inner text as text with optional highlight markers, rather than running it through the Markdown renderer. That keeps its output predictable. If links, emphasis or other Markdown inside quotations become necessary, the rendering step could be extended with Hugo’s Page.RenderString method, with suitable care around generated and untrusted HTML.

For my purposes, this provides a small, readable content syntax while keeping all of the presentational machinery in one reusable place. If you have any difficulties, suggestions for improvements, please contact me via my contact page

A better user experience when a Firefox extension loads a new tab custom page

N.B. This workaround is for macOS, using Keyboard Maestro. I have not tried equivalents elsewhere. On Windows, AutoHotkey can bind a hotkey, send Ctrl+T, select and clear the address bar, then Escape. On Linux, AutoKey is the usual analogue; under Wayland you may need something like ydotool. The Firefox new-tab focus behaviour itself is not macOS-specific.

In the previous post I described Slinky, a self-hosted start page, and mentioned that I use the New Tab Override extension so Firefox opens it on every new tab. That works, but the default behaviour is a little ugly.

Slinky: A self-hosted start page

A colorful, retro-style graphic illustration of a circular slinky coil featuring red, yellow, and teal segments on a cream background.

One of the browser conveniences that I appreciate is ready access to commonly used links, presented in a neat and categorized way. Every time I create a new tab, I just want to see those links. There are of course many browser extensions that present a page when the user opens a new tab. Mozilla has its own default ad-ridden page on Firefox. For my part, I don’t want news, weather, “trending stories,” or ads. I just want my curated links. That’s why I created Slinky.

Donald Trump’s pseudo-principles of adult behaviour

I’ll admit to being a pushover for lists of pithy advice for living. One that I return to frequently are those compiled by John Perry Barlow.

In 1977, John Perry Barlow wrote a list of twenty-five principles of adult behaviour.

Reading through these principles in the midst of the self-serving, self-enriching careless chaos that Donald Trump has wreaked on the world, I decided to write a parallel set of principles as Trump himself might do. I give you - by way of contrast - Donald Trump’s Principles of Adult Behaviour.

Updated: ARINC 424 parser & explainer

Yesterday I posted about a small utility that parses and explains ARINC 424 records. I have updated it.

For each field, the tool now cites the specific tables in the ARINC 424 specification that describe that field. The field-content explanations are also more detailed, so you can spend less time flipping between the parsed output and the printed standard. Here is an example for an Airport SID/STAR/Approach primary record:

This is still a work in progress. Not all record types are supported yet; I am filling those in as I need them.

A small utility to parse and explain ARINC 424 records

N.B. An enhanced version is now available, with specification table references and more detailed field explanations. 2026-08-03.

The ARINC 424 specification is the universally accepted standard for encoding aeronautical navigation data. Databases that follow it store that data in fixed-length, 132-character records. I created a utility that parses a single ARINC 424 record and prints the fields along with column numbers and plain-language explanations. The Python arinc424 module does the heavy lifting; I provide a wrapper around it, plus the logic that maps fields to the column numbers used in the official specification.

Violentmonkey script to block politicalwire.com troll “Reasonable”

The news site politicalwire.com is a well-regarded site that covers U.S. political news. Like other similar sites, it features a comment section; and like many comment sections on political sites, it attracts personality-disordered internet trolls. One such troll on politicalwire.com goes by the handle Reasonable. This commenter is a troll in every sense of the word, engaging users with deliberately provocative nonsense.

This user has been banned on multiple occasions and escapes both bans and blocks by repeatedly creating new Disqus accounts using the same name and avatar. Since it cannot be blocked at the account/server level, I’ve written a Violentmonkey script to expunge his comments at the level of the browser. To use the script, you will need to use the Violentmonkey (or related) extension and create a new script with the following code. It works perfectly in Firefox.

Lua script for X-Plane 12 fuel management

As a Challenger 650 captain, I fly routes between North America and Europe with some frequency. Dealing with the interconversion of imperial and metric units is a challenge; so I create a Lua script that runs in the X-Plane FlyWithLua plugin.

Once installed, the script allows you to enter the required trip fuel, current onboard fuel, fuel density and metric vs imperial units and outputs the desired fuel uplift. You can also select to take 10%, 15%, 20% extra fuel. This is a feature that I added because SimBrief seems to underestimate my fuel burn.

Keyboard Maestro macro to toggle macOS calendar visibility

As a pianist, I use Calendar on macOS and iOS to plan each day’s practice. On heavy days I may have over a dozen practice blocks, so the calendar gets crowded quickly and it becomes easy to miss non-practice events. A calendar that looks like this makes the problem obvious:

What I really wanted was a quick way to toggle a group of calendars at once on macOS. In my case, that group is the set of works I am currently practicing (for example, specific Brahms and Schubert calendars). Your grouping might be completely different, depending on your purpose, but the same approach applies.