Skip to content

Instantly share code, notes, and snippets.

@aturley
aturley / numberwang.py
Created June 2, 2012 01:09
That's Numberwang!
import random, sys, os
name = [None, None]
sys.stdout.write("enter player 1: ")
sys.stdout.flush()
name[0] = sys.stdin.readline().strip()
sys.stdout.write("enter player 2: ")
sys.stdout.flush()
@aturley
aturley / remacsclient.sh
Created May 24, 2012 17:56
emacsclient-like scripts for open files in remotely running emacs instances. Run remacsserver.sh on the machine running emacs (don't forget to start-server in emacs) and use remacsclient.sh FILENAME to open files. You need to have tramp set up in emacs, a
#/bin/bash
if [ -z "${EMACSCLIENT_HOST}" ]; then
echo "EMACSCLIENT_HOST is not set!"
exit 1
fi
FILENAME=$1
if [ -z "${FILENAME}" ]; then
@aturley
aturley / moog.5.js
Created May 23, 2012 15:42
Prettified version of the main javascript source (http://www.google.com/logos/2012/moog.5.js) for the Moog Google Doodle (thanks to http://jsbeautifier.org/).
(function () {
try {
var g = void 0,
i = !0,
j = null,
k = !1,
l, o = this,
aa = function () {},
ba = function (a) {
var b = typeof a;
@aturley
aturley / heapdump.js
Created March 22, 2012 17:32
This generates a heapdump.
var profiler = require('v8-profiler');
var MyClass = function(x) {
this.x = x;
};
MyClass.prototype.getX = function() {
return x;
};
@aturley
aturley / chrome_reload.sh
Created February 24, 2012 16:22
reload the active document in Chrome
#!/bin/bash
echo 'tell application "Google Chrome" to tell the active tab of its first window
reload
end tell' | osascript -
@aturley
aturley / producer.sh
Created October 4, 2011 12:16
The Processing sketch takes pictures, encodes them as strings, and writes them to a fifo. The shell script reads from the fifo, sticks the string into a json object, and publishes to the swarm. The HTML file gets data from swarm and draws the picture.
cat ~/swarmpix | sed 's/^\(.*\)$/{"x":"\1"}/' | ./produce.py produce 660e96311f5ca4c39053726d2d0c81f2661a8ef3 00:23:12:55:73:b7 pic