This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$0=10 (Step pulse time, microseconds) | |
$1=25 (Step idle delay, milliseconds) | |
$2=0 (Step pulse invert, mask) | |
$3=0 (Step direction invert, mask) | |
$4=0 (Invert step enable pin, boolean) | |
$5=0 (Invert limit pins, boolean) | |
$6=0 (Invert probe pin, boolean) | |
$10=1 (Status report options, mask) | |
$11=0.010 (Junction deviation, millimeters) | |
$12=0.002 (Arc tolerance, millimeters) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh | |
setopt extendedglob | |
echo "\nMedia type breakdown for CC0 objects:\n" | |
for file in ^index.txt | |
do | |
cat $file |jq -c '. | select((.type=="edanmdm") and (.content.descriptiveNonRepeating.online_media.mediaCount>0) and (.content.descriptiveNonRepeating.online_media.media[].usage.access=="CC0")) | .content.descriptiveNonRepeating.online_media.media[].type' | |
done | sort | uniq -c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh | |
# This script needs to be run inside the Smithsonian institution folder (where all the 00.txt, 01.txt, ... files are) | |
setopt extendedglob | |
echo "Records of type ead_component: " | |
for file in ^index.txt | |
do | |
cat $file |jq -c '. | select(.type=="ead_component") | .id' | wc -l | |
done | awk '{sum += $1} END {print sum}' | |
echo "\nRecords of type edanmdm with images: " |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def counter(stream): | |
reduce stream as $s ({}; .[$s|tostring] += 1); | |
counter(.[] | select(."_source".sourceResource.type) | select(."_source".sourceResource.type[] | test("^image|physical object")) | ."_source".rights) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"op": "core/column-addition", | |
"description": "Create column query string at index 5 based on column NOTICE - PUB using expression grel:join(with(value.split(\" \"),a,forEach(a,v,v.chomp(\",\").match(/([a-zA-Z\\u00C0-\\u017F-']{4,}|\\d{4})/)[0])),\" \")+\" \"+forNonBlank(cells[\"NOTICE - AUT\"],v,v.value.match(/(.* |)(\\w{2,})/)[1],\" \")", | |
"engineConfig": { | |
"mode": "row-based", | |
"facets": [ | |
{ | |
"mode": "text", | |
"caseSensitive": false, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"op": "core/column-addition-by-fetching-urls", | |
"description": "Create column ISBNdb Price at index 2 by fetching URLs based on column pISBN using expression grel:\"http://isbndb.com/api/v2/json/YOURKEY/prices/\"+toString(floor(value))", | |
"engineConfig": { | |
"mode": "row-based", | |
"facets": [] | |
}, | |
"newColumnName": "ISBNdb Price", | |
"columnInsertIndex": 2, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# weather-int.py - get average temperature data from the World Bank ClimateWeb API | |
# | |
# Usage: python weather-int.py XXX where XXX is a ISO 3-letter country code | |
# e.g. CAN, USA, GBR | |
# | |
# Collectively written during the Feb 5-6 Software Carpentry workshop | |
# at the University of Toronto iSchool. | |
# https://swcarpentry.github.io/2015-02-05-toronto | |
# Edited by Thomas Guignard <tom@timtom.ca> for the Code4Lib Monday Night code club | |
# Version: March 30, 2015 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
tar czf path/to/backup/dir/webbackup_`date +%Y_%m_%d`.tgz -X backup-exclude.txt -C path/to/public_html public_html/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export PATH=/usr/local/bin:$PATH | |
# for use within Automator, the path to usr/local/bin has to be added | |
# so that faad and lame can be used | |
# last argument is the output path - add a trailing slash | |
outputpath=${@:$#}"/" | |
# start numbering depending on the # of files already in that directory | |
count=$(ls -1 $outputpath | wc -l) |