This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
puts "Content-Type: text/plain" | |
puts | |
subj = ENV['PATH_INFO'] || "" | |
subj.gsub!("'", '"') | |
msg = STDIN.read || "" | |
# system "env" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# like map(), except on shell pipelines | |
# one arg: the mapper | |
# transform input lines, via the mapper, into output lines | |
# mapper is eval'd within the input line string | |
# | |
# extract 2nd column | |
# cat file | map 'split[1]' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# 112 | |
# 114 | |
# 531 | |
# | |
# => | |
# | |
# (112,114,531) | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python2.6 | |
""" | |
Input is Excel-style CSV. Either stdin or filename. | |
Output is honest-to-goodness tsv: no quoting or any \\n\\r\\t. | |
""" | |
from __future__ import print_function | |
import csv, sys | |
warning_count=0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exec iconv -c -f UTF-8 -t UTF-8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# map and aggregate for shell pipelines | |
# Two args: mapper, then agger | |
# mapper is evaluated within each line | |
# agger is evaluated within an array holding all mapper results | |
# | |
# do a sum | |
# cat numbers | mapagg to_i 'inject(0){|s,x| s+x}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 | |
# this file is for ~/Library/Application Support/Adium 2.0/Scripts/Twitter.AdiumScripts/Contents/Resources/twitter.rb | |
# brendan o'connor - anyall.org | |
# TwitterAdium by Jesse Newland [email protected] | |
# this file hacked up by brendan o'connor - anyall.org | |
require 'yaml' | |
require 'rexml/document' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# from anyall.org/util.py | |
######### Make UTF-8 hurt less | |
# My rant about pre-py3k encoding handling | |
# They like to say, always use unicode internally, then decode/encode at I/O boundaries | |
# That's good once you've accomplished it, but it's impractical without the following shims | |
# Since Python has inconsistent policies for what encoding an arbitrary stream will be. | |
def fix_stdio(encoding='utf8', errors='strict', buffering=0): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
brendano@malbec:/usr2/brendano/rtw_acarlson_thesis/rtw.ml.cmu.edu/acarlson_thesis/clr/features_sup_1.0E-6 % egrep -i '\bphd\b' *.txt > ../sup_phd_grep.txt | |
brendano@malbec:/usr2/brendano/rtw_acarlson_thesis/rtw.ml.cmu.edu/acarlson_thesis/clr % cat sup_phd_grep.txt | ruby -ne '(a,b) = $_.strip.split(":"); w,f=b.split("\t"); w="%10.3g" % [w.to_f]; f = "%-30s" % [f]; puts "#{w}\t#{f}\t#{a}"' | tabsort -gr -k1 | head -100 | |
2.9 PhD student in _ mlauthor_features.txt | |
2.63 PhD student at _ university_features.txt | |
2.34 PhD program in _ academicfield_features.txt | |
2.3 PhD in _ academicfield_features.txt | |
1.83 PhD student in _ person_features.txt | |
1.81 PhD degree in _ academicfield_features.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
There's a blog I don't think anyone else reads. I ran across it searching for something else, and something about it, the tone of voice perhaps, so flat and bleak and hopeless, caught my attention. I bookmarked it. | |
If the girl who kept it knew that anyone was reading it, anybody cared, perhaps she would not have taken her own life. She even wrote about what she was going to do, the pills, the Numbutal and Seconal and the rest, that she had stolen a few at a time over the months from her stepfather's bathroom, the plastic bag, the loneliness, and wrote about it in a flat, pragmatic way, explaining that while she knew that suicide attempts were cries for help, this really wasn't, she just didn't want to live any longer. | |
She counted down to the big day, and I kept reading, uncertain what to do, if anything. There was not enough identifying information on the Web page even to tell me which continent she lived on. No e-mail address. No way to leave comments. The last message was simply, "Tonight." | |
I |