Skip to content

Instantly share code, notes, and snippets.


Jon Stroop jpstroop

  • Princeton University Library
  • Princeton, NJ
View GitHub Profile
althonos / setup.cfg
Last active Apr 8, 2021
A `setup.cfg` template for my Python projects
View setup.cfg
name = {name}
version = file: {name}/_version.txt
author = Martin Larralde
author-email =
home-page ={name}
description = {description}
long-description = file:
View plum.json
"states": ["pending", "metadata_review", "final_review", "complete", "flagged", "takedown"],
{"name":"suppressed", "states":["pending", "metadata_review", "final_review", "takedown"]}
{ "from":"pending", "to":"metadata_review", "name":"finalize_digitization" },
{ "from":"metadata_review", "to":"final_review", "name":"finalize_metadata" },
{ "from":"final_review", "to":"complete", "name":"complete" },
{ "from":"complete", "to":"takedown", "name":"takedown" },
no-reply / vocabs.rb
Last active Jan 4, 2016
Using Vocabulary Loader
View vocabs.rb
# The ruby-rdf vocabulary loader is used to maintain the vocabularies in the core library.
# There's a rake task that is the main way it is used and serves as a good reference.
rake gen_vocabs
# Generate lib/rdf/vocab/cc.rb
# Generate lib/rdf/vocab/cert.rb
# Generate lib/rdf/vocab/dc.rb
# Generate lib/rdf/vocab/dc11.rb
no-reply / oregon_rdf_demo.rb
Last active Jul 12, 2017
RDF Resources in OregonDigital
View oregon_rdf_demo.rb
# RdfResource is a subclass of RDF::Graph with property configuration, accessors, and some other methods
# for managing "resources" as discrete subgraphs which can be managed by a Hydra datastream model.
# The relevant modules and class are:
bnode =
peterjmit /
Created Oct 10, 2012
Bash Benchmark Script (using time)
# Benchmark runner
command_to_run='echo 1'
run_tests() {
# --------------------------------------------------------------------------
cosimo /
Created Sep 21, 2012
Example of how to parse options with bash/getopt
# Example of how to parse short/long options with 'getopt'
OPTS=`getopt -o vhns: --long verbose,dry-run,help,stack-size: -n 'parse-options' -- "$@"`
if [ $? != 0 ] ; then echo "Failed parsing options." >&2 ; exit 1 ; fi
echo "$OPTS"
bradmontgomery / rvm_apache_passenger.txt
Created Jan 10, 2012
RVM + Apache + passenger setup for Ubuntu
View rvm_apache_passenger.txt
# Install rvm system-wide
bash -s stable < <(curl -s )
# Update the packages
apt-get update
apt-get upgrade
apt-get install build-essential
# get the packages required by ruby
rvm pkg install zlib
edsu /
Created Jun 23, 2011
see what your bot traffic is like
#!/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 but has had some
agents added to it, since the list is pretty out of date, e.g.
no Bing?!
View capybara cheat sheet
=Clicking links and buttons=
click_link('Link Text')
click('Link Text') # Click either a link or a button
click('Button Value')
mnot /
Created Oct 15, 2009 HTTP Link header parsing