Skip to content

Instantly share code, notes, and snippets.

View chriskeene's full-sized avatar

Chris Keene chriskeene

View GitHub Profile
@chriskeene
chriskeene / Alma.php
Last active August 27, 2015 14:32
Vufind Alma.php sample first attempt getHolding code
<?php
$start_time = MICROTIME(TRUE);
//error_reporting(0);
function curlMultiRequest($urls, $options = array()) {
$ch = array();
$results = array();
$mh = curl_multi_init();
foreach($urls as $key => $val) {
$ch[$key] = curl_init();
@chriskeene
chriskeene / rules.diff
Last active August 29, 2015 13:57
Diff of rules.xml file for importing Eprints DC data
11c11
< <conditionCode>21743174</conditionCode>
---
> <conditionCode>15451998</conditionCode>
18c18
< <sourceTag>dc:type</sourceTag>
---
> <sourceTag>dc:format</sourceTag>
21,23c21,102
< <conditionCode>21743176</conditionCode>
<OAI-PMH xmlns="http://www.openarchives.org/OAI/2.0/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/ http://www.openarchives.org/OAI/2.0/OAI-PMH.xsd">
<responseDate>2014-03-20T09:20:17Z</responseDate>
<request verb="GetRecord" identifier="oai:sro.sussex.ac.uk:47853" metadataPrefix="oai_dc">http://sro.sussex.ac.uk/cgi/oai2</request>
<GetRecord>
<record>
<header>
<identifier>oai:sro.sussex.ac.uk:47853</identifier>
<datestamp>2014-03-17T09:19:25Z</datestamp>
<setSpec>7374617475733D707562</setSpec>
<setSpec>7375626A656374733D4A</setSpec>
@chriskeene
chriskeene / pnx record for eprints.xml
Last active August 29, 2015 13:57
pnx record for eprints
<record xmlns="http://www.exlibrisgroup.com/xsd/primo/primo_nm_bib" xmlns:sear="http://www.exlibrisgroup.com/xsd/jaguar/search">
<control>
<sourcerecordid>7014</sourcerecordid>
<sourceid>44SUS_EPR_DS</sourceid>
<recordid>44SUS_EPR_DS7014</recordid>
<sourceformat>DC</sourceformat>
<sourcesystem>Other</sourcesystem>
</control>
<display>
<type>Article</type>
<display>
<type>Article</type>
<title>Discovery services: next generation of searching scholarly information</title>
<creator>&lt;span class="searchword">Keene&lt;/span>, Chris</creator>
<publisher>United Kingdom Serials Group</publisher>
<creationdate>2011-07</creationdate>
<format>application/pdf</format>
<identifier>http://sro.sussex.ac.uk/7014/1/17_Key_Issue.pdf; &lt;span class="searchword">Keene&lt;/span>, Chris (2011) Discovery services: next generation of searching scholarly information. Serials, 24 (2). pp. 193-196. ISSN 0953-0460</identifier>
<subject>ZA4050 Electronic information resources; ZA4450 Databases</subject>
<description>The new breed of resource discovery services is an evolutionary step forward in providing library users with a ‘one-stop shop’ where they can find information sources for their research. They provide a single search box that can search a library’s online and physical content including articles, books, journals, newspaper articles, e-books, specialist collections and more. T
@chriskeene
chriskeene / primoaspire.js
Last active September 2, 2015 10:23
Show Aspire lists links in Primo
$(function() {
////////////////////////////////////////////
// Aspire Reading Lists
// Get reading lists this item appears on.
// baseurl - url of Aspire tenancy
// outputstringprefix - html to add to front of list items in the Primo links list
// outputstringsuffix - html to add to end of list items in the Primo links list
@chriskeene
chriskeene / Alma.php
Created September 2, 2015 12:36
Alma get live holdings availability for vufind
<?php
protected function curlMultiRequest($urls) {
$ch = array();
$results = array();
$mh = curl_multi_init();
foreach($urls as $key => $val) {
$ch[$key] = curl_init();
curl_setopt($ch[$key],CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch[$key], CURLOPT_URL, $val);
//curl_setopt ($ch[$key], CURLOPT_FAILONERROR,1);
@chriskeene
chriskeene / gist:5533427
Last active December 17, 2015 02:09
improved 'get the current load'
#!/bin/sh
loadaverage=`uptime | awk -F"," '{print $4;}' | sed 's/^.*: //g' | sed 's/...$//g'`
if test $loadaverage -gt 7
then
echo "load is " $loadaverage
uptime
/opt/scratch/proclist.sh >> loadout8.txt
top -b -n1 >> /opt/scratch/top.log
fi
@chriskeene
chriskeene / gist:6278409
Last active December 21, 2015 08:29
Select all rows for a Financial year grouped by month, with a running total for the given year, and a all time running total. The underlying table stores dd/mm/yy in separate int fields.
SELECT Count(*) as "new items", e.datestamp_month, e.datestamp_year,
(select count(*) from eprint
where ((e.datestamp_year >= datestamp_year AND e.datestamp_month >= datestamp_month)
OR (e.datestamp_year > datestamp_year))
and `eprint_status` = "archive"
) AS "all time running total",
(select count(*) from eprint
where ((e.datestamp_year = 2012 AND e.datestamp_year = datestamp_year AND datestamp_month > 7 AND datestamp_month <= e.datestamp_month )
OR (e.datestamp_year = 2013 AND ((datestamp_year = 2012 AND datestamp_month > 7)
OR (datestamp_year = 2013 AND datestamp_month <= e.datestamp_month))
@chriskeene
chriskeene / purchase order
Created February 26, 2014 16:07
simply jquery javascript purchase order form
<p>Access the <a href="/library/reports/purchaseform.php">OLD purchase order form here.</a></p>
<script>
$(document).ready(function(){
// from http://stackoverflow.com/questions/19578111/how-to-add-clone-form-fields-using-jquery-and-increment-ids-and-names
// this will add a new row of fields each time user clicks 'add extra line' button
//We will be using an unique index number for each new instance of the cloned form
var item_number_form_index=0;
//When the button is clicked (or Enter is pressed while it's selected)