Skip to content

Instantly share code, notes, and snippets.

hjst /
Last active July 27, 2023 14:46
Generating SVG graphs from mtr reports
# Use a stacked column histogram
set style data histograms
set style histogram rowstacked
# Columns are 60% of max width (i.e. not touching, set 1.0 for touching)
set boxwidth 0.6
# Define colours - 1:yellow 2:orange 3:red
unset style line
set style line 1 linetype 1 linecolor rgb "#ffff99"
hjst / Makefile
Created June 6, 2017 18:58
Makefile for use with PlantUML diagrams
View Makefile
DIAGRAMS_SRC := $(wildcard diagrams/*.plantuml)
DIAGRAMS_PNG := $(addsuffix .png, $(basename $(DIAGRAMS_SRC)))
DIAGRAMS_SVG := $(addsuffix .svg, $(basename $(DIAGRAMS_SRC)))
# Default target first; build PNGs, probably what we want most of the time
png: plantuml.jar $(DIAGRAMS_PNG)
# SVG are nice-to-have but don't need to build by default
svg: plantuml.jar $(DIAGRAMS_SVG)
View Reading

These are books I've been recommended, books I own but haven't started yet, books I've been given but am avoiding reading etc. etc.


  • Flash Boys by Michael Lewis
  • The British Way in Counter-Insurgency, 1945-1967 by David French
  • The Library: A World History by James W. P. Campbell
  • Into That Darkness: An Examination of Conscience by Gitta Sereny
  • The Character of Physical Law by Richard Feynman
  • The Design and Implementation of the FreeBSD Operating System by Marshall Kirk McKusick, George Neville-Neil & Robert N. M. Watson
  • The Illustrated Star Wars Universe by Ralph McQuarrie & Kevin Anderson
hjst /
Created August 22, 2022 10:22
Celery tmux session
tmux has-session -t $SESSIONNAME &> /dev/null
if [ $? != 0 ]
tmux new-session -s $SESSIONNAME -n dashboard -d sudo watch -n 5 podman ps -a
tmux split-window -v -l 70% top
tmux new-window -n flood-logs journalctl -u flood.service -f
hjst / gpg.rc
Last active March 30, 2021 07:54
Simple Mutt config for using GnuPG via GPGME
View gpg.rc
# Old-school GPG config was taken from the following docs. I'm preserving these
# links here just in case I need to configure an old version of mutt & gnupg in
# the future without gpgme.
# * /usr/share/docs/mutt/gpg.rc
# *
# *
# Mutt now has solid support for GPGME, which not only makes config much
# simpler and eliminates the need to fork gpg processes & parse their output -
# it also makes working with gpg-agent, kwallet, gnome-keyring etc. a doddle
View code-s7.rkt
#lang racket
(require games/cards racket/gui racket/class racket/unit)
;; Layout width and height:
(define WIDTH 5)
(define HEIGHT 4)
(define MAX-MATCHES (/ (* WIDTH HEIGHT) 2))
;; Randomize
(random-seed (modulo (current-milliseconds) 10000))
hjst /
Created April 9, 2018 13:40
Modified Tango palette for GNOME Terminal (off-black background)
#!/usr/bin/env bash
# Base16 - Gnome Terminal color scheme install script
[[ -z "$PROFILE_NAME" ]] && PROFILE_NAME="Tango Modified"
[[ -z "$PROFILE_SLUG" ]] && PROFILE_SLUG="tango-modified"
[[ -z "$DCONF" ]] && DCONF=dconf
[[ -z "$UUIDGEN" ]] && UUIDGEN=uuidgen
dset() {
local key="$1"; shift
hjst / [Radio Streams].m3u
Created October 28, 2018 13:02
MPD playlist file for BBC radio streams at /var/lib/mpd/playlists/[Radio Streams].m3u
View [Radio Streams].m3u Hereford & Worcester Radio 1 Radio 1Xtra Radio 2 Radio 3 Radio 4 Radio 5 Live Radio 5 Live Sports Extra
hjst / gist:1326755
Last active November 21, 2018 05:22
Format a javascript Date object as a 12h am/pm time string.
View gist:1326755
function format_time(date_obj) {
// formats a javascript Date object into a 12h AM/PM time string
var hour = date_obj.getHours();
var minute = date_obj.getMinutes();
var amPM = (hour > 11) ? "pm" : "am";
if(hour > 12) {
hour -= 12;
} else if(hour == 0) {
hour = "12";
hjst / send-to-pocket.el
Created August 28, 2017 14:27
ELisp function to send the URL under the cursor to Pocket for reading later (uses msmtp)
View send-to-pocket.el
(require 'url-util)
(defun hjst/send-to-pocket ()
"Send the URL at point to Pocket for reading later"
((url (url-get-url-at-point)))
(start-process-shell-command "msmtp" "*send-to-pocket*"
(concat "printf 'Add:\n%s\n'"
"| msmtp"))