Skip to content

Instantly share code, notes, and snippets.

View aelkiss's full-sized avatar

Aaron Elkiss aelkiss

View GitHub Profile
@aelkiss
aelkiss / link_dataset.py
Last active March 12, 2025 17:16
Make pairtree links from volume ids (for dataset)
@aelkiss
aelkiss / merge_repos.sh
Last active October 16, 2023 15:36
merge together babel repos
# based on https://josh.fail/2022/merging-git-repos-with-git-filter-repo/
# First, make a clean checkout of all the repositories
REPO_ROOT=~/Repositories/babel-merge
# REPO_ROOT=$(dirname $(realpath $0))
git_filter_repo="git filter-repo"
[email protected]:hathitrust
export REPO_ROOT git_filter_repo GIT_BASE
@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|
@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 / 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 / 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 / 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 / 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 / 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 / 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',