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
""" | |
Quickly hacked script to turn Romenesko's left rail into an RSS feed. Dates don't really work. | |
By Derek Willis | |
[email protected] | |
This script is in the public domain. | |
Dependencies: Beautiful Soup (< 3.0.7) | |
""" | |
import urllib |
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 python | |
# -*- coding: utf-8 -*- | |
''' | |
This script was used to convert the 2009 Q3 House Disbursement PDF into detail and summary CSV files. | |
Source PDF: http://disbursements.house.gov/ | |
Resulting Data: http://www.sunlightfoundation.com/projects/2009/expenditures/ | |
It was originally authored by Luke Rosiak with improvements by James Turk for Sunlight Labs and is released into the public domain. |
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
sudo tcpdump -nnvvXSs 1514 -i lo0 dst port 5432 |
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
def votes_date_range | |
return unless check_format | |
@version = params[:version] | |
@format = params[:format] | |
raise ActiveResource::BadRequest.new("Not available in this version") if @version == 'v2' | |
.... | |
end | |
def bad_request(e) | |
@message = e.message |
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
file = "/Users/archie/Desktop/awesome.pdf" | |
system "pdftotext -layout #{file}" | |
new_file = File.open("/Users/archie/Desktop/awesome.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
def detail | |
return unless check_format | |
@request = request | |
@version = params[:version] | |
@cycle = params[:cycle].to_i | |
raise ActiveRecord::RecordNotFound if @cycle < 2000 | |
@format = params[:format] | |
@base_uri = base_uri(@request, @cycle, @version) | |
@fec_candidate = FecCandidate.find_with_cycle_and_committee(@cycle.to_i,params[:id]) | |
if not @fec_candidate |
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
Derek-Williss-MacBook-Pro:zappa-test derek$ zappa cuppa.coffee | |
Error: ENOENT, No such file or directory 'node' | |
at Object.openSync (fs:153:18) | |
at Object.readFileSync (fs:94:15) | |
at Zappa.read (/usr/local/lib/node/.npm/zappa/0.1.3/package/lib/zappa.js:67:17) | |
at Zappa.run_file (/usr/local/lib/node/.npm/zappa/0.1.3/package/lib/zappa.js:71:75) | |
at Object.run_file (/usr/local/lib/node/.npm/zappa/0.1.3/package/lib/zappa.js:650:23) | |
at Object.<anonymous> (/usr/local/lib/node/.npm/zappa/0.1.3/package/bin/zappa.coffee:96:15) | |
at Object.<anonymous> (/usr/local/lib/node/.npm/zappa/0.1.3/package/bin/zappa.coffee:100:4) | |
at Module._compile (node.js:462:23) |
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
def load_ncaa_game_xml(game): | |
""" | |
Loader for NCAA game xml files. Accepts a Game object. The NCAA's xml needs to be cleaned up slightly by replacing | |
elements with interior spaces with 0. Some game files contain inaccurate team IDs, mostly for smaller schools, | |
which explains the hard-coding below. On occasion, usually when a team schedules a lower-division opponent, the | |
NCAA may not have have an ID, which will raise an error. | |
>>> game = Game.objects.get(id=793) | |
>>> load_ncaa_game_xml(game) | |
""" | |
doc = urllib.urlopen(game.get_ncaa_xml_url()).read() |
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
@cache_control(public=True, max_age=300) | |
def recruiting_year(request, yslug): | |
year = get_object_or_404(RecruitClass, year_slug=yslug) | |
recruiting_year = 1 | |
years = RecruitClass.objects.all().order_by('year') | |
player = Recruit.objects.filter(college_class__year_slug=yslug).filter(Q(signing_day_pick_school__school__short_name="Florida")|Q(verbal_commit_pick_school__school__short_name="Florida")).filter(Q(committed_status__status="Signed")|Q(committed_status__status="Verbal")).order_by('last_name') | |
return render_to_response('year_detail.html', { | |
'player': player, | |
'year': year, | |
'years': years, |
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
# convert.py | |
import sys | |
import csv | |
tabin = csv.reader(sys.stdin, dialect=csv.excel_tab) | |
commaout = csv.writer(sys.stdout, dialect=csv.excel) | |
for row in tabin: | |
commaout.writerow(row) |
OlderNewer