Skip to content

Instantly share code, notes, and snippets.

View rococodogs's full-sized avatar

Anna Malantonio rococodogs

View GitHub Profile
#!/usr/bin/env bash
if [ -z $1 ]; then
echo "please pass me a version number!"
exit 1
fi
VERSION="$1"
DIR="node-v$VERSION-linux-x64"
URL="https://nodejs.org/dist/v$VERSION/$DIR.tar.gz"
@rococodogs
rococodogs / nd-json.php
Created February 29, 2016 13:06
loop to handle nd-json (mostly b/c I forget how to handle stdin in php)
<?php
while ( $raw_line = fgets(STDIN) ) {
$line = trim($raw_line);
$parsed = json_decode($line);
// do something with yr object
}
@rococodogs
rococodogs / checked-out-sorted-by-barcode.sh
Created February 16, 2016 15:08
sort All_Checked_out_items report by patron barcode
gawk -v n=+3 -f checked-out/items-due.awk examples/*All_Checked* | gawk 'BEGIN{FS="|";OFS="|"}NR == 1 {print $0; next} { print $0 | "sort --ignore-case --field-separator=\"|\" -k 12"}' | gawk -f general/to-json.awk
<?php
/**
* proxy to access HathiTrust bib api via https
*/
if (!isset($_SERVER['QUERY_STRING'])) {
echo "{}";
exit();
}

Quick one-liners for course-reserves-related reports w/ WMS.

  • Count items on reserve:
awk 'BEGIN { FS="|"; COUNT = 0 } END { printf "There are %d items on reserve\n", COUNT } $4 ~ /Reserves/ { COUNT++ }' <filename>
  • Count personal items on reserve:

Whole wound wrote at whose to style in

She suspicion dejection saw instantly

Required is debating extended wondered as do

Improve up musical welcome he

@rococodogs
rococodogs / hours.js
Last active December 2, 2015 18:32
new library hours js
var proxyPath = 'http://libappdev.muhlenberg.edu/hours-proxy'
var todaysPath = '/api_hours_today.php?iid=814&format=json'
var weeksPath = '/api_hours_grid.php?iid=814&format=json&weeks=1'
var yearsPath = '/api_hours_grid.php?iid=814&format=json&weeks=52'
var $hoursWidget = $('#hoursWidget')
// these are on every page
$.get(proxyPath + todaysPath, handleTodaysHours)
$.get(proxyPath + weeksPath, handleWeeksHours)
@rococodogs
rococodogs / Dockerfile
Created November 11, 2015 15:54
Dockerfile that replaces the default nginx page with a sweet ascii grim reaper that says BUMMER
FROM nginx
RUN echo -e "<\!doctype html><html><head><meta name=\"viewport\" content=\"width=device-width, initial-scale=1\"><title>bummer</title><style>body{background-color:#000;}pre{color:#aaa;}</style></head><body><\!-- stole this from http://chris.com/ascii/index.php?art=creatures/grim%20reapers --><pre>\n ...\n ;::::;\n ;::::; :;\n ;:::::\' :;\n ;:::::; ;.\n ,:::::' ; OOO\\n ::::::; ; OOOOO\\n ;:::::; ; OOOOOOOO\n ,;::::::; ;' / OOOOOOO\n ;:::::::::\\\`. ,,,;. / / DOOOOOO\n .';:::::::::::::::::;, / / DOOOO\n ,::::::;::::::;;;;::::;, / / DOOO\n;\`::::::\`\'::::::;;;::::: ,#/ / DOOO\n:\`:::::::\`;::::::;;::: ;::# / DOOO\n::\`:::::::\`;:::::::: ;::::# / DOO\n\`:\`:::::::\`;:::::: ;::::::#/ DOO\n :::\`:::::::\`;; ;:::::::::## OO\n ::::\`:::::::\`;::::::::;:::# OO\n
@rococodogs
rococodogs / course-reserves-inventory.awk
Last active November 9, 2015 22:28
baby's first awk script
# an awk script for extracting course reserves items
# (major props to http://ferd.ca/awk-in-20-minutes.html for the inspiration/confidence)
#
# usage
# awk -f <this file name> <report filename> > reserves-inventory.txt
#
# OCLC inventory headers (as of 11/9/2015)
# ------------------
# 1 Inst_Symbol
# 2 Holding Location
@rococodogs
rococodogs / oclc-notification-test.js
Created October 28, 2015 15:55
code used to test the OCLC Notification API
var WSKey = require('oclc-wskey')
var https = require('https')
var fs = require('fs')
var wskey = {
public: 'give me a public key!',
secret: 'give me a secret key!'
}
var key = new WSKey(wskey.public, wskey.secret);