Skip to content

Instantly share code, notes, and snippets.

Andrew Weaver privatezero

Block or report user

Report or block privatezero

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@privatezero
privatezero / archive.sh
Created Jun 19, 2019
testing for wget/way back
View archive.sh
wget -nd -p -k -K -H -r -l2 https://web.archive.org/web/19971016042159id_/http://www.wsu.edu/ --convert-links --warc-file=wsu-homepage-1997 -D 'web.archive.org'
View bwf-meta-loop.rb
require 'json'
require 'yaml'
user_input = ARGV[0]
conf_file = ARGV[1]
meta_edit_path = File.dirname("#{conf_file}") + '/wsumetaedit.rb'
conf_data = YAML::load_file(conf_file)
if File.directory?(user_input)
wave_list = Dir.glob("#{user_input}/**/*.wav")
@privatezero
privatezero / xoai.rb
Last active Mar 26, 2019
quick and dirty xoai parse for double text types
View xoai.rb
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
View dpace-dump.sh
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 / nokogiri_parse.rb
Last active Mar 25, 2019
parsing dspace with nokogiri
View nokogiri_parse.rb
# 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
@privatezero
privatezero / osprey capture command
Last active Mar 14, 2019
osprey capture command
View 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 -
View Dspace-item-metadata.sh
curl 'https://research.libraries.wsu.edu:8443/oai/request?verb=GetRecord&metadataPrefix=xoai&identifier=urn:URN-HERE' | xmlstarlet format --indent-tab > output.xml
View van-adv-search-test.js
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();
}
View Verify-transfer
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
You can’t perform that action at this time.