Skip to content

Instantly share code, notes, and snippets.

View ahankinson's full-sized avatar

Andrew Hankinson ahankinson

View GitHub Profile
import logging
log = logging.getLogger(__name__)
def get_dimensions(img_path: str) -> Tuple[int, int]:
"""
Returns a tuple (w, h) of an image with a given ID. Reads the w/h data directly
from the JPEG 2000 header.
:param img_path: a path to a JPEG 2000 image
@ahankinson
ahankinson / example-usage.ts
Last active December 15, 2022 11:27
Verovio Worker and WorkerProxy
let worker = new Worker("verovio-worker.js");
let verovio = new WorkerProxy(worker);
let setOptions = await verovio.setOptions({});
let loadSuccess = await verovio.loadData(somestring);
This gist demonstrates a SVG Rendering Bug in Firefox 100+
@ahankinson
ahankinson / README.md
Last active February 24, 2020 15:59
NginX configuration for IIIF Presentation and Image APIs

Some of these configurations may be more useful than others, but basically we have:

  • A single virtual host configuration for your IIIF domain
  • A common nginx.conf file
  • A cache configuration file for setting up a front-end static cache of backend services
  • Some proxy parameters for passing values to upstream services
  • 'Battle-tested' CORS configurations based on feedback from users of Bodleian IIIF services (and where we were getting it wrong!)

The comments in each of the files should provide more specifics about individual configuration directives.

Two possible versions of an inventory file are shown. The first (inventory1.jsonld) contains all information in the 'Version' object. "members" within the version provide an inventory of the member files for that version, while "state" provides the full state of the object at that version.

inventory2.jsonld is the original proposal. "members" in the Version object track all the members of the object (analagous to "state" in the previous proposal. In this example they are addressed by digest, but they could also be addressed by filepath.

Considerations:

  • How do we represent the "state" of the object at a given version?
  • If a user requests "version 4", what do they get back? A list of filepaths?
@ahankinson
ahankinson / inventory1.jsonld
Created September 5, 2018 21:22
Two possible versions of an inventory file are shown. The first (inventory1.jsonld) contains all information in the 'Version' object. "mem
{
"@context": "https://ocfl.io/v1.0/",
"id": "urn:ark:/12345/bbb11ccc22",
"type": "Object",
"hashAlgorithm": "sha512",
"versions": [{
"type": "Version",
"id": "#v1",
"created": "2014-01-01T12:00:00Z",
"message": "Initial version",
{
@type: "sc:AnnotationList",
@context: "http://iiif.io/api/presentation/2/context.json",
@id: "https://alpha.diamm.ac.uk/sources/202/list/57047/"
resources: [{
@type: "oa:Annotation",
resource: {
chars: {
folio_end: "8",
composition: {
@ahankinson
ahankinson / gist:ef9aa9c454d383baf5f7
Created May 19, 2015 07:44
Music Encoding 2015: SMuFL and Stylesheets questions for discussion

SMUFL Questions for Discussion

SMuFL includes specifications for hundreds of glyphs

  • How can we avoid duplicating SMuFL in MEI?

SMuFL is not a font-family, nor a Reserved Unicode Area

  • How can we refer to a SMuFL code in a generic way (i.e., without specifying a font-name implementation)?
  • The Private Use Area is used by other font projects, such as the Medieval Unicode Font Initiative

How can we avoid creating conflicts or ambiguities when using them?

/*!
* Loads the data for a URL request and executes a handler block when the request completes
* or fails.
*
* @param aRequest A CPURLRequest object
* @param aQueue A CPOperationQueue object (currently not implemented)
* @param completionHandler A function passed in that will receive the request once it has returned.
*
* The completion handler will receive three arguments:
*<pre>
<?xml version="1.0" encoding="UTF-8" ?>
<mei meiversion="2013" xmlns="http://www.music-encoding.org/ns/mei" xmlns:xlink="http://www.w3.org/1999/xlink">
<meiHead>
<fileDesc>
<titleStmt>
<title>Qui souhaitez</title>
<composer>Certon</composer>
<respStmt>
<persName/>
</respStmt>