Skip to content

Instantly share code, notes, and snippets.

View bibliotechy's full-sized avatar

Chad Nelson bibliotechy

View GitHub Profile
Vagrant.configure(2) do |config|
N = 3
VAGRANT_VM_PROVIDER = "virtualbox"
ANSIBLE_RAW_SSH_ARGS = []
(1..N).each do |i|
ANSIBLE_RAW_SSH_ARGS << "-o IdentityFile=.vagrant/machines/machine-0#{i}/#{VAGRANT_VM_PROVIDER}/private_key"
config.vm.define "machine-0#{i}" do |machine|
machine.vm.box = "centos/7"
machine.vm.hostname = "machine-0#{i}"

MADS has responsibility for uploading born digital objects to the Isilon that are acquired as part of an archival collection. This is usually in the form of hard drives and similar media that they want complete copies sent to the Isilon as part of the curation process.

Existing Project Proposal is in Confluence - https://tulibdev.atlassian.net/wiki/spaces/TPI/pages/864321537/Project+Proposal+Hard+Drive+Ingestion+Script

Currently, MADS (Stefanie) mounts the Isilon to her machine and then mounts the HD to her MAC via a write blocker and then runs an rsync command to recursively cpy the entire filesystem.
The rsync was provided to her by Jim Bongiovani. Prior to that there was an extensive bash script, written by Kate Lynch, that was being used, but Stefanie has never able to get it working. I don't

@bibliotechy
bibliotechy / gist:f43cf8acc2b9b485056134dcdda6aed4
Created July 17, 2018 14:05
unicode normalize error trace
2018-07-13T15:32:56-04:00 ERROR Unexpected error on record id `991032082719703811/991032082719703811` at file position 1
while executing (to_field genre_facet at /home/travis/build/tulibraries/tul_cob/lib/traject/indexer_config.rb:156)
Exception: NoMethodError: undefined method `normalize' for UnicodeNormalize:Module
/home/travis/.rvm/rubies/ruby-2.4.1/lib/ruby/2.4.0/unicode_normalize.rb:41:in `unicode_normalize'
2018-07-13T15:32:56-04:00 FATAL Traject::CommandLine: Unexpected exception, terminating execution: #<NoMethodError: undefined method `normalize' for UnicodeNormalize:Module>
/home/travis/.rvm/rubies/ruby-2.4.1/lib/ruby/2.4.0/unicode_normalize.rb:41:in `unicode_normalize': undefined method `normalize' for UnicodeNormalize:Module (NoMethodError)
from /home/travis/build/tulibraries/tul_cob/lib/traject/macros/custom.rb:286:in `block (2 levels) in extract_genre'
from /home/travis/build/tulibraries/tul_cob/vendor/bundle/ruby/2.4.0/gems/traject-2.3.4/lib/traject/marc_extractor.rb:244:in `block
#Y ou could write this
bin/rails generate migration CreateComponentsTable name:string local_id:string description_en:text description_jp:text
# and do so for all the fields outlined in the issue
# then do the same for Artist
bin/rails generate migration CreateArtistsTable name_en:string name_jp:string local_id:string viaf_id:string
# There a few fields that are references to another field. Like The user who created a component of a work.
# To add a reference to another Model, like Artist in Component
bin/rails generate migration AddArtistRefToComponents artist:references
@bibliotechy
bibliotechy / package_to_files.py
Created April 4, 2017 20:53
download data from open data philly
from requests import exceptions, get
import unicodedata
import fileinput
import json
import re
import datetime, time
from os import mkdir, getcwd, path
DAY_IN_SECONDS = 86400
@bibliotechy
bibliotechy / gs_to_ndj.js
Created March 3, 2017 03:01
google sheet to new line delimited json
#based on https://github.com/jsoma/tabletop/blob/master/examples/nodejs/test.js
var Tabletop = require('tabletop');
var jsonlines = require('jsonlines');
var stringifier = jsonlines.stringify();
var gs_url = 'https://docs.google.com/spreadsheets/d/1zkIeYUXJCLuUpJRYK-WvCVDxyYs9sAtqeR3p_EzjKxs/pubhtml?gid=164906169&single=true';
function onLoad(data, tabletop) {

Highlights:

** Downloading Open Data Philly Datasets**

  • 1707 resources across 350 packages
  • 1446 not marked as an API, so possibly suitable for downloading / archiving
  • Attempting to download those 1446 resulted in 1327 successful downloads and 88 urls that timed / errored out.
  • This produced about 19G files

** Are they already backed up in the Wayback Machine? **

@bibliotechy
bibliotechy / gist:af5c40d7079e495ebf752715f7aa6d0e
Created November 13, 2016 13:04
FCRepo 4 stack trace with custom postgresql jdbc config
SEVERE: Exception sending context initialized event to listener instance of class org.fcrepo.http.commons.FedoraContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'modeshapeRepofactory': Invocation of init method failed; nested exception is org.fcrepo.kernel.api.exception.RepositoryRuntimeException: org.modeshape.jcr.value.ValueFormatException: Error converting "ore:proxyFor_ref" from String to a Name
at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:136)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:408)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1560)
at org.springframework.beans.factory.support.Abstra
@bibliotechy
bibliotechy / playbook.yml
Created June 8, 2016 14:35
Two options for how to do this - in the playbook, or in a local_action. Either way, the downloads directory needs to already exist in your playbook
---
# Complete Vivo server
- hosts: all
become: yes
roles:
- geerlingguy.mysql
- hosts: all
become: yes