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
curl https://api.twitter.com/1/statuses/user_timeline.rss?screen_name=wmhartnett | grep '<description>.*</description>' | sed -e 's/<\/*description>//g' -e 's/ \/ wmhartnett//g' -e 's/wmhartnett: //g' | espeak |
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
. , | |
'. '. \ \ | |
._ '-.'. `\ \ | |
'-._; .'; `-.'. | |
`~-.; '. '. | |
'--,` '. | |
-='. ; | |
.--=~~=-, -.; ; | |
.-=`; `~,_.; / | |
` ,-`' .-; | |
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
# | |
# Caw! I'm an eagle! | |
# | |
$the_cow = <<EOC; | |
. , $thoughts | |
'. '. \ \ $thoughts | |
._ '-.'. `\ \ $thoughts | |
'-._; .'; `-.'. $thoughts | |
`~-.; '. '. $thoughts | |
'--,` '. $thoughts |
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 roundint2precision(value, count): | |
""" | |
Accepts an integer and rounds it to the nearest number | |
at the specified precision, measured in "significant digits." | |
Example usage: | |
>> roundint2precision(1211111, 2) | |
1200000 | |
>> roundint2precision(1211111, 3) |
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
import csv | |
from googlegeocoder import GoogleGeocoder | |
geocoder = GoogleGeocoder() | |
data = list(csv.DictReader(open('/home/ben/Downloads/latest.csv', 'r'))) | |
outfile = open("out.csv", "w") | |
s = "%s, %s" | |
for row in data: | |
a = s % (row['Address'], row['Zip']) |
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
""" | |
Before you can use this, install the @LATdatadesk DocumentCloud wrapper for Python. Like so: | |
$ sudo pip install python-documentcloud | |
""" | |
import csv | |
from documentcloud import DocumentCloud | |
path = '/home/ben/Desktop/docs.csv' | |
data = csv.DictReader(open(path, 'r')) |
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 fabric.api import * | |
from openstack.compute import Compute | |
def bootstrap(): | |
install_chef() | |
update_chef() | |
def install_chef(): | |
""" | |
Install Chef on your server |
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
In my Django error messages... | |
File "/apps/projects/lib/django/db/models/sql/query.py", line 2347, in execute_sql | |
cursor.execute(sql, params) | |
OperationalError: could not write block 341 of temporary file: No space left on device | |
HINT: Perhaps out of disk space? | |
... |
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
/bin/su postgres -c "/usr/bin/vacuumdb --analyze --dbname <dbname>" |
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 "/home/ben/Code/.../lib/python2.7/codecs.py", line 984, in getreader | |
return lookup(encoding).streamreader | |
LookupError: unknown encoding: r |