Skip to content

Instantly share code, notes, and snippets.

View privatezero's full-sized avatar

Andrew Weaver privatezero

View GitHub Profile
sox 'INPUT.flac' OUTPUT.flac silence 1 0.50 0.1% 1 1.0 0.1% : newfile : restart
pip install pywb
wb-manager init my-web-archive
wb-manager add my-web-archive <path/to/my_warc.warc.gz>
wayback
ls SOURCE | while read FILE ; do target=$(basename "$FILE"); if [ "$(find NEW-LOCATION -iname "$target")" ] ; then echo "found ${target}"; else echo "not found ${target}" ; fi; done > ~/Desktop/results.txt
function checkCollection() {
if ( window.location.href.split('/collection/')[1] != undefined){
var collectionToSearch = window.location.href.split('/collection/')[1].split('/')[0];
collectionButton = document.getElementsByClassName("btn-see-more-less")[0].click();
document.getElementsByName("selectAll")[0].click();
var collectionToSearch = window.location.href.split('/collection/')[1].split('/')[0];
document.getElementsByName(collectionToSearch)[0].click();
collectionButton = document.getElementsByClassName("btn-see-more-less")[0].click();
document.querySelectorAll("[data-id='updateBtn']")[0].click();
}
@privatezero
privatezero / Dspace-item-metadata.sh
Created January 24, 2019 00:16
Dspace-item-metadata
curl 'https://research.libraries.wsu.edu:8443/oai/request?verb=GetRecord&metadataPrefix=xoai&identifier=urn:URN-HERE' | xmlstarlet format --indent-tab > output.xml
-c:v libx264 -x264opts bff
@privatezero
privatezero / osprey capture command
Last active March 14, 2019 21:08
osprey capture command
ffmpeg -f dshow -pixel_format yuyv422 -i video="Osprey-827e MFI Video Device 1":audio="Unbal Input 1 (Osprey-827e 1)" -color_primaries smpte170m -color_trc bt709 -colorspace smpte170m -c:a pcm_s24le -c:v ffv1 -level 3 -g 1 -slices 16 -slicecrc 1 -vf setsar=40/27,setdar=4/3,setfield=bff,fieldorder=bff -y OUTPUT -f nut -vf setsar=40/27,setdar=4/3 - | ffplay -
@privatezero
privatezero / nokogiri_parse.rb
Last active March 25, 2019 20:41
parsing dspace with nokogiri
# xpath to type for xoai
# puts doc.xpath("//record/metadata/metadata/element/*[@name='type']/element/field")[0].content
doc = File.open("TARGET.XML") { |f| Nokogiri::XML(f) }
doc.remove_namespaces!
single_text = Array.new
publisher_text = Array.new
relation_text = Array.new
doc.xpath("//record").each do |record_element|
if (record_element.xpath('metadata/dc/type').count == 1 && record_element.xpath('metadata/dc/type').text == 'Text')
single_text << record_element.xpath('metadata/dc/type').text
var="100"
curl 'http://research.wsulibs.wsu.edu:8080/oai/request?verb=ListRecords&metadataPrefix=oai_dc' | xmlstarlet format -s 2 > dspace-dump_000.xml
while [ $var -lt 13300 ] ; do
echo "Gathering records from number $var"
curl "http://research.wsulibs.wsu.edu:8080/oai/request?verb=ListRecords&resumptionToken=oai_dc////$var" | xmlstarlet format -s 2 >> "dspace-dump_$var.xml"
var=$((var + 100))
done
echo '<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="static/style.xsl"?>
<OAI-PMH xmlns="http://www.openarchives.org/OAI/2.0/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/ http://www.openarchives.org/OAI/2.0/OAI-PMH.xsd">
@privatezero
privatezero / xoai.rb
Last active March 26, 2019 23:44
quick and dirty xoai parse for double text types
doc.xpath("//record/metadata/metadata/element/*[@name='type']/element").each do |line|
if line.xpath("field").count > 1
puts line.xpath("field")[2].content
end
end ; nil
# Delete 'text'
doc.xpath("//record/metadata/metadata/element/*[@name='type']/element").each do |line|
if line.xpath("field").count > 1