Skip to content

Instantly share code, notes, and snippets.


Jon Stroop jpstroop

  • Princeton University Library
  • Princeton, NJ
View GitHub Profile
jpstroop /
Last active Mar 11, 2021
Unwatch all Github repositories.
#!/usr/bin/env python
# Unwatch from all Github repositories. Note that it will only work with up to
# 100 repos at a time (pagination is not implemented), so you may need to run
# more than once.
# Depends:
# requests :
# Output (to stdout):
jpstroop /
Created Oct 23, 2016
Get EXIF, IPTC Metadata, etc. with Python & PIllow
from PIL import Image
from PIL.ExifTags import GPSTAGS
from PIL.ExifTags import TAGS
# Keys are listed here:
def _map_key(k):
return TAGS[k]
jpstroop /
Last active Oct 15, 2020
DZI syntax to IIIF
# Take params from the DZI syntax and turn them into an IIIF request
# Copyright (C) 2009 CodePlex Foundation
# Copyright (C) 2010-2013 OpenSeadragon contributors
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# - Redistributions of source code must retain the above copyright notice,
jpstroop / get_iso_langs.rb
Created Dec 6, 2013
Download the ISO 639-2 codes as RDF and convert to CSV
View get_iso_langs.rb
require 'rdf/rdfxml'
require 'csv'
# Gets the ISO639-2 languages from and saves it as CSV.
SAVE_AS = File.expand_path("../../../db/fixtures/iso639-2.csv", __FILE__)
jpstroop /
Last active May 22, 2018
Guess the orientation of an image using OCR and Spellcheck
# Script takes a single argument, which is a path in an image file.
# NOTE: this file will be replaced with the version that this script deems to be 'correct'
# Clean up if there are files from the last run
# (leaving them around is handy for debugging)
if [ -d $TMP ]; then
for md_file in $(find . -name "*.md"); do
gsed -r -i -e 's/([A-z])\.\s{2,3}([A-Z])/\1. \2/g' $md_file
jpstroop / 1_simple_manifest.rb
Last active Mar 20, 2018
Example: How to create a bare-bones IIIF Presentation Manifest w/ O'Sullivan
View 1_simple_manifest.rb
require 'iiif/presentation'
{ id: 'pudl0001%2F4609321%2Fs42%2F00000006.jp2', label: "Page 1" },
{ id: 'pudl0001%2F4609321%2Fs42%2F00000007.jp2', label: "Page 2" },
{ id: 'pudl0001%2F4609321%2Fs42%2F00000008.jp2', label: "Page 3" },
{ id: 'pudl0001%2F4609321%2Fs42%2F00000009.jp2', label: "Page 4" },
{ id: 'pudl0001%2F4609321%2Fs42%2F00000010.jp2', label: "Page 5" }
jpstroop / map.json
Last active Oct 12, 2017
IIIF canvasMap proposal
View map.json
"@context": "",
"id": "",
"type": "sc:Manifest",
"label": [
"Reports of the Princeton University expeditions to Patagonia, 1896-1899 : J. B. Hatcher in charge"
"viewingHint": "paged",
"viewingDirection": "left-to-right",
"rendering": {
jpstroop /
Last active Feb 14, 2017
Archives/EAD Tree Navigation API spec

Deprecated. Moved here:

Proposed Flow

  1. Talk to RBSC cat.
  2. Enhace EAD w/ item level data from TEI. Including pudl0123 IDs temporarily
  3. Use TEI to EAD mapping to reorg. images to match new EAD (item level) components
  4. Remove temporary pudl0123 IDs from new EAD components
  5. Generate new PULFA METS and load EAD
  6. Migration New PULFA METS to Plum - Make sure EAD component ID is in dc:replaces
  7. Map Plum manifest URIs back to TEI