Skip to content

Instantly share code, notes, and snippets.

@Dyrcona
Dyrcona / laserdisc_fix.plx
Created July 28, 2015 14:38
A small script to fix DVD and possibly Blu-ray MARC records that say they are laserdisc in the 007.
#!/usr/bin/perl
# ---------------------------------------------------------------
# Copyright © 2015 Merrimack Valley Library Consortium
# Jason Stephenson <jstephenson@mvlc.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
@damphat
damphat / apt-rdepends-tree
Last active December 16, 2023 01:38
debian dependency tree
#! /bin/bash
# Description: show dependency tree
# Author: damphat
if [ $# != 1 ]; then
echo 'Usage: apt-rdepends-tree <package>'
echo 'Required packages: apt-rdepends'
exit 1
fi
anonymous
anonymous / batch_update_example.sql
Created January 4, 2013 16:52
Example of performing batch updates while recording what objects were updated as a result of the batch. This is in addition to the Evergreen auditor schema, which records (by way of a trigger) the state of the objects before they are updated.
-- create a schema to record our batch changes
CREATE SCHEMA tadl_batch;
-- create a table for this set of changes
-- consider an approach with fewer tables
-- and use a batch_name column or similar
CREATE TABLE tadl_batch.acp_lost_in_migration (
id SERIAL PRIMARY KEY,
copy BIGINT NOT NULL,
batchtime TIMESTAMPTZ
@Dyrcona
Dyrcona / reingest_bibs.sql
Last active March 11, 2016 19:06
A simple, little SQL script to reingest bibs in Evergreen.
-- A simple SQL to "reingest" your bib records in Evergreen.
-- Feel free to use it however you like, though the easiest way is to
-- save it into a file and do psql -f filename.
DO $$
DECLARE
flag BOOLEAN;
BEGIN
SELECT enabled INTO flag
FROM config.internal_flag
@Synchro
Synchro / gist:1139429
Created August 11, 2011 11:29
PHP Base-62 encoder/decoder
<?php
/**
* This is an example of a practical encoder and decoder for base-62 data in PHP
* It differs from the majority of examples in that it's fast enough for moderate data sizes, unlike multiprecision converters
* To be practical, base-62 encoding needs to use internal chunking and padding because base-62 does not fit exactly into any integral number of bits
* This means the output is not quite compatible with multiprecision conversions,
* but the encoded data retains all the desirable properties of base-62, so (unlike any base-64 encoding) it's URL, DNS, email address and pathname safe
* @author Marcus Bointon <marcus@synchromedia.co.uk>
* @copyright 2011 Marcus Bointon
* @license http://www.opensource.org/licenses/mit-license.html MIT License
@mjgiarlo
mjgiarlo / opensrf newb
Created October 30, 2010 00:46
Working through "easing gently into opensrf", I can't seem to invoke my method via srfsh
# First, basic system stuff
$ uname -a
Linux cardinal 2.6.35-22-generic #35-Ubuntu SMP Sat Oct 16 20:36:48 UTC 2010 i686 GNU/Linux
$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=10.10
DISTRIB_CODENAME=maverick
DISTRIB_DESCRIPTION="Ubuntu 10.10"