Skip to content

Instantly share code, notes, and snippets.

@mark-cooper
mark-cooper / initialize-plugin.sh
Created December 11, 2014 16:32
Make it so archivesspace can find plugin gems by installing gems to the base gems folder
#!/bin/bash
plugin="$1"
export ASPACE_LAUNCHER_BASE="$("`dirname $0`"/find-base.sh)"
cd "$ASPACE_LAUNCHER_BASE/plugins/$plugin"
if [ "$plugin" = "" ]; then
echo "Usage: $0 <plugin name>"
@mark-cooper
mark-cooper / EAD_XML_TO_PDF.md
Created November 4, 2014 17:12
ArchivesSpace EAD XML to PDF

ArchivesSpace EAD XML to PDF

These instructions describe how to do this locally. There are two motivating reasons:

  1. ArchivesSpace Rack time out errors when attempting to export pdf.
  2. Batch pdf processing (assuming batch EAD export not covered here).

Pre-reqs

#!/bin/bash
plugin="$1"
export ASPACE_LAUNCHER_BASE="$("`dirname $0`"/find-base.sh)"
cd "$ASPACE_LAUNCHER_BASE/plugins/$plugin"
if [ "$plugin" = "" ]; then
echo "Usage: $0 <plugin name>"
require_relative 'utils'
Sequel.migration do
up do
$stderr.puts("Adding more types to the list of extent_extent_type enum values")
enum = self[:enumeration].filter(:name => 'extent_extent_type').select(:id)
# additional DACS recommended extent types
@mark-cooper
mark-cooper / permgroups.txt
Created January 30, 2014 00:37
ArchivesSpace: 1.0.4 permissions and groups
ArchivesSpace (v1.0.4) permissions and groups
ROLES:
repository-managers
Managers of the EXAMPLE repository
The ability to manage a given repository
The ability to create and modify the major archival record types
The ability to create and modify event records
The ability to view a given repository
@mark-cooper
mark-cooper / circ_policies.sql
Last active January 4, 2016 09:39
Evergreen ILS: SQL for viewing circulation policies
-- NO LIMIT SETS (example limit to PERM GROUP)
SELECT
m.id, m.active, a.shortname as org_unit, p.name as profile, circ_modifier,
copy_circ_lib, copy_owning_lib, user_home_ou, ref_flag, juvenile_flag,
is_renewal, circulate, d.name as duration, r.name as recurring,
mx.name as max, m.grace_period
FROM config.circ_matrix_matchpoint m
LEFT JOIN actor.org_unit a ON m.org_unit = a.id
LEFT JOIN permission.grp_tree p ON m.grp = p.id
LEFT JOIN config.rule_circ_duration d ON m.duration_rule = d.id
@mark-cooper
mark-cooper / oils_sip_mon.rb
Last active December 21, 2015 00:49
SIP SERVER: band aid monitoring
# BAND AID SIP SERVER MONITOR
class SipServerMonitor
def initialize(opts = {})
@sip = {
start: '/openils/bin/oils_ctl.sh -d /openils/var/run -s /openils/conf/oils_sip.xml -a start_sip',
stop: '/openils/bin/oils_ctl.sh -d /openils/var/run -s /openils/conf/oils_sip.xml -a stop_sip',
pid_file: '/openils/var/run/oils_sip.pid',
pid: nil,
@mark-cooper
mark-cooper / read_only_user.rb
Created June 6, 2013 19:30
POSTGRES: Create read only user
# POSTGRES READ ONLY USER
database = 'evergreen'
username = 'eg_viewer'
password = '1a2b3c4d5e' # something good
schemas = [
'actor',
'asset',
'biblio',
'config',
@mark-cooper
mark-cooper / codes.rb
Created May 29, 2013 18:27
Download LOC country codes
require 'mechanize'
require 'nokogiri'
require 'csv'
agent = Mechanize.new
# download country / language codes from LOC
urls = [
{
url: "http://www.loc.gov/marc/countries/countries_code.html",
@mark-cooper
mark-cooper / isbn_dupes.sql
Last active December 17, 2015 19:19
Evergreen: quick dupe isbn lookup
-- SHOW EVERGREEN DATABASE IDS
-- WHERE 020 'a' value appears more than once
select distinct value as isbn, record
from metabib.real_full_rec
where value in
(
-- get duplicate isbns
select value as isbn
from metabib.real_full_rec