Public Gists by brendano

Gravatar
Thu Apr 23 00:09:37 -0700 2009
1
2
3
# from anyall.org/util.py
 
######### Make UTF-8 hurt less
Gravatar
Tue Mar 24 09:18:51 -0700 2009
1
2
3
# hacked up twitter.rb for TwitterAdium
# to display first msg that's *not* and @-reply
# TwitterAdium is at http://www.adiumxtras.com/index.php?a=xtras&xtra_id=3484
gist: 67656 map and aggregate for shell
Gravatar
Fri Feb 20 11:44:58 -0800 2009
1
2
3
#!/usr/bin/env ruby
 
# map and aggregate for shell pipelines
Gravatar
Thu Feb 19 16:53:42 -0800 2009
1
exec iconv -c -f UTF-8 -t UTF-8
gist: 63810 csv2tsv
Gravatar
Fri Feb 13 01:12:26 -0800 2009
1
2
3
#!/usr/bin/env python2.6
"""
Input is Excel-style CSV. Either stdin or filename.
gist: 62935 2sql - turn a newline or wh...
Gravatar
Thu Feb 12 15:12:35 -0800 2009
1
2
3
#!/usr/bin/env ruby
 
# 112
gist: 62916 commandline map
Gravatar
Thu Feb 12 14:44:21 -0800 2009
1
2
3
#!/usr/bin/env ruby
 
# like map(), except on shell pipelines
gist: 61320 mail cgi for curl
Gravatar
Tue Feb 10 01:31:24 -0800 2009
1
2
3
#!/usr/bin/env ruby
 
puts "Content-Type: text/plain"
gist: 60026 tabsort
Gravatar
Sat Feb 07 11:59:33 -0800 2009
1
2
3
#!/bin/bash
 
export TAB=$(echo -e "\t")
Gravatar
Sat Feb 07 09:30:08 -0800 2009
1
2
3
CSV from PostgreSQL, at least as far as I can tell. i'm sure messes up embedded quotes and maybe embedded commas.
 
psql.csv() { psql -qAF , "$@" | egrep -v '^\([0-9]+ rows\)$' }
gist: 39760 load the MNIST data set in R
Gravatar
Wed Dec 24 12:11:03 -0800 2008
1
2
3
# Load the MNIST digit recognition dataset into R
# http://yann.lecun.com/exdb/mnist/
# assume you have all 4 files and gunzip'd them
gist: 28439 pipe fiddling: (1) kill buf...
Gravatar
Mon Nov 24 02:33:02 -0800 2008
1
2
3
# Pipe-oriented I/O in Python. This is harder than it should be.
# (1) Kill stdout buffering. makes redirects and tee easier to use.
if "<fdopen>" not in str(sys.stdout): sys.stdout = os.fdopen(1,'w',0)
gist: 28405 http://anyall.org/blog/2008...
Gravatar
Sun Nov 23 23:35:01 -0800 2008
1
2
3
"""ajaxgoogle.py - Simple bindings to the AJAX Google Search API
(Just the JSON-over-HTTP bit of it, nothing to do with AJAX per se)
http://code.google.com/apis/ajaxsearch/documentation/reference.html#_intro_fonje
gist: 22959 md5sort
Gravatar
Fri Nov 07 12:38:54 -0800 2008
1
2
3
#!/usr/bin/env python
""" sorts lines (or tab-sep records) by md5. (e.g. for train/test splits).
optionally prepends with the md5 id too.
gist: 22958 commandline set operations ...
Gravatar
Fri Nov 07 12:37:20 -0800 2008
1
2
3
#!/usr/bin/env python
""" set operations on files as lists. symlink this as:
* setdiff [-c] <set1> <set2> - set difference
gist: 22764 xlsx2tsv: python command-li...
Gravatar
Thu Nov 06 18:53:28 -0800 2008
1
2
3
#!/usr/bin/env python
"""
xlsx2tsv filename.xlsx [sheet number or name]
gist: 16240 political bias algorithm an...
Gravatar
Sat Oct 11 02:37:22 -0700 2008
1
2
3
name,score_skewz,score_svd,url,v1,v2,v3,v4,v5
The Politico,-0.133333333333333,-0.069840595513546,politico.com,-0.0579919888228,-0.0156533209161,-0.0118276408031,-0.000672353189093,0.00899951990495
Right Wing Nut House,0.666666666666667,0.016997861495122,rightwingnuthouse.com,-0.0114438419789,0.00923210186058,-0.000332659887795,-0.00357075698976,0.0194133595538
gist: 16173 python decorators to log al...
Gravatar
Fri Oct 10 16:00:53 -0700 2008
1
2
3
# Written by Brendan O'Connor, brenocon@gmail.com, www.anyall.org
# * Originally written Aug. 2005
# * Posted to gist.github.com/16173 on Oct. 2008
gist: 16016 network connectivity troubl...
Gravatar
Fri Oct 10 01:03:00 -0700 2008
1
2
3
load '~/.irbrc' # dotfiles.org/~brendano/.irbrc
require 'hpricot'
sites=[]
gist: 15594 blogger -> wordpress redire...
Gravatar
Wed Oct 08 14:03:56 -0700 2008
1
2
3
<?
/**
 * *** THIS NEEDS TO BE EDITED FOR A NEW INSTALLATION ***