Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
BASE=http://localhost:8080/$RANDOM
COL=$BASE/memberCollection
curl -X PUT -H "Link: <http://www.w3.org/ns/ldp#BasicContainer>; rel=\"type\"" $BASE && echo
curl -X PUT -H "Link: <http://www.w3.org/ns/ldp#BasicContainer>; rel=\"type\"" $BASE/objects && echo
# create a collection
curl -X PUT -H "Link: <http://www.w3.org/ns/ldp#BasicContainer>; rel=\"type\"" $COL && echo
@barmintor
barmintor / gist:43f9b1ce4f038df562fb
Created May 19, 2015 17:04
Set a log level for ActiveFedora 7.x benchmarking in a Rake task
# initialize the fedora connection if necessary
connection = (ActiveFedora::Base.fedora_connection[0] ||= ActiveFedora::RubydoraConnection.new(ActiveFedora.config.credentials)).connection
# the logger accessor is private
(connection.api.send :logger).level = Logger::INFO
@barmintor
barmintor / gist:6e0a65e0bf3ab4c8cbb9
Created January 30, 2015 20:02
perl soap fedora whatever
#!/usr/bin/perl
use strict;
use warnings;
use Data::Dumper;
use SOAP::Lite (+trace => [qw (debug)], maptype => {});
use constant ENDPOINT => 'https://USER:PASSWORD@HOST:8443/fedora/services/management';
use constant NAMESPACE => 'http://www.fedora.info/definitions/1/0/types/';
@barmintor
barmintor / gist:ccbdfef75a895610ec07
Created May 12, 2014 17:01
script for hyhull install
$ git clone https://github.com/uohull/hyhull.git
$ cd hyhull
$ bundle install
$ git submodule init
$ git submodule update
$ rake db:migrate
@barmintor
barmintor / gist:3316877
Created August 10, 2012 19:01
RELS-INT datastream content for an image with attache derivatives
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:ns0="http://purl.org/dc/terms/" xmlns:ns1="http://www.w3.org/2003/12/exif/ns#" xmlns:ns2="http://xmlns.com/foaf/0.1/">
<rdf:Description rdf:about="info:fedora/ldpd:130508/web850">
<ns0:extent>2611818</ns0:extent>
<ns0:format>image/png</ns0:format>
<ns0:isFormatOf rdf:resource="info:fedora/ldpd:130508/content"/>
<ns1:imageLength>594</ns1:imageLength>
<ns1:imageWidth>850</ns1:imageWidth>
<ns1:resolutionUnit>3</ns1:resolutionUnit>
<ns1:xResolution>354</ns1:xResolution>
<ns1:yResolution>354</ns1:yResolution>
@barmintor
barmintor / gist:3178216
Created July 25, 2012 19:58
RDFXML::Writer is too smart
expected:
<?xml version="1.0"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description rdf:about="info:fedora/test:relsint/DC">
<isMetadataFor xmlns="info:fedora/fedora-system:def/relations-external#" rdf:resource="info:fedora/test:relsint/RELS-INT"/>
</rdf:Description>
<rdf:Description rdf:about="info:fedora/test:relsint/RELS-EXT">
<asserts xmlns="http://projecthydra.org/ns/relations#">FOO</asserts>
</rdf:Description>
<rdf:Description rdf:about="info:fedora/test:relsint/RELS-INT">
@barmintor
barmintor / gist:2586427
Created May 3, 2012 15:20
NPE Warning in CXF WS interface
WARN 2012-05-03 10:26:26.872 [http-8080-2] (PhaseInterceptorChain) Interceptor for {http://fedora-commons.org/2011/07/definitions/types/}Fedora-API-A-MTOM-Service has thrown exception, unwinding now
java.lang.NullPointerException: null
at org.apache.cxf.jaxws.handler.soap.SOAPHandlerInterceptor.createProtocolMessageContext(SOAPHandlerInterceptor.java:263) [cxf-bundle-2.4.0.jar:2.4.0]
at org.apache.cxf.jaxws.handler.soap.SOAPHandlerInterceptor.handleMessageInternal(SOAPHandlerInterceptor.java:163) [cxf-bundle-2.4.0.jar:2.4.0]
at org.apache.cxf.jaxws.handler.soap.SOAPHandlerInterceptor.handleMessage(SOAPHandlerInterceptor.java:126) [cxf-bundle-2.4.0.jar:2.4.0]
at org.apache.cxf.jaxws.handler.soap.SOAPHandlerInterceptor.handleMessage(SOAPHandlerInterceptor.java:71) [cxf-bundle-2.4.0.jar:2.4.0]
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263) [cxf-api-2.4.0.jar:2.4.0]
at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:118) [cxf
@barmintor
barmintor / gist:1854278
Created February 17, 2012 16:38
Checking for AF::Base subclasses without calling .ancestors or creating an enumerator
module ActiveFedora
class ContentModel
# Returns an ActiveFedora Model class corresponding to the given uri if one can be found.
# Returns false if no corresponding model can be found.
def self.uri_to_model_class( uri )
verify_base(rc = Model.from_class_uri(uri)) and rc
end
def self.verify_base klass
return false unless klass.is_a? Class
while (klass = klass.superclass) and klass != ActiveFedora::Base; end
@barmintor
barmintor / gist:1201986
Created September 7, 2011 22:26
Working around the presence of method names on Nokogiri::XML::Builder that may also be in OM templates
def xml_builder_template(extra_opts = {})
extra_attributes = extra_opts.fetch(:attributes, {})
node_options = []
node_child_template = ""
if !self.default_content_path.nil?
node_child_options = ["\':::builder_new_value:::\'"]
node_child_template = " { xml.#{self.default_content_path}( #{OM::XML.delimited_list(node_child_options)} ) }"
else
node_options = ["\':::builder_new_value:::\'"]