Skip to content

Instantly share code, notes, and snippets.

View jpstroop's full-sized avatar

Jon Stroop jpstroop

  • Princeton University Library
  • Princeton, NJ
View GitHub Profile
@no-reply
no-reply / vocabs.rb
Last active January 4, 2016 03:39
Using Vocabulary Loader
# 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.
# https://github.com/ruby-rdf/rdf/blob/develop/Rakefile
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
@escowles
escowles / plum.json
Last active September 19, 2016 15:34
{
"states": ["pending", "metadata_review", "final_review", "complete", "flagged", "takedown"],
"state_groups":[
{"name":"suppressed", "states":["pending", "metadata_review", "final_review", "takedown"]}
],
"events":[
{ "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
no-reply / oregon_rdf_demo.rb
Last active July 12, 2017 00:14
RDF Resources in OregonDigital
# 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:
#
# https://github.com/OregonDigital/oregondigital/tree/master/lib/oregon_digital/rdf/rdf_configurable.rb
# https://github.com/OregonDigital/oregondigital/tree/master/lib/oregon_digital/rdf/rdf_properties.rb
# https://github.com/OregonDigital/oregondigital/tree/master/lib/oregon_digital/rdf/rdf_resource.rb
bnode = OregonDigital::RDF::RdfResource.new
@bradmontgomery
bradmontgomery / rvm_apache_passenger.txt
Created January 10, 2012 04:45
RVM + Apache + passenger setup for Ubuntu
# Install rvm system-wide
bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer )
# Update the packages
apt-get update
apt-get upgrade
apt-get install build-essential
# get the packages required by ruby
rvm pkg install zlib
@mnot
mnot / link_header.py
Created October 15, 2009 00:41
link_header.py: HTTP Link header parsing
@edsu
edsu / bots.py
Created June 23, 2011 20:16
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 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?!
"""
@zhengjia
zhengjia / capybara cheat sheet
Created June 7, 2010 01:35
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@althonos
althonos / setup.cfg
Last active March 4, 2024 18:08
A `setup.cfg` template for my Python projects
# https://gist.github.com/althonos/6914b896789d3f2078d1e6237642c35c
[metadata]
name = {name}
version = file: {name}/_version.txt
author = Martin Larralde
author_email = martin.larralde@embl.de
url = https://github.com/althonos/{name}
description = {description}
long_description = file: README.md
@peterjmit
peterjmit / benchmark.sh
Created October 10, 2012 10:49
Bash Benchmark Script (using time)
#!/bin/bash
# REQUIRES SUDO
# Benchmark runner
repeats=20
output_file='benchmark_results.csv'
command_to_run='echo 1'
run_tests() {
# --------------------------------------------------------------------------
@cosimo
cosimo / parse-options.sh
Created September 21, 2012 09:31
Example of how to parse options with bash/getopt
#!/bin/bash
#
# 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"