Skip to content

Instantly share code, notes, and snippets.

Andrew Turley aturley

Block or report user

Report or block aturley

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
@aturley
aturley / producer.sh
Created Oct 4, 2011
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.
View producer.sh
cat ~/swarmpix | sed 's/^\(.*\)$/{"x":"\1"}/' | ./produce.py produce 660e96311f5ca4c39053726d2d0c81f2661a8ef3 00:23:12:55:73:b7 pic
@aturley
aturley / chrome_reload.sh
Created Feb 24, 2012
reload the active document in Chrome
View chrome_reload.sh
#!/bin/bash
echo 'tell application "Google Chrome" to tell the active tab of its first window
reload
end tell' | osascript -
@aturley
aturley / heapdump.js
Created Mar 22, 2012
This generates a heapdump.
View heapdump.js
var profiler = require('v8-profiler');
var MyClass = function(x) {
this.x = x;
};
MyClass.prototype.getX = function() {
return x;
};
@aturley
aturley / moog.5.js
Created May 23, 2012
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/).
View moog.5.js
(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 / remacsclient.sh
Created May 24, 2012
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
View remacsclient.sh
#/bin/bash
if [ -z "${EMACSCLIENT_HOST}" ]; then
echo "EMACSCLIENT_HOST is not set!"
exit 1
fi
FILENAME=$1
if [ -z "${FILENAME}" ]; then
@aturley
aturley / numberwang.py
Created Jun 2, 2012
That's Numberwang!
View numberwang.py
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 / gist:2955828
Created Jun 19, 2012
regex vs split and test in Python
View gist:2955828
aturley@silverslab [~/play]$ cat regex_vs_split.py
import time
import re
url = "http://octopart.com/api/v2/parts/match?manufacturer_name=texas+instruments&mpn=SN74LS240N&suppress_status_codes=True"
url_x = "http://octopart.com/api/v2/parts/match?manufacturer_name=texas+instruments&mpn=SN74LS240N"
url_l = "http://octopart.com/api/v2/parts/match?manufacturer_name=texas+instruments&mpn=SN74LS240N&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&junk=1&
@aturley
aturley / git-codecheck
Created Jun 20, 2012
Run pep8 and pylint on all of the new and modified Python files in a git repo.
View git-codecheck
#!/bin/bash
if [ -z "$(which pep8)" ];
then
echo "Could not find pep8"
exit 1
fi
if [ -z "$(which pylint)" ];
then
@aturley
aturley / ga_invite.rb
Created Jun 20, 2012
GA code snipped
View ga_invite.rb
if know_code = true
print "forward this email to 5 friends."
else
print "teach me how to code!"
end
@aturley
aturley / minpylint.py
Created Jun 27, 2012
Minimum python file that gets a 10/10 from pylint
You can’t perform that action at this time.