Skip to content

Instantly share code, notes, and snippets.


Michael Lockhart sinewalker

View GitHub Profile
sinewalker /
Last active Jun 7, 2021
How to import pub/sec PGP keys from keybase to your local GPG keyring.

Import Keybase PGP to GPG

After installing the keybase command-line tool onto a new / fresh computer, you may want to import your PGP key to the local keyring so that you may use the keys with GPG.

Import your PUBLIC PGP key:

keybase pgp export|gpg --import -
sinewalker /
Created Mar 9, 2018
Toggle compositing in KDE

qdbus org.kde.KWin /Compositor

Gives you true or false depending on whether it is currently enabled or not

You can enable compositing by calling

qdbus org.kde.KWin /Compositor org.kde.kwin.Compositing.resume

and disable by calling

sinewalker /
Last active May 18, 2021
Checking a bash script's requirements are met by the host OS
# required utilities
sinewalker /
Last active May 14, 2021
ssh-pass: add an SSH key to your agent with passphrase from password store, no clipboard
#Add specified SSH keys to the SSH Agent, using SSH_ASKPASS to retrieve
#each key's passphrase from the Unix password store (pass).
#This relies upon the keys having the same names in both your key directory
#and your password store.
if [[ -z ${1} ]]; then
echo "$(basename ${0}): no SSH key specified" 1>&2
exit 1;
sinewalker /
Last active Mar 25, 2021
How to use Sonic Pi Snippets

Sonic Pi has an experimental, undocumented feature to support snippets, which autoexpand with the TAB key.

Here's the issue:

Specifically, Sam's comment:

... [T]o play with it now (with the caveat that it all may drastically change) you just need to create a file with the contents of your snippet with an .sps extension in a directory somewhere on your machine. You might want to create a snippets directory for your own personal snippets. The name of the file doesn't matter. You then load all the snippets in a given directory with:


View MJL-SystemSounds-0.reg
Windows Registry Editor Version 5.00
@="C:\\Library\\SystemSounds\\Default Beep.wav"
@="C:\\Library\\SystemSounds\\Program Error.wav"
sinewalker /
Created Apr 26, 2017
use eyed3 to set ID3 tags on MP3 files
# I used this code within an IPython session to clean up all the missing ID3 tags from my MP3 collection.
# They had gone missing years ago when I down-sampled them to fit on an old phone, and then lost the originals.
# Fortunately I named the files themselves with the basic details (artist, date, title and so on) so it was possible to
# recover the tags... It sat on my to-do list for *years* but now I finally did it.
# I used the Python library "EyeD3" (get it?):
# This requires Python 2.7, which has some interesting quirks for Unicode, a bit of a pain since I had named my MP3s
# with utf8 characters. What I've come up with *mostly* works. When it doesn't I had to resort to manually editing (using
# Clementine).
sinewalker /
Last active Nov 14, 2020
Firefox Reverse/"Natural" scroll wheel direction

Open about:config and set mousewheel.default.delta_multiplier_y to negative, e.g. -100 if the current value is (the default) 100

This should only be necessary on platforms where Firefox isn't honouring the global setting. For instance on a Mac or Windows it's not necessary if you've set the scrolling direction to reverse globally, but on Linux, Firefox doesn't honour KDE's setting. I haven't tested GNOME ….

The default setting is fine for an actual mouse-wheel, but when using a touchpad to two-finger-scroll (or a trackball), it's more Natural for the page to scroll down when you swipe your fingers up: it seems more like how a paper page will shift.

sinewalker / sticks.bas
Last active May 25, 2020
Pick-up Sticks: early 8-bit graphics hack (BASIC)
View sticks.bas
5 REM This is for Amstrad CPC Locomotive BASIC
10 CLS
20 WHILE 1>0
40 MOVE 640*RND,400*RND
50 DRAW 640*RND,400*RND
View bollybyte.rb
live_loop :india do
use_random_seed 4000
16.times do
sample "tabla_", choose
sleep 0.125
sample "tabla_", choose
sleep 0.125
2.times do
sample "tabla_", choose