Skip to content

Instantly share code, notes, and snippets.

View aelkiss's full-sized avatar

Aaron Elkiss aelkiss

View GitHub Profile
@aelkiss
aelkiss / xlink.xsd
Created April 18, 2019 15:46
compromise xlink schema (loc + w3c)
@aelkiss
aelkiss / mets.xsd
Created April 18, 2019 15:47
mets schema referencing w3c xlink schema
<?xml version="1.0" encoding="UTF-8"?>
<!-- METS: Metadata Encoding and Transmission Standard -->
<!--
This document is available under the Creative Commons CC0 1.0 Universal Public Domain Dedication (http://creativecommons.org/publicdomain/zero/1.0/).
The Digital Library Federation, as creator of this document, has waived all rights to it worldwide under copyright law, including
all related and neighboring rights, to the extent allowed by law. For the full text see http://creativecommons.org/publicdomain/zero/1.0/legalcode.
-->
<!--
Prepared for the Digital Library Federation by Jerome McDonough, New York University,
with the assistance of Michael Alexander (British Library), Joachim Bauer (Content Conversion Specialists, Germany),
@aelkiss
aelkiss / ht_to_grin.rb
Created April 22, 2019 19:49
Convert HathiTrust IDs to GRIN volume IDs
#!ruby
grin_ids = {
'uc1' => 'UCAL',
'hvd' => 'Harvard',
'uva' => 'UVA',
'mdp' => 'UOM',
'nnc1' => 'Columbia',
'uiug' => 'UIUC',
@aelkiss
aelkiss / fake_user.rb
Created August 8, 2019 16:12
create fake user for ht useradmin
require 'faker'
user = {
userid: Faker::Internet.username,
displayname: Faker::Name.name,
email: Faker::Internet.email,
activity_contact: Faker::Internet.email,
approver: Faker::Internet.email,
authorizer: Faker::Internet.email,
usertype: ['staff','external','student'].sample,
@aelkiss
aelkiss / docker-compose.yml
Created August 12, 2020 18:09
catalog faker
# From any other service you start in this docker-compose.yml, you'll be able to do:
# curl -X POST -d q=ht_id:loc.ark:/13960/t6vx15d67&start=0&rows=1&fl=fullrecord,language,language008 \
# http://solr-sdr-catalog:9033/solr/catalog/select
# and get the result listed here: https://gist.github.com/respinos/d92b92e5a51307816fb429a9053fc995
version: '3'
services:
solr-sdr-catalog:
image: hathitrust/catalog_solr_faker
@aelkiss
aelkiss / saml_exchange.md
Last active September 30, 2020 21:11
Example SAML exchange

Example SAML authentication exchange:

The SAML DevTools Extension for Chrome can be helpful in debugging whether or not everything is working as expected.

The SAML request we generate looks like

@aelkiss
aelkiss / box_list_collabs.rb
Last active April 21, 2021 17:11
List external collaborators using the box API
require 'json'
require 'boxr'
# box_list_collabs.rb: List external collaborators for a Box folder and all its subfolders on box.
#
# Output format: tab separated values: parent folder, item name, collaborator name, collaborator login, collaborator role
#
# Usage:
#
# - Install the boxr gem (https://github.com/cburnette/boxr) either with 'gem
@aelkiss
aelkiss / dropbox_create_and_share.rb
Created April 21, 2021 16:50
Create and share a folder with Dropbox HTTP API
#!ruby
require 'json'
require 'faker'
require 'faraday'
# Example of using the Dropbox HTTP API to create and share a folder.
#
# Usage:
#
@aelkiss
aelkiss / mets1to2.xsl
Last active September 11, 2023 20:37
Transformation from METS1 to METS2
moved to https://github.com/mets/METS1to2
@aelkiss
aelkiss / remove_ties.rb
Last active May 12, 2023 02:06
remove ties from lilypond
# Useful for adapting editions of early music to create versions without barlines
# Ties must not cross lines
# Before running this, use the "explicit durations" transformation in Frescobaldi
TIE_RE = %r(([a-g][fs]?)([,']?)(\d)\s*~\s*\|\s*\1(\d))
ARGF.readlines.each do |line|
# STDERR.puts "Original line: #{line}"
while(line.match?(TIE_RE))
line.match(TIE_RE) do |m|