Skip to content

Instantly share code, notes, and snippets.

@ostephens
ostephens / arduino-3-button-piano
Created November 23, 2012 18:41
Arduino 3 button piano code
/* Heavily based on http://ardx.org/src/circ/CIRC06-code.txt
* and also http://ardx.org/src/circ/CIRC07-code.txt
* Circuit information at http://www.oomlout.com/oom.php/products/ardx/circ-06
* and http://www.oomlout.com/oom.php/products/ardx/circ-07
* may also help
*
* The calculation of the tones is made following the mathematical
* operation:
*
* timeHigh = period / 2 = 1 / (2 * toneFrequency)
@ostephens
ostephens / References cleartemp
Created November 24, 2012 00:00
Procedure to clear references from RefWorks a/c via api
/**
* Removes all references from temp Refworks account that have not been modified for 30 minutes
* Then removes all empty folders
* Used by cron to clear down RefWorks temp account
*/
public static function cleartemp() {
GLOBAL $SESSION;
$return = "";
//kill any previous api sessions
@ostephens
ostephens / KB+ AACR Master
Created June 6, 2013 14:38
Copy of AACR Master file for KB+
SO Name,American Association of Cancer Research:Master:2013:OS1,,,,,,,,,,,,,,,,
SO Identifier,American Association of Cancer Research_Master_2013_OS1,,,,,,,,,,,,,,,,
Provider,American Association of Cancer Research,,,,,,,,,,,,,,,,
Package Identifier,American Association of Cancer Research:Master:2013:OS1,,,,,,,,,,,,,,,,
Package Name,American Association of Cancer Research:Master:2013:OS1,,,,,,,,,,,,,,,,
Agreement Term Start Year,01/01/2013,,,,,,,,,,,,,,,,
Agreement Term End Year,31/12/2013,,,,,,,,,,,,,,,,
Consortium,,,,,,,,,,,,,,,,,
publication_title,ID.issn,ID.eissn,date_first_issue_online,num_first_vol_online,num_first_issue_online,date_last_issue_online,num_last_vol_online,num_last_issue_online,ID.kbart_title_id,embargo_info,coverage_depth,coverage_notes,publisher_name,ID.doi,platform.host.name,platform.host.url,platform.admin.name
AACR Annual Meeting Education Book,1943-6475,,01/04/2005,,,,,,,,fulltext,,American Association of Cancer Research,,Cancer Prevention Journals Portal,http://educationbook.aacrjou
@ostephens
ostephens / extract-coref-issn
Last active December 21, 2015 16:49
GREL (Google Refine Expression Language) to extract ISSN from the GOKb Co-referencing service. Gives appropriate errors if multiple records or multiple ISSNs in GOKb Co-reference Service response
if(
length(value.parseJson()["records"])>1,
"Multiple Records match that identifier, check CRED (Web UI) for errors",
with(
filter(value.parseJson()["records"][0]["sameAs"],v,v["namespace"]=="issn"),
issns,
if(length(issns)>1,"Multiple ISSNs for one Title": ","") + forEach(issns,v,v["identifier"]).join(",")
)
)
)
@ostephens
ostephens / gist:7633203
Last active December 29, 2015 06:59
Common SPARQL prefixes
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX dct: <http://purl.org/dc/terms/>
@ostephens
ostephens / gist:7633222
Created November 24, 2013 22:23
Simplest SPARQL Query
SELECT *
WHERE {
?subject ?predicate ?object
}
LIMIT 10
@ostephens
ostephens / gist:7633236
Created November 24, 2013 22:24
Find triples where the BNB URI for Jane Austen is the Object
SELECT *
WHERE {
?subject ?predicate <http://bnb.data.bl.uk/id/person/AustenJane1775-1817>
}
LIMIT 10
@ostephens
ostephens / gist:7633258
Last active December 29, 2015 06:59
Find 10 URIs where the BNB URI for Jane Austen is the subject and the predicate is dc:creator
SELECT *
WHERE {
?book <http://purl.org/dc/terms/creator> <http://bnb.data.bl.uk/id/person/AustenJane1775-1817>
}
LIMIT 10
@ostephens
ostephens / gist:7633289
Created November 24, 2013 22:27
Example of using PREFIX of 'dct': Find 10 URIs where the BNB URI for Jane Austen is the subject and the predicate is dct:creator
PREFIX dct: <http://purl.org/dc/terms/>
SELECT *
WHERE {
?subject dct:creator <http://bnb.data.bl.uk/id/person/AustenJane1775-1817>
}
LIMIT 10
@ostephens
ostephens / gist:7633297
Created November 24, 2013 22:28
Example of using PREFIX of 'banana': Find 10 URIs where the BNB URI for Jane Austen is the subject and the predicate is banana:creator
PREFIX banana: <http://purl.org/dc/terms/>
SELECT *
WHERE {
?subject banana:creator <http://bnb.data.bl.uk/id/person/AustenJane1775-1817>
}
LIMIT 10