Skip to content

Instantly share code, notes, and snippets.

View paulsmith's full-sized avatar
😀
Hi, friends

Paul Smith paulsmith

😀
Hi, friends
View GitHub Profile
@paulsmith
paulsmith / README.md
Created December 20, 2012 16:16
Pizza!

Pizza, with generative log spiral pepperoni layout! Made with D3.js.

@paulsmith
paulsmith / fox-and-friends-crxns.md
Created September 21, 2012 15:28
Fox and Friends corrections

Fox and Friends corrections

  • The Bible was not a movie first.
  • Stalactites is not a childhood disease.
  • Iowa City never elected Mayor McCheese.
  • Allegra is not a religion.
  • Jeremy Lin was traded, not deported.
  • The sun and the moon do not high-five as they pass each other.
  • Vaginas don't look like that.
  • A dead person's skill does not contain their memories.
diff -u -r c_only/Makefile plugins_darwin/Makefile
--- c_only/Makefile 2012-08-19 22:53:58.000000000 -0400
+++ plugins_darwin/Makefile 2012-08-24 08:00:34.000000000 -0400
@@ -10,7 +10,7 @@
PLUGIN_DIR = plugins
-all: htmlize_main $(PLUGIN_DIR)/tt.so $(PLUGIN_DIR)/narcissist.so
+all: htmlize_main $(PLUGIN_DIR)/tt.dylib $(PLUGIN_DIR)/narcissist.dylib
@paulsmith
paulsmith / markov.go
Created August 16, 2012 13:55
Markov chain generator in Go
// Markov chain generator
// Builds chain from stdin, outputs n generated words to stdout
package main
import (
"bufio"
"flag"
"fmt"
"io"
"log"
@paulsmith
paulsmith / .bashrc
Created May 31, 2012 20:13
The least user-friendly version of `Freedom' I could come up with
# ~/.bashrc
# Freedom!
freedom () {
sed '/# FREEDOM/{n;s/^#//;}' < /etc/hosts > /tmp/hosts.$$ &&
sudo mv /tmp/hosts.$$ /etc/hosts
}
disable-freedom () {
sed '/# FREEDOM/{n;s/^[^#]/#&/;}' < /etc/hosts > /tmp/hosts.$$ &&
@paulsmith
paulsmith / mayoremanuel-tweets-20120223.txt
Created February 24, 2012 01:50
@mayoremanuel started tweeting again, around 8pm ET
# Decoded from the original reversed ASCII-encoded binary tweets
crl,carl,crl
Idremofyrwrld
thsonesalmstgone
thycameallatonce
ovrwhlmngforce
evrythngdisapprd
brthingfire
timedrgons!
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC7zYI1ymIOIRLheIC+/H8xb6Qnc4Kx5w9ofnouIHu1GIhQIlBwNpCZ8EPf85YnixDSwAeIAn/0Ve5b0nxhGERza6QgdiEQcYZSn4r8BjpZrcCUWCPdhi5tjqeHAbUNSOf/I8NLrEvY4ogwmFSYsNrDqE74JhkVSompDrQswor+btJTYavxV5cJN9BINGB5HLtynsDrchoKZ1VnCfVXfgUA9o3Bk+JnKubO4qxw9R0bp/1eJstJys3B1krr9Jn8YIZ7NzPxYUjH53h9QzbwuaYYbWuo+xHAYtsjil5STl7MbSgCMvTvnGdfxo7qiCoezqZMeW5fnJ5gZcncRoXd94TF paulsmith@formax.local
@paulsmith
paulsmith / verbatim_templatetag.py
Created October 25, 2011 19:03 — forked from ericflo/verbatim_templatetag.py
verbatim Django template tag
"""
jQuery templates use constructs like:
{{if condition}} print something{{/if}}
This, of course, completely screws up Django templates,
because Django thinks {{ and }} mean something.
Wrap {% verbatim %} and {% endverbatim %} around those
blocks of jQuery templates and this will try its best
@paulsmith
paulsmith / Rationale.md
Created July 11, 2011 03:35 — forked from leegao/Rationale.md
JIT for dummies: JIT compiling RPN in python

If you don't care about the explanation, scroll down to find the code, it's 50 some odd lines and written by someone who doesn't know any better. You have been warned.

What it does

This is a very simple proof of concept jitting RPN calculator implemented in python. Basically, it takes the source code, tokenizes it via whitespace, and asks itself one simple question: am I looking at a number or not?

First, let's talk about the underlying program flow. Pretend that you are a shoe connoisseur with a tiny desk. You may only have two individual shoes on that desk at any one time, but should you ever purchase a new one or get harassed by an unruly shoe salesman without realizing that you have the power to say no (or even maybe?), you can always sweep aside one of the two shoes on the desk (the one on the right, because you're a lefty and you feel that the left side is always superior) onto the messy floor, put the other shoe on the right hand side, and then place your newly acquired shoe in

ctrl-z
bg
touch /tmp/stdout
touch /tmp/stderr
gdb -p $!
# In GDB
p dup2(open("/tmp/stdout", 1), 1)
p dup2(open("/tmp/stderr", 1), 2)