Skip to content

Instantly share code, notes, and snippets.

Avatar

Jon Stroop jpstroop

  • Princeton University Library
  • Princeton, NJ
View GitHub Profile
@jpstroop
jpstroop / sync_exist.sh
Created Apr 22, 2012
cron script for keeping eXist in sync with a filesystem
View sync_exist.sh
#!/bin/bash
#
# Load incremental changes since the last load. This script maintains a
# hidden file that keeps track of this information.
#
# UTILS
DATE="/bin/date"
CURL="/usr/bin/curl"
@jpstroop
jpstroop / dirtopdf.sh
Created Jun 19, 2012
Make a PDF form a directory of TIFFs
View dirtopdf.sh
#!/bin/bash
#
# Takes a directory of TIFF images and makes a PDF
#
# Usage:
# ./dirtopdf [-rd] [-s <arg>] -o <file> <dir>
#
# e.g.: ./dirtopdf.sh -rd -s 3200 -o new.pdf /tmp/bar
#
@jpstroop
jpstroop / bots.py
Created Dec 4, 2012 — forked from edsu/bots.py
see what your bot traffic is like
View bots.py
#!/usr/bin/env python
"""
Hack to look for user agent strings in typical Apache style log and
count up the number of requests by bots vs non-bots. The list of bot
user agents comes from http://www.user-agents.org/ but has had some
agents added to it, since the user-agents.org list is pretty out of date, e.g.
no Bing?!
"""
@jpstroop
jpstroop / dzi_to_iiif.py
Last active Oct 15, 2020
DZI syntax to IIIF
View dzi_to_iiif.py
# 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
jpstroop / c4l_loris_lightning_talk.md
Last active Dec 12, 2015
Lightning talk re: Loris <https://github.com/pulibrary/loris> for code4lib 2013.
View c4l_loris_lightning_talk.md
@jpstroop
jpstroop / not_blomeka.md
Last active Dec 15, 2015
Notes, Examples, and Use Cases about an Exhibition / Ad Hoc Collection building utility built on Blacklight (Hydra?)
@jpstroop
jpstroop / recordInfo_mets.xml
Last active Dec 15, 2015
mods:recordinfo in METS
View recordInfo_mets.xml
<snip>
<dmdSec ID="dmd-arab">
<mdWrap MDTYPE="MODS">
<xmlData>
<mods:recordInfo>
<mods:languageOfCataloging>
<mods:languageTerm>ara</mods:languageTerm>
<mods:scriptTerm type="code">Arab</mods:scriptTerm>
</mods:languageOfCataloging>
</mods:recordInfo>
@jpstroop
jpstroop / changes1.1.md
Last active Dec 17, 2015
IIIF Image API 1.1 Change Log
View changes1.1.md

IIIF Image API 1.1 Change Log

Section 2

  • Base URI defined. Section 2.2 recommends that this URI returns the image information or redirects to the image information request URI when dereferenced.
  • Clarified definition of the prefix segment of the base URI.

Section 5

  • Added @id and @context properties to make image information JSON-LD compatible. The addition of the base URI in the @id property should make it easier for clients to get around XSS/SOP issues when working with IIIF image servers in different domains.
  • Image information in XML (http[s]://server/[prefix/]identifier/info.xml) and related schemas have been removed.
  • Clarified the definition of scale_factors.
@jpstroop
jpstroop / parent_days.py
Last active Dec 18, 2015
My birthday sometimes falls on Father's Day and Abi's sometimes falls on Mother's Day. I was wondering if this would this ever happen in the same year. Here's the answer:
View parent_days.py
#!/usr/bin/env python
from datetime import date
def fday_on_jons_bday(year):
return [d for d in range(15,22) if date(year, 6, d).weekday() == 6][0] == 16
def mday_on_abis_bday(year):
return [d for d in range(8,15) if date(year, 5, d).weekday() == 6][0] == 14
j_years = filter(lambda d: fday_on_jons_bday(d), range(2007,2078)) # F's bday to J's birth year + 100
@jpstroop
jpstroop / owl_to_rb.rb
Created Oct 22, 2013
OWL to RDF::Vocabulary
View owl_to_rb.rb
require 'linkeddata'
include RDF
# args
@ns = 'http://library.ucsd.edu/ontology/dams/#'
@class_name = 'UCSD_DAMS'
@i = 'https://raw.github.com/ucsdlib/dams/master/ontology/dams.owl'
@o = 'ucsd_dams.rb'
#