Skip to content

Instantly share code, notes, and snippets.

View timhodson's full-sized avatar

Tim Hodson timhodson

View GitHub Profile
@timhodson
timhodson / use-access-token
Last active April 19, 2016 08:41
Make a request to the API using your token
curl -X GET -H "Authorization: Bearer $YOUR_TOKEN_HERE"\
-H "Cache-Control: no-cache"\
"https://rl.talis.com/2/$TENANT_SHORT_CODE/lists/$LIST_GUID"
@timhodson
timhodson / request-access-token.sh
Last active April 18, 2016 15:52
Request an access_token
# Assuming that TALIS_API_CLIENT_ID and TALIS_API_CLIENT_SECRET are set in your environment
curl -sS -u $TALIS_API_CLIENT_ID:$TALIS_API_CLIENT_SECRET\
https://users.talis.com/oauth/tokens\
-d 'grant_type=client_credentials'
@timhodson
timhodson / persona-token
Last active April 19, 2016 20:00
Shell script to get a Talis Persona Token to authenticate calls to the Talis OAuth APIs
#!/bin/bash
# Usage: persona-token <client_id> <client_secret>
# you are advised to add your client secret to an environment variable so that you are not leaving secrets in your command history.
PERSONA_HOST='users.talis.com'
CLIENT=$1
SECRET=$2
TOKEN=$(curl -sS -u $CLIENT:$SECRET http://${PERSONA_HOST}/oauth/tokens -d 'grant_type=client_credentials'|sed -e 's/{"access_token":"\(.*\)","expires_in":\(.*\),"token_type":"\(.*\)","scope":"\(.*\)"}/\1/g')
echo $TOKEN
@timhodson
timhodson / TADC-bulk-import-validator-install.md
Last active March 8, 2016 11:11
Install Talis Aspire Digitised Content Bulk Import Validator

Installation

This is currently only built for Unix based operating systems such as Mac OSX and Linux

Make sure you already have Python 2.7 and pip installed

pip install tadc-import-validator
@timhodson
timhodson / gist:033f635421628cc9361f
Last active September 25, 2021 04:43
Install yaz-client on a mac
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

brew install yaz

yaz-client will then be available and you can use it like this:

run the program and you get a Z> prompt.

@timhodson
timhodson / loadJqueryBookmarklet
Last active December 30, 2015 03:29
Javascript boomarklet to load jquery on any page which doesn't already have it.
javascript:if(!window.jQuery||confirm('Overwrite\x20current\x20version?\x20v'+jQuery.fn.jquery))(function(d,s){s=d.createElement('script');s.src='https://ajax.googleapis.com/ajax/libs/jquery/1.8/jquery.js';(d.head||d.documentElement).appendChild(s)})(document);
@timhodson
timhodson / getDOIfiles
Created December 2, 2013 16:00
Get files from crossref for any DOI in a .ris file. That newline in the sed command is supposed to be there
#!/bin/bash
#usage: ./getDOIfiles myRisFile.ris
if [[ -z $CROSSREF_PID ]]
then
echo "CROSSREF_PID is not set in your env"
exit
fi
@timhodson
timhodson / es.sh
Created November 17, 2012 16:47 — forked from aaronshaf/es.sh
Install ElasticSearch on Ubuntu 12.04
cd ~
sudo apt-get update
sudo apt-get install unzip curl python-software-properties openjdk-7-jre -y
wget https://github.com/downloads/elasticsearch/elasticsearch/elasticsearch-0.19.2.tar.gz -O elasticsearch.tar.gz
tar -xf elasticsearch.tar.gz
rm elasticsearch.tar.gz
sudo mv elasticsearch-* elasticsearch
sudo mv elasticsearch /usr/local/share
@timhodson
timhodson / es.sh
Created October 23, 2012 19:14 — forked from jdorfman/es.sh
Install ElasticSearch on Ubuntu 10.10-11.04
cd /tmp/
sudo apt-get update
sudo apt-get install unzip curl python-software-properties -y
#sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
sudo add-apt-repository ppa:ferramroberto/java
sudo apt-get update
sudo apt-get install sun-java6-jre sun-java6-plugin -y
wget https://github.com/downloads/elasticsearch/elasticsearch/elasticsearch-0.18.7.tar.gz -O elasticsearch.tar.gz
tar -xf elasticsearch.tar.gz
@timhodson
timhodson / gist:2302411
Created April 4, 2012 15:08
loop through files and feed contents to a script to process them
# where patterns are in files numbered like pattern_file_01.txt
for pattern in `ls pattern_file_??.txt`
do
STRING=`cat $pattern`
php -f myCleverScipt.php -- $STRING
done
# where patterns are single lines of a single file
while read line