Skip to content

Instantly share code, notes, and snippets.

View johnjreiser's full-sized avatar

John Reiser johnjreiser

View GitHub Profile
####
# Stupid Shell Tricks
####
# find the largest files within a subdirectory (mac os x)
find . -type f -print0 | xargs -0 stat -f '%z %N' | sort -n | tail
@johnjreiser
johnjreiser / dbfschemacompare.py
Last active January 2, 2016 16:09
Generates a simple report showing matching schemas from a list of DBF files. Useful for seeing if a directory of shapefiles have similar attribute tables.
#!/usr/bin/env python
"""
Generates a simple report showing matching schemas from a list of DBF files.
"""
import sys, os, glob
from dbfpy import dbf
files = []
@johnjreiser
johnjreiser / csv2json.py
Last active December 22, 2015 22:49
script to convert a CSV file to JSON
#!/usr/bin/env python
import csv
import simplejson as json
import sys, os
rows = {}
csvkey = "mun_code"
# csvkey is the CSV column that contains a unique ID
@johnjreiser
johnjreiser / lucode_crosswalk.pgsql
Created July 24, 2013 13:25
PostgreSQL of the Land Use crosswalk table. Useful if you need a complete list of all of the Anderson Level 4 codes and their descriptions used in the State of New Jersey land use data.
CREATE TABLE lucode_crosswalk (
lucode integer NOT NULL PRIMARY KEY,
ludesc varchar(100) NOT NULL,
hltype varchar(30) NOT NULL
);
COMMENT ON TABLE lucode_crosswalk IS 'All available Land Use/Land Cover codes used in the NJ LULC data.';
COMMENT ON COLUMN lucode_crosswalk.lucode IS 'Anderson Level IV Code';
COMMENT ON COLUMN lucode_crosswalk.ludesc IS 'Land use type description';
COMMENT ON COLUMN lucode_crosswalk.hltype IS 'Hasse-Lathrop code classification';
@johnjreiser
johnjreiser / xapi_parser.py
Created May 9, 2012 03:22
Script to merge and convert a series of OpenStreetMap XAPI results into a single tab-delimited file. Keys are retained as additional fields. OSM id, latitude, and longitude are always exported.
#!/usr/bin/env python
# ---------------------------------------------------------------------------
# xapi_parser.py
# Created on: 8 May 2012
# Created by: John Reiser <reiser@rowan.edu>
#
# Script to merge and convert a series of OpenStreetMap XAPI results into a
# single tab-delimited file. Keys are retained as additional fields. OSM id,
# latitude, and longitude are always exported.
#
@johnjreiser
johnjreiser / keybase.md
Created September 24, 2014 20:32
keybase.md

Keybase proof

I hereby claim:

  • I am johnjreiser on github.
  • I am johnjreiser (https://keybase.io/johnjreiser) on keybase.
  • I have a public key whose fingerprint is E152 5F50 2A5E 4044 B7B2 1C9A 5660 B872 03D7 B097

To claim this, I am signing this object: