Skip to content

Instantly share code, notes, and snippets.

View escowles's full-sized avatar

esmé cowles escowles

View GitHub Profile
#!/bin/sh
curl -X POST -H "Content-Type: application/n-triples" -H "Slug: a2" -d '<> <http://example.com/test> """This has a line break
and ends with a "quote"""" .' http://localhost:8080/rest
@escowles
escowles / disk-clear.sh
Last active October 24, 2018 12:34
fedora-wiper
#!/bin/sh
for i in /var/lib/tomcat7/fcrepo4-data/fedora.binary.directory/*; do
echo $i
rm -rf $i
done
rm -rf /var/lib/tomcat7/fcrepo4-data/[cf]*
@escowles
escowles / child.ttl
Last active October 3, 2018 10:45
fedora_find_inverse_references_by_ordered
@prefix premis: <http://www.loc.gov/premis/rdf/v1#> .
@prefix test: <info:fedora/test/> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix ns004: <http://www.iana.org/assignments/relation/> .
@prefix ns003: <http://www.openarchives.org/ore/terms/> .
@prefix ns002: <http://bad.com/> .
@prefix ns001: <http://example.com/predicate/> .
@prefix xsi: <http://www.w3.org/2001/XMLSchema-instance> .
@prefix xmlns: <http://www.w3.org/2000/xmlns/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@escowles
escowles / figgy-staging.log
Last active August 1, 2018 20:20
branchNodesSelectable-error.log
TypeError: value is null[Learn More] URLDataProvider.js:24
URLDataProvider</URLDataProvider.prototype.set URLDataProvider.js:24
createUV/< https://figgy-staging.princeton.edu/uv/helpers.js:54:9
[1]</</</BaseComponent</BaseComponent.prototype.fire base-component.js:41
BaseExtension</BaseExtension.prototype.fire BaseExtension.js:546
BaseExtension</BaseExtension.prototype.create/< BaseExtension.js:158
dispatch https://figgy-staging.princeton.edu/uv/lib/offline.js:3:7485
add/r.handle https://figgy-staging.princeton.edu/uv/lib/offline.js:3:5603
trigger https://figgy-staging.princeton.edu/uv/lib/offline.js:4:4816
trigger/< https://figgy-staging.princeton.edu/uv/lib/offline.js:4:5320
#!/bin/sh
AUTH="-u fedoraAdmin:fedoraAdmin"
BASE="http://localhost:8080/rest/$RANDOM"
SUBJ="$BASE#me"
# create a direct container with a hash uri resource
echo creating direct container
curl $AUTH -X PUT -H "Content-type: text/turtle" -d "<$SUBJ> <http://purl.org/dc/title> 'my thing' ." $BASE
echo
@escowles
escowles / gist:41aa739415dcea1943e781e4ff03d492
Created April 23, 2018 20:36
rspec spec/views/scanned_resources/order_manager.html.erb_spec.rb
E, [2018-04-23T16:31:22.719402 #90669] ERROR -- ddtrace: [ddtrace] (/Users/escowles/.rbenv/versions/2.3.4/lib/ruby/gems/2.3.0/gems/ddtrace-0.11.2/lib/ddtrace/contrib/http/patcher.rb:71:in `rescue in patch') Unable to apply net/http integration: method `initialize' not defined in Net::HTTP
Randomized with seed 12806
FF
Failures:
1) valhalla/base/order_manager.html.erb renders correctly
Failure/Error: render
#!/bin/sh
# create a basic container
curl -X PUT http://localhost:8080/rest/basic
# create an indrect container with ldp:contains as the membership resource
curl -X PUT -H "Content-type: text/turtle" -d "<> a <http://www.w3.org/ns/ldp#IndirectContainer>; <http://www.w3.org/ns/ldp#membershipResource> <http://localhost:8080/rest/basic>; <http://www.w3.org/ns/ldp#hasMemberRelation> <http://www.w3.org/ns/ldp#contains>; <http://www.w3.org/ns/ldp#insertedContentRelation> <http://www.openarchives.org/ore/terms/proxyFor> ." http://localhost:8080/rest/basic/indirect
# create a member
curl -X POST -H "Content-type: text/turtle" -d "<> <http://www.openarchives.org/ore/terms/proxyFor> <http://localhost:8080/rest> ." http://localhost:8080/rest/basic/indirect/
@escowles
escowles / fixity.md
Last active January 13, 2018 12:48
fcrepo-4.7.4: fixity and versioning

create a data file and calculate checksum

$ head -c 8192 /dev/zero > file1.dat
$ shasum file1.dat

0631457264ff7f8d5fb1edc2c0211992a67c73e6  file1.dat

transmission fixity failure

Request Data: "[{\"id\":\"0f54a54f-53ce-49a9-9dcb-9f6fba8e748b\",\"join_id_ssi\":\"id-0f54a54f-53ce-49a9-9dcb-9f6fba8e748b\",\"created_at_dtsi\":\"2017-12-12T15:35:40Z\",\"internal_resource_tsim\":\"FileSet\",\"internal_resource_ssim\":\"FileSet\",\"internal_resource_tesim\":\"FileSet\",\"title_tsim\":\"image 1\",\"title_ssim\":\"image 1\",\"title_tesim\":\"image 1\",\"file_metadata_tsim\":\"serialized-{\\\"internal_resource\\\":\\\"FileMetadata\\\",\\\"created_at\\\":\\\"2017-12-12T15:34:24Z\\\",\\\"updated_at\\\":\\\"2017-12-12T15:34:24Z\\\",\\\"read_groups\\\":[],\\\"read_users\\\":[],\\\"edit_users\\\":[],\\\"edit_groups\\\":[],\\\"id\\\":{\\\"id\\\":\\\"cdfad16f-7fe8-4799-a5f0-a9cbf7bdbf17\\\"},\\\"label\\\":[\\\"00000001.tif\\\"],\\\"mime_type\\\":[\\\"image/tiff\\\"],\\\"height\\\":[],\\\"width\\\":[],\\\"checksum\\\":[],\\\"original_filename\\\":[\\\"00000001.tif\\\"],\\\"file_identifiers\\\":[{\\\"id\\\":\\\"disk:///opt/repository/files/cd/fa/d1/cdfad16f7fe84799a5f0a9cbf7bdbf17/00000001.tif\\\"}],\\\
  1. Check if a resource is versionable and discover the TimeMap/LDPCv
    1. HEAD on the LDPR: Link rel="type" http://fedora.info/definitions/fcrepo#VersionedResource indicates versioning support, Link rel="timemap" points to LDPCv/TimeMap
  2. Check if we can create versions
    1. OPTIONS on LDPCv/TimeMap: Allow: POST indicates that versions can be created
  3. Create a new version
    1. POST to LDPCv/TimeMap with Memento-Datetime header and body to create a historic version with the specified body and datetime
    2. POST to LDPCv/TimeMap with a body and no Memento-Datetime header to create a version with the specified body and the current datetime
    3. POST to LDPCv/TimeMap with Memento-Datetime header and no body to create a historic version with the current state of the LDPRv and the specified datetime
    4. POST to the LDPCv/TimeMap with no Memento-Datetime header or body to create version with current state of the resource and the resource's last-modified date as the datetime
  4. List existing v