Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am patsweet on github.
  • I am psweet (https://keybase.io/psweet) on keybase.
  • I have a public key ASALuWtIWN_0UvJkSCN-MjxHg2VRc1tqmfEc4t5BiN2esAo

To claim this, I am signing this object:

@patsweet
patsweet / split_pdf.py
Created January 8, 2014 17:15
Takes a pdf file and extracts a range of pages. Useful for batch removing cover pages or editing
#!/usr/bin/python
import argparse
import os
from pyPdf import PdfFileWriter, PdfFileReader
def is_valid_file(parser, arg):
if not os.path.exists(arg):
parser.error("The file %s does not exist." % arg)
else:
return arg
@patsweet
patsweet / parse_taxes.py
Created October 8, 2013 14:38
Takes a fixed-width file and transforms it into pipe-delimited for easy import into various databases.
# Parse County Tax Records into pipe-delimited files.
# The raw data are all in fixed-width format. The record layout,
# includes the field names and the lengths of each record. Parsed
# in order from the 0-character, it's easy to grab the correct
# portion of the line for each record. E.g.:
# 0-1 = period
# 1-2 = bill_type
# 2-17 = acct_num.
#
# The record layouts are found in the record_layouts directory.
@patsweet
patsweet / mappy.js
Created July 15, 2013 16:19
Ties a datatable to a leaflet map. Requires jQuery, Leaflet, DataTables, Leaflet-geosearch
var intersections, // Geojson
map,
delaware, // Lat/Lng of center of Delaware
streetMapUrl,
streetMapLayer,
geosearch,
legend,
polyindex, // Custom ID for each point.
highlightStyle = {
fillColor: 'green',