Skip to content

Instantly share code, notes, and snippets.

Michael Lockhart sinewalker

Block or report user

Report or block sinewalker

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@sinewalker
sinewalker / ssh-pass.sh
Last active Jun 16, 2019
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 / ssh-add-pass.md
Last active Jan 23, 2019
Get passphrase for an SSH key from password store, securely
View ssh-add-pass.md

This should be a blog post, and I'll make it one when I have more than 5 mins to spare. For instance these examples are hard-coded for my github SSH key, rather than parameterised.

Based on this SO question

Rather than use pass -c to copy an SSH key passphrase to your system clipboard and then paste it at the ssh-askpass prompt (which is not very secure: any program can read the clipboard), you can use an SSH_ASKPASS script to retrieve the passphrase from password store and give it to ssh-add.

  1. Make a script that retrieves the passphrase from pass (which in turn will prompt for a master passphrase if needed, via GnuPG PinEntry):
#!/bin/bash
@sinewalker
sinewalker / crashb.rb
Created Dec 1, 2018
crashing with the kids :)
View crashb.rb
use_bpm 150
use_synth :tech_saws
live_loop :crash do
2.times do
play_pattern_timed [:C4,:r,:C4,:F4, :G4,:C5,:r,:Bb4], 0.5
play_pattern_timed [:r,:G4,:r,:G4, :Gb4,:G4,:Gb4,:G4], 0.5
end
play_pattern_timed [:F4,:F4, :r], 1
play_pattern_timed [:r,:F4], 0.5
View tainted_who.rb
#I wanted to hear if Tainted Love and Dr. Who go together... ;-)
use_bpm 120
live_loop :metro do
tick
cue :beet
sleep 1
end
live_loop :bass, sync_bpm: :beet do
##| stop
@sinewalker
sinewalker / commandline-tools.sh
Created Nov 22, 2018
Re-install XCode command-line tools for Brew on macOS Mojave
View commandline-tools.sh
/usr/bin/ruby -e "ARGV=['--force-curl'] $(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
View synpad-loops-0.rb
#Heard these chords somewhere on the way to work this morning, no idea what the tune was, sorry
# Anyway they gave me a bit of inspiration as I finished walking to the office, and I hacked this out
# in about 20 mins.
#
# play with the ixi/slicer fx phases, and the ixi res, and start up the bass + simple drums
#
# I found that if you wait/sleep at the end of the drum/bass loops, you'll miss the cue for the start
# of the bar, so that's why the final waits are commented out. Also if you sync at the start, it'll
# again miss the cue and wait a whole bar. Not sure best ways to resolve this -- just comment where
# they sync, I suppose.
@sinewalker
sinewalker / knight-rider.rb
Created Nov 6, 2018
Knight Rider - Sonic Pi
View knight-rider.rb
#Knight Rider Main Theme
# by Stu Phillips, 1981
# Sonic Pi transcript, Mike Lockhart, 2018
# (missing Rtyhm Section: Buffer Capacity reached)
#motifs
define :kr0 do |n|
play_pattern_timed [n, :r, n+1, n, n, n+1, n, n], 0.25
View gist:1c8dcadfdf3df3f56a8c96bcd8b953ae
# Chord Inversions
# Coded by Adrian Cheater
# (in a single tweet)
# https://twitter.com/wpgFactoid/status/666692596605976576
# Mike Lockhart made a small mod to loop through all of Sonic Pi's built-in scales
# (73 of them for SP v3.1 !)
@sinewalker
sinewalker / send-email.md
Last active Oct 29, 2018
Sending email from Linux command line (postfix or netcat)
View send-email.md
  • 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 / windows-password.md
Last active Sep 17, 2018
Disable password expiry in Windows 7
View windows-password.md
  1. Start menu > Run
  2. wmic
  3. right-click; Run as Administrator
  4. UserAccount where PasswordExpires=TRUE set PasswordExpires=FALSE
  5. press Y for each account confirmation
You can’t perform that action at this time.