Instantly share code, notes, and snippets.

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.
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 !)
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

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
View boulderdash.rb
# 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.
#
View scsi-rescan.md

Rescanning a Linux SCSI device after it is changed on a VM Host

Sometimes when you change the logical drive of a VM from the Host, the device size is not reflected in the Guest. So attempts to use the extra space with fdisk or the NVM tools will not "see" the extra disc.

This is because the Linux kernel doesn't notice it, because it's not looking. Linux usually only scans this at boot time. But you probably can't reboot a server if it's live, so what do you do?

To tell Linux to have another look now, you just need to poke it:

echo 1 > /sys/bus/scsi/devices/1:0:0:0/rescan
View doctorwho.rb
# Dr. Who
# Transcribed by ear from different T.V. introductions, probably not
# entirely correct either; so it's my own arrangement.
#
# I wanted to hear if I could get some of the effects in too
#
# Mike Lockhart 2018-08-10
use_bpm 130
View ugrade-requests.html
<!doctype html>
<html>
<head>
<title>whatever</title>
<meta charset="utf-8">
<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">
<!-- rest of header:
<link rel="stylesheet" href="something.css">
<script src="somescript.js"/>
-->
View toggle-comment-sed.sh
sed -i '/pattern/s/^/#/g' file #to comment out
sed -i '/pattern/s/^#//g' file #to uncomment