Skip to content

Instantly share code, notes, and snippets.

Avatar

Michael Lockhart sinewalker

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

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
sinewalker / compositing.md
Created Mar 9, 2018
Toggle compositing in KDE
View compositing.md

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

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
sinewalker / check-required-utilities.sh
Last active May 18, 2021
Checking a bash script's requirements are met by the host OS
View check-required-utilities.sh
# required utilities
required=(
grep
awk
curl
jq
)
missing=()
@sinewalker
sinewalker / ssh-pass.sh
Last active May 14, 2021
ssh-pass: add an SSH key to your agent with passphrase from password store, no clipboard
View ssh-pass.sh
#!/bin/bash
#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
sinewalker / sonic-pi-snippets.md
Last active Mar 25, 2021
How to use Sonic Pi Snippets
View sonic-pi-snippets.md

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

Here's the issue: https://github.com/sonic-pi-net/sonic-pi/issues/587

Specifically, Sam's comment: https://github.com/sonic-pi-net/sonic-pi/issues/587#issuecomment-131945899

... [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:

load_snippets("/path/to/snippets/dir")

View MJL-SystemSounds-0.reg
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\AppEvents\Schemes\Apps\.Default\.Default\MJL-S0]
@="C:\\Library\\SystemSounds\\Default Beep.wav"
[HKEY_CURRENT_USER\AppEvents\Schemes\Apps\.Default\AppGPFault]
[HKEY_CURRENT_USER\AppEvents\Schemes\Apps\.Default\AppGPFault\MJL-S0]
@="C:\\Library\\SystemSounds\\Program Error.wav"
@sinewalker
sinewalker / fix-id3s.py
Created Apr 26, 2017
use eyed3 to set ID3 tags on MP3 files
View fix-id3s.py
# 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?): https://pypi.python.org/pypi/eyeD3
# 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
sinewalker / firefox-reverse-wheel.md
Last active Nov 14, 2020
Firefox Reverse/"Natural" scroll wheel direction
View firefox-reverse-wheel.md

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
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
30 GRAPHICS PEN 15*RND
40 MOVE 640*RND,400*RND
50 DRAW 640*RND,400*RND
60 WEND
View bollybyte.rb
live_loop :india do
use_random_seed 4000
16.times do
sample "tabla_", choose
sleep 0.125
end
sample "tabla_", choose
sleep 0.125
2.times do
sample "tabla_", choose