Skip to content

Instantly share code, notes, and snippets.

View kidwellj's full-sized avatar

Jeremy Kidwell kidwellj

View GitHub Profile
@kidwellj
kidwellj / annotex.py
Created January 17, 2020 15:11 — forked from retrography/annotex.py
PDF highlight and annotation extractor
#!/usr/bin/env python
__author__ = 'Mahmood S. Zargar'
import poppler
import sys
import urllib
import os
def main():
### Keybase proof
I hereby claim:
* I am kidwellj on github.
* I am kidwellj (https://keybase.io/kidwellj) on keybase.
* I have a public key ASDG3RqyUWri0tpUUeKD_rhDM8dbapUZwkD4qTOWFm5_Ago
To claim this, I am signing this object:
@kidwellj
kidwellj / UK_postcode_openrefine_regexp
Created July 17, 2017 13:07
OpenRefine regex for UK postcodes
value.partition(/([A-IK-PR-UWYZ]?[A-H,K-Y][0-9]?[0-9A-HJKMNP-Y][ ][0-9][ABD-HJLNP-UW-Z][ABD-HJLNP-UW-Z])/)[1]
@kidwellj
kidwellj / osm_extract_pow_osmium.sh
Created June 20, 2017 13:33
Shell script to extract places of worship data from an OpenStreetMap binary pbf dump using osmium
# A shell scrip which extracts places of worship data from an OpenStreetMap binary pbf dump using osmium
#
# Requires https://github.com/osmcode/osmium-tool
# to install on MacOS:
# brew install libosmium
# git clone https://github.com/osmcode/osmium-tool.git
# cd osmium-tool
# make
#
# Example below uses a dump for California, USA, so make sure you substitute yourfilename.osh.pbf
@kidwellj
kidwellj / osm_extract_pow_osmosis.sh
Last active June 20, 2017 13:37
Extract "places of worship" from OpenStreetMap pbf regional extract file in MacOS
# install osmosis first, see: http://wiki.openstreetmap.org/wiki/Osmosis/Installation#OS_X
# you may need to update java runtime, use “brew cask install java” and then “export JAVA_HOME="$(/usr/libexec/java_home -v 1.8)”
# get build files from http://wiki.openstreetmap.org/wiki/Planet.osm#Country_and_area_extracts
osmosis \
--read-pbf GB \
--tf accept-nodes building=church,cathedral,chapel,mosque,synagogue,temple amenity=place_of_worship denomination=* religion=* name=*church* \
--tf reject-ways \
--tf reject-relations \
--write-xml GB_pow.osm.xml