Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python
import re
import sys
e = 0
w = 0
def exxx(m):
global e
e += 1
{
"@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",
@zimeon
zimeon / gist:a4b02fe70b4f3fba0f07681f2422021a
Created January 5, 2018 18:53
Shell session creating LDP-NR with fcrepo4 and inspecting results
simeon@RottenApple ~> curl -i -X POST -H "Content-Type: text/plain" -H "Slug: a" http://localhost:8080/rest --data "hello"
HTTP/1.1 201 Created
Date: Fri, 05 Jan 2018 18:49:14 GMT
ETag: "36d0d1ed6ee9c7d7cad5b5d2970f3f6c490c5857"
Last-Modified: Fri, 05 Jan 2018 18:49:14 GMT
Link: <http://localhost:8080/rest/a/fcr:metadata>; rel="describedby"; anchor="http://localhost:8080/rest/a"
Location: http://localhost:8080/rest/a
Content-Type: text/plain
Content-Length: 28
Server: Jetty(9.2.3.v20140905)
@zimeon
zimeon / test.md
Created August 30, 2017 21:11
How does the `node-solid-server` handle WAC ACLs?

The node-solid-server implements WAC ACLs using simple append of .acl to the resource URI. It seems to consistently return a URI with .acl appended to in Link: <...>; rel="acl" even if the resource being requested does not exist or is already and ACL!

Easy download and run:

mkdir solid
cd solid
npm install -g solid-server
# generate key for local use
openssl genrsa 2048 > localhost.key
{
"thumbnail": {
"format": "image/jpeg",
"height": 480,
"width": 720,
"service": {
"profile": "http://iiif.io/api/image/2/level2.json",
"@context": "http://iiif.io/api/image/2/context.json",
"id": "https://iiif-staging02.lib.ncsu.edu/iiifvi/pets"
},
@zimeon
zimeon / gist:8fadd1fef051ebee0b8b75b8c470b089
Last active October 20, 2016 13:45
Video info.json using approach of describing files/resources that exist
{
"@id": "http://inst.edu/video1/info.json",
// Profile says we are level0 so there is no construction of a URI
"profile": "http://iiif.io/api/video/0/level0.json",
// Here we describe the abstract source
"width": 2000,
"height": 2000,
"duration": 63,
// Here we map certain files that maybe versions of the whole video with
@zimeon
zimeon / iiif_static_test.md
Last active August 29, 2015 14:25
Test of iiif static files with previously problematic image

See zimeon/iiif#4

Image now at https://raw.githubusercontent.com/edsu/mirador-test/gh-pages/001.jpg , grabbed:

simeon@RottenApple iiif>wget https://raw.githubusercontent.com/edsu/mirador-test/gh-pages/001.jpg
--2015-07-23 17:30:45--  https://raw.githubusercontent.com/edsu/mirador-test/gh-pages/001.jpg
Resolving raw.githubusercontent.com... 23.235.39.133
Connecting to raw.githubusercontent.com|23.235.39.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 3589041 (3.4M) [image/jpeg]
@zimeon
zimeon / daily_update.py
Created October 7, 2014 01:04
Code for arXiv resync experiment
#!/usr/bin/env python
"""Update script for arXiv experiment on resync.library.cornell.edu
It is assumed that the files for abs and src will have been
updated before the script is run. The the sequence is:
- build an resourcelist in /arxiv/YYYY-MM-DD/resourcelist.xml etc
- build a changelist in /arxiv/YYYY-MM-DD/changelist.xml etc
- copy resourcelist and changelist to /arxiv/resourcelist.xml, /arxiv/changelist
@zimeon
zimeon / gist:8baf705e983e84f5ab3e
Created July 25, 2014 16:25
IIIF w, size calculation
simeon@RottenApple image_api_size_calc>more 2014-07-25_image_width.py
#!/usr/bin/env python
# In OSD Jon uses:
# width_to_request = int(float(desired_height) / image_height * image_width)
# see https://github.com/IIIF/iiif.io/issues/301
matches = 0
for iw in (1,80,200,1234,5678,10567,678991):
for ih in (1,80,200,1234,5678,10567,678991):
@zimeon
zimeon / gist:11273436
Last active August 29, 2015 14:00
Trying out rdf-4store with Ruby RDF

Goal is to try out 4store plugin for Ruby RDF. Was playing with Ruby 2.1.1 under rvm and assuming RDF already installed. Working on a Mac.

Grab current rdf-4store, seems that last commit was Oct 2013, about half a year ago:

simeon@RottenApple ldcx-play>git clone https://github.com/fumi/rdf-4store.git
Cloning into 'rdf-4store'...
remote: Counting objects: 169, done.
remote: Compressing objects: 100% (98/98), done.
remote: Total 169 (delta 44), reused 169 (delta 44)
Receiving objects: 100% (169/169), 76.71 KiB, done.