Skip to content

Instantly share code, notes, and snippets.

Avatar

Laura Wrubel lwrubel

View GitHub Profile
@lwrubel
lwrubel / captions-shift.py
Last active Jul 13, 2020
Shift timestamps for captions in VTT files. Usage: python3 captions-shift.py my_captions.vtt my_edited_captions.vtt -2.25
View captions-shift.py
#!/usr/bin/env python3
import webvtt
from datetime import datetime, timedelta
import argparse
parser = argparse.ArgumentParser(description="Shift caption start \
and end times in a .vtt file")
parser.add_argument("inputfile", help="input filename, must be VTT format")
parser.add_argument("outputfile", help="output filename")
@lwrubel
lwrubel / mena-serials-before.csv
Created Sep 23, 2019
Messy serials data example
View mena-serials-before.csv
MMS ID Library Location Volume Issue number Year Month Barcode Note
99169315803604107 gelman grcmis 1 1 1989 Spring 32882022255379
99169315803604107 gelman grcmis 1 2 1989 Summer 32882022255387
99169315803604107 gelman grcmis 1 3 1989 Autumn 32882022255635
99169315803604107 gelman grcmis 1 4 1990 Winter 32882022255882
99169315803604107 gelman grcmis 2 1 1990 Spring 32882022256138
99169315803604107 gelman grcmis 2 2 1990 Summer 328820222563
99169315803604107 gelman grcmis 2 3 1990 Autumn 32882022256393
99169315803604107 gelman grcmis 2 4 1991 Winter 32882022256146
99169315803604107 gelman grcmis 3 1 1991 Spring 32882022255890
@lwrubel
lwrubel / csv-to-ris-format.py
Last active Aug 11, 2020
Convert csv exported from Google Sheets to RIS format. To use: python csv-to-ris-format.py infile.csv outfile.txt
View csv-to-ris-format.py
#!/usr/bin/env python
# To use:
# python csv-to-ris-format.py csvfile.csv risoutput.txt
#
# Assumes you have removed the header row from the csv file,
# columns are in the same order as the labels list,
# and there are no other columns in the csv.
import csv
from sys import argv
@lwrubel
lwrubel / chronam-title-counts.rb
Created Apr 24, 2017
Sonic Pi code for a sonification of the numbers of titles in Chronicling America, year by year.
View chronam-title-counts.rb
require 'csv'
data = CSV.parse(File.read("/Users/lwrubel/projects/chronam-exploration/final-counts.csv"), {:headers => false})
count = 1788
notes = scale(:g2, :major, num_octaves: 5)
separator = 0.2
# for each line of data, play a drum beat and appropriate pitch
data.each do |line|
puts line
@lwrubel
lwrubel / cycling-to-work.rb
Last active Mar 1, 2016
Cycling to work from Alexandria to Foggy Bottom, DC
View cycling-to-work.rb
# cycling to work, in a brisk cold wind
# csv file has a heartrate and altitude measurement taken each second
# piano is the heartrate, higher note is higher heartrate
# underlying synth is altitude, higher pitch is higher altitude
require 'csv'
data = CSV.parse(File.read("/Users/lwrubel/projects/datasonify/20160222-cycle-to-work.csv"))
# using pentatonic scale for heartrate
@lwrubel
lwrubel / launchpad-github.rb
Last active Dec 14, 2015
Sonic Pi code for reading Github commits to GW Libraries Launchpad repo
View launchpad-github.rb
# files changed in github launchpad repo (https://github.com/gwu-libraries/launchpad)
# full sonic pi code at https://gist.github.com/lwrubel/5a621aa316741ad8d315
require 'csv'
data = CSV.parse(File.read("/Users/lwrubel/projects/stg-sound/launchpad-noDmrc.csv"), {:headers => false})
use_synth :subpulse
separator = 0.15
count = 0
@lwrubel
lwrubel / plain-bob-minor.rb
Created Oct 4, 2015
Plain Bob Minor (6 bells)
View plain-bob-minor.rb
# Plain Bob Minor (6 bells)
use_synth :dull_bell
bells = [:A5, :G5, :F5, :E5, :D5, :C5]
define :round do |c|
4.times do |row|
puts "Round #{row}"
for i in 0..5
play bells[i], release: 2
@lwrubel
lwrubel / plain-hunt-on-4.rb
Last active Oct 4, 2015
Plain Hunt on 4 bells (minimus)
View plain-hunt-on-4.rb
# Plain hunt minimus (on 4)
use_synth :dull_bell
minimus = [:F5, :E5, :D5, :C5]
define :round do |c|
4.times do |change|
puts "Change #{change}"
for i in 0..3
play c[i], release: 2
View checkouts.rb
# plays one note for each day in a year of checkout data from the library
# recording at https://soundcloud.com/laurasaurus5/checkouts
require 'csv'
data = CSV.parse(File.read("/Users/lwrubel/projects/datasonify/gwtransactcounts.csv"), {:headers => true, :header_converters => :symbol})
# 7/1/2014 is a Tuesday and day 182 of the year
dailycount = 2
day = 182
You can’t perform that action at this time.