Skip to content

Instantly share code, notes, and snippets.

View sinewalker's full-sized avatar

Michael Lockhart sinewalker

View GitHub Profile
@sinewalker
sinewalker / minecraft-coords.md
Created May 18, 2019 22:54
Minecraft Pi Edition Python Coords vs Minecraft Debugging Coords

To fix your Minecraft world so that the coordinates displayed on the F3 debugging screen match what the MCPI API tells you with player.getPos() or player.getTilePos(), issue this Command in the game (requires Multiplayer, or a World generated with Cheat Codes enabled):

/setworldspawn 0 0 0

(to do this, press T or / and then type /setw followed by the TAB key, and then 0 0 0. For some reason you can't type this command out in full on the Talk window.)


@sinewalker
sinewalker / ssh-pass.sh
Last active February 9, 2024 22:10
ssh-pass: add an SSH key to your agent with passphrase from password store, no clipboard
#!/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 / keybase.md
Last active December 13, 2023 10:42
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
sinewalker / firefox-reverse-wheel.md
Last active November 8, 2023 08:47
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
sinewalker / boulderdash.rb
Last active July 14, 2023 16:48
Boulder Dash Theme
# Boulder Dash for ATARI 2600, by Peter Liepa, 1984
# A Live Loop to algorave to.
#
# Original music (Youtube, Commodore 64 version): https://www.youtube.com/watch?v=14CAO72_pJw
# A pretty accurate transcription: https://musescore.com/user/3769276/scores/1076731 (I can't hear any errors)
#
# Interesting note: Boulder Dash was originally written for the ATARI 2600 video game console, which had a TIA sound chip
# with two oscillators to generate tones (max polyphony was 2). So on both the Youtube recording (which is of a C64 port)
# and the MIDI score transcription, only two notes are ever played at once.
#
@sinewalker
sinewalker / send-email.md
Last active April 14, 2023 10:06
Sending email from Linux command line (postfix or netcat)
  • Send a blank test message with a subject to an email address:

    mail -s "Subject" user@example.com < /dev/null

    (you can substitute /dev/null with a file, or pipe, to populate the body. It must end with a period on a line by itself.)

  • Send a blank email with an attachment:

    mail -a somefile -s "Subject" user@example.com < /dev/null

@sinewalker
sinewalker / win-timezone-information.reg
Last active January 27, 2023 09:09
Make Windows 7+ use UTC Real-time-clock
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation]
"RealTimeIsUniversal"=dword:00000001
@sinewalker
sinewalker / unixdates.md
Last active January 27, 2023 04:40
Unix Epoch conversion

Convert a Unix timestamp into human-readable format:

  • GNU: date -date='@1501768813'
  • BSD: date -r 1501768813

Convert the other way

  • Current date/time as Unix timestamp: date +%s

  • A specific date/time (assumes current timezone):

@sinewalker
sinewalker / MJL-SystemSounds-0.reg
Created January 15, 2012 03:06
Windows Sound Events
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 / _gitmux_filter.sh
Last active September 1, 2022 07:36
gitmux filter to replace 'origin' with a symbol for the git host.
#!/usr/bin/env bash
# Wrapper for gitmux to change some strings in ways that it doesn't
# allow for. Also replace 'origin' with a symbol for the git host.
WORKING_COPY=${1}
[[ -d ${WORKING_COPY} ]] || exit 1
pushd $WORKING_COPY &> /dev/null
STATUS=$(git status) &> /dev/null || exit 2
URL=$(git config --get remote.origin.url) &> /dev/null
if [[ "${STATUS}" =~ "No commits yet" ]] ; then