Skip to content

Instantly share code, notes, and snippets.

James Halliday substack

Block or report user

Report or block substack

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
View callaback.js
var baudio = require('baudio');
var bpm = 120;
var bps = bpm / 60;
var melody = [
4, 4, null, 2, null, 5, null, 2, null, 0, 0, null, 0, 0, null, null,
2, 2, null, null, null, null
].map(function (x) { return x === null ? 0 : Math.pow(2, x / 12) });
var modulo = [ 8, 5, 16, 7, 1/2, 32, 4 ];
@substack
substack / npms.txt
Created Feb 26, 2014
non-package manager
View npms.txt
nitpick paroli meacock
nilghaus phaius mechanist's
nobis phosphamidon misframes
nonoxidation pollenigerous mistakenness
nematodirus ptotic mesoplankton
noncurdling pokerlike mosasaurs
noncondescendingness ptyxes misogynists
nonintersectional proficients microcopy
nonpermissive prostie melianthaceous
neoarsphenamine's prechallenged mulch's
@substack
substack / build.sh
Created Feb 28, 2014
arduino compile script
View build.sh
#!/bin/bash
ARDUINO_ROOT=/usr/share/arduino
ARDUINO_PATH=$ARDUINO_ROOT/hardware/arduino/cores/arduino
VARIANTS_PATH=$ARDUINO_ROOT/hardware/arduino/variants/standard
# stats for the uno from http://arduino.cc/en/uploads/Main/boards.txt
MCU=atmega328p
F_CPU=16000000
@substack
substack / door.sh
Created Feb 28, 2014
sudoroom door script
View door.sh
#!/bin/bash
if test -z "$1"; then
echo "usage: $0 {open|close}"
else
curl -iX POST -d "secret=SECRETPASSWORD&button=${1}_in" https://door.sudoroom.org/dooeet
fi
View new.cpp
class F {};
int main (int argc, char **argv) {
F *f = new F;
return 0;
}
@substack
substack / split.js
Created Mar 22, 2014
certificate splitter
View split.js
module.exports = split;
function split (src) {
var res = [];
var parts = src.split(/(-----END CERTIFICATE-----(?:\n|$))/);
for (var i = 0; i < parts.length-1; i+= 2) {
res.push(parts[i] + parts[i+1]);
}
return res
}
@substack
substack / img.js
Created Mar 27, 2014
brfs inline image example
View img.js
var fs = require('fs');
var src = fs.readFileSync(__dirname + '/vaporwave.jpg', { encoding: 'base64' });
var img = document.createElement('img');
img.setAttribute('src', 'data:image/jpg;base64,' + src);
document.body.appendChild(img);
@substack
substack / mac_startup.sh
Last active Aug 29, 2015
warped mac startup sound
View mac_startup.sh
#!/bin/bash
ytdl 'https://www.youtube.com/watch?v=i9qOJqNjalE'
ffmpeg -i *.mp4 -vn mac_startup.wav
sox mac_startup.wav mac_warp.mp3 chorus 0.6 0.9 25 0.9 1 8 -s \
echos 0.8 0.7 40 0.25 63 0.3 phaser 1 0.7 3 0.7 0.5 -t
play mac_startup.wav
View actionwave.js
var melody = [ 5, 7, 3, 5, 1, 7, 2 ];
var side = [ 90.125, 180.25 ];
var pace = [ 4, 12, 8, 4 ];
var sn = snare();
return function (t) {
var m = melody[Math.floor(t*2) % melody.length];
var p = pace[Math.floor(t/8) % pace.length];
var s = side[Math.floor(t*p) % side.length];
var x = Math.pow(2, Math.floor(t%2)*m/12);
@substack
substack / workpocalypse.js
Created Apr 6, 2014
happy bunny jack-booted thug alien javascript computer music
View workpocalypse.js
var work = [ 100, 400, 200, 300 ];
var melody = [ 1, 2, 5, 1, 0, -2, 6 ];
var plucks = [ 1, 5/2, -2, 1/9, 1/3 ];
var times = [ 1, 1024, 64, 1, 1, 8064, 16, 256, 1, 32, 1024 ];
return function (t) {
var w = work[Math.floor(t*4)%work.length];
var tm = times[Math.floor(t/8)%times.length];
var m = melody[Math.floor(t*tm)%melody.length];
var x = Math.pow(2,m/12);
You can’t perform that action at this time.