Skip to content

Instantly share code, notes, and snippets.

View philchristensen's full-sized avatar

Phil Christensen philchristensen

View GitHub Profile
@philchristensen
philchristensen / anti-spam-autoresponse.txt
Created August 7, 2011 14:59
Anti-Spam Auto-Response
Your post advocates a
( ) technical ( ) legislative (X) market-based (X) vigilante ( ) form-based
approach to fighting spam. Your idea will not work. Here is why it won't work. (One or more of the following may apply to your particular idea, and it may have other flaws which used to vary from state to state before a bad federal law was passed.)
( ) Spammers can easily use it to harvest email addresses
( ) Mailing lists and other legitimate email uses would be affected
( ) No one will be able to find the guy or collect the money
( ) It is defenseless against brute force attacks
@philchristensen
philchristensen / bebop-cola
Created July 26, 2011 18:47
Bebop Cola flavors (unix machine names?)
Root Bird
Gilberto Grape
Artie Shawberry
Kiwi Holliday
Peachmo
John Cola-trane
Don Wild Cherry
Vince Guavaldi
Dave Bruberry
Cab Colaway
@philchristensen
philchristensen / twisted_django.py
Created July 10, 2011 20:17
bad idea for calling Twisted code from Django view
user_id = 2
def error(request, failure):
return 'error'
def parse(request):
def _response(r):
request.response = r
def _error(f):
r = error(request, f)
@philchristensen
philchristensen / jargon-zork-unix-names.txt
Last active September 25, 2015 11:08
jargon- and zork-related unix names
foo
bar
baz
qux
quux
frobnitz
frob
frotz
frobnule
@philchristensen
philchristensen / virtualenv-svn-git-prompt.bash
Created April 7, 2011 16:33
some useful functions and prompt configs for virtualenv-based development
function parse_svn_branch {
if [ -d '.svn' ]; then
ref=$(svn info | grep URL | awk -F/ '{print $NF}' 2> /dev/null) || return
cur=$(pwd | awk -F/ '{print $NF}' 2> /dev/null) || return
if [ $ref != $cur ]; then
echo -ne "\xE2\x9C\xB6${ref}"
fi
fi
}
@philchristensen
philchristensen / svn-prompt.bash
Created February 16, 2011 15:29
add current svn branch to shell prompt
function parse_svn_branch {
if [ -d '.svn' ]; then
ref=$(svn info | grep URL | awk -F/ '{print $NF}' 2> /dev/null) || return
cur=$(pwd | awk -F/ '{print $NF}' 2> /dev/null) || return
if [ $ref != $cur ]; then
echo "#$ref"
fi
fi
}
@philchristensen
philchristensen / karma.py
Created February 1, 2011 16:37
sketch of some karma calculation functions
import math
def get_confidence_interval(p, n, alpha=0.5):
assert p >= 0 and p <= 1
assert alpha > 0 and alpha < 1
z = pnorm(1-alpha/2)
return (p + (math.pow(z, 2)/(2*n)) - z * math.sqrt((p * (1 - p) + (math.pow(z, 2)/(4*n)))/n))
@philchristensen
philchristensen / zappa-unix-names.md
Last active March 2, 2016 19:18
zappa-related unixlike names
stinkfoot
muffinman
grandwazoo
unclemeat
zombywoof
zootallures
lumpygravy
mudshark
jazzdischarge

partyhat

@philchristensen
philchristensen / git-prompt.bash
Created December 19, 2010 20:20
add current git branch to shell prompt
function parse_git_branch {
ref=$(git symbolic-ref HEAD 2> /dev/null) || return
echo "#"${ref#refs/heads/}
}
export PS1="\u@\h:\w\[\e[31;40m\]\$(parse_git_branch)\[\e[0m\] \$ "