Skip to content

Instantly share code, notes, and snippets.

@hjst
hjst / abbreviations.tsv
Created December 14, 2016 12:33
Tab-delimited file of abbreviations used in the OED.
abbr title
a. adjective
a. adoption of, adopted from
a (in dates) ante
abbrev. abbreviation (of)
Aberd. Aberdeen
abl. ablative
absol. absolute(ly)
abstr. abstract
Acad. academia, academy, academic(al)
@hjst
hjst / pinniped.xml
Created December 13, 2016 18:20
Example of XDXF-formatted OED data
<k>pinniped</k><br>
<b>pinniped, <abr>a.</abr> <i>and</i> <abr>n.</abr></b>
<i><abr>Zool.</abr></i><br>
<blockquote>
<blockquote>(<c c="darkslategray">ˈpɪnɪpɛd</c>)</blockquote>
</blockquote><br>
<blockquote>
<blockquote>Also <b>pinnipede</b>, <b>pinnaped</b>.</blockquote>
</blockquote><br>
<blockquote>
@hjst
hjst / dell-monitor-vga1-config.sh
Created May 10, 2016 12:09
Configure my Dell monitor (EDID not auto-recognised) via VGA manually with xrandr
#!/bin/sh
# This cvt command calculates the modeline for a 1920×1080 display @ 60Hz
modeline=`cvt 1920 1080 60 | tail -n 1 | cut -d ' ' -f 2-`
modeline_name=`echo ${modeline} | cut -d '"' -f 2`
if xrandr | grep ${modeline_name} > /dev/null; then
# Mode already exists (probably didn't reboot yet) so don't add it
echo "Monitor already configured, skipping..."
else
echo "Adding monitor config modeline from cvt output..."
@hjst
hjst / define.sh
Created June 23, 2015 04:35
Makes reading stardict dictionary searches in a terminal more bearable.
#!/bin/bash
# A wrapper script for sdcv which provides line spacing and wrapping to improve
# readability.
#
# Please note: sdcv(1) relies on dictionary files being in
# /usr/share/stardict/dic
# $(HOME)/.stardict/dic
usage() {
@hjst
hjst / fish_user_key_bindings.fish
Created April 18, 2015 06:19
This adds bash-history-esque !! and !$ bindings to fish shell (and the substitution is immediate, which is neat)
# put these in ~/.config/fish/functions/fish_user_key_bindings.fish
function bind_bang
switch (commandline -t)
case "!"
commandline -t $history[1]
commandline -f repaint
case "*"
commandline -i !
end
@hjst
hjst / gpg.rc
Last active February 29, 2024 10:02
Simple Mutt config for using GnuPG via GPGME
# 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
# * http://codesorcery.net/old/mutt/mutt-gnupg-howto
# * http://dev.mutt.org/trac/wiki/MuttGuide/UseGPG
#
# 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
@hjst
hjst / ticker.pl
Last active August 29, 2015 14:03
Time ticker with variable line length for easy visual recognition of ssh session freezes
#!/usr/bin/env perl
use strict;
use warnings;
use Sys::Hostname;
require 'sys/ioctl.ph';
main(@ARGV);
sub main {
@hjst
hjst / mtr_graph.gp
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"

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.

General

  • 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
hjst / feed-fixer.php
Created September 25, 2013 00:23
Pulls in an overstuffed RSS feed and removes any content:encoded nodes (which are usually superfluous).
<?php
$ch = curl_init("FEED URL GOES HERE");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_MAXREDIRS, 5);
curl_setopt($ch, CURLOPT_USERAGENT, "Henry's very friendly feed fetcher v1.1");
$rss_string = curl_exec($ch);
$dom = new DOMDocument();