Skip to content

Instantly share code, notes, and snippets.

httpd 21621 root cwd DIR 0,179 4096 169321800 /
httpd 21621 root rtd DIR 0,179 4096 169321800 /
httpd 21621 root txt REG 0,179 312372 30417878 /usr/sbin/httpd
httpd 21621 root mem REG 0,179 46680 7938536 /lib/libnss_files-2.5.so
httpd 21621 root mem REG 0,179 13420 7938518 /lib/libutil-2.5.so
httpd 21621 root mem REG 0,179 1611095 14621180 /usr/lib/httpd/modules/mod_python.so
httpd 21621 root mem REG 0,179 30300 14625108 /usr/lib/httpd/modules/mod_proxy_ajp.so
httpd 21621 root mem REG 0,179 5500 14625070 /usr/lib/httpd/modules/mod_version.so
httpd 21621 root mem REG 0,179 22136 14625164 /usr/lib/httpd/modules/mod_cgi.so
httpd 21621 root mem REG 0,179 22076 14625080 /usr/lib/httpd/modules/mod_mem_cache.so
@palewire
palewire / GeoDjango model with viewport bias.py
Created June 29, 2010 02:13
Generate a viewport bias from a GeoDjango model. Useful when geocoding.
from django.contrib.gis.db import models
from django.contrib.gis.geos import Point
class Multipolygon(models.Model):
"""
Try using it with this: http://github.com/palewire/latimes-mappingla-geopy
"""
name = models.CharField(max_length=200, null=True, blank=True)
multipolygon = models.MultiPolygonField(srid=2229, null=True, blank=True)
objects = models.GeoManager()
@palewire
palewire / csv_splitter.py
Created September 24, 2010 21:09
A Python CSV splitter
import os
def split(filehandler, delimiter=',', row_limit=10000,
output_name_template='output_%s.csv', output_path='.', keep_headers=True):
"""
Splits a CSV file into multiple pieces.
A quick bastardization of the Python CSV library.
Arguments:
@palewire
palewire / pdf.py
Created January 5, 2011 18:47
pdf2txt ripper from EveryBlock code.
"""
Utilities for reading data from PDF files.
Lifted from EveryBlock source code.
These require the pdftotext binary, available in the Xpdf package:
http://www.foolabs.com/xpdf/download.html
"""
import os
{"project":{"id":null,"title":"This is bad test","description":null,"document_ids":[]}}
@palewire
palewire / AP_STATES_NORMALIZATION.py
Created April 21, 2011 22:50
A crosswalk that converts state names and abbreviations to A.P. style.
AP_STATES_NORMALIZATION = {
'ak': 'Alaska',
'al': 'Ala.',
'ala': 'Ala.',
'alabama': 'Ala.',
'alaska': 'Alaska',
'american samao': 'A.S.',
'american samoa': 'A.S.',
'ar': 'Ark.',
'ariz': 'Ariz.',
@palewire
palewire / dorling.py
Created September 20, 2011 08:26
Takes a GeoDjango queryset and creates a cartogram of circles based on the Dorling algorithm.
import math
from django.contrib.gis.geos import Point
class Cartogram(object):
"""
Takes a GeoDjango queryset and creates a cartogram of circles based on
the Dorling algorithm.
User must provide a queryset and strings pointing to the data attribute
@palewire
palewire / Hartnett Command Performance
Created September 30, 2011 20:40 — forked from ryanpitts/Hartnett Command Performance
Let Ubuntu read you the latest @wmhartnett updates from Twitter
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
@palewire
palewire / eagle
Created November 2, 2011 21:44
Eagle
. ,
'. '. \ \
._ '-.'. `\ \
'-._; .'; `-.'.
`~-.; '. '.
'--,` '.
-='. ;
.--=~~=-, -.; ;
.-=`; `~,_.; /
` ,-`' .-; |
@palewire
palewire / eagle.cow
Created November 2, 2011 21:59
eagle.cow
#
# Caw! I'm an eagle!
#
$the_cow = <<EOC;
. , $thoughts
'. '. \ \ $thoughts
._ '-.'. `\ \ $thoughts
'-._; .'; `-.'. $thoughts
`~-.; '. '. $thoughts
'--,` '. $thoughts