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/sh | |
set -x | |
d=prev-`date +"%d-%b-%Y"` | |
if ! test -d "$d" ; then | |
mkdir "$d" || exit | |
fi | |
if ! test -d "${d}/results" ; then | |
mkdir "${d}/results" || exit | |
fi | |
if ! test -d "${d}/wrappers" ; then |
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 | |
curl 'http://www.timetree.org/references' > studies.html | |
grep citation_data studies.html | sed -E 's:.*citation_data/::' | sed -E 's/".*//' > ids.txt | |
for i in `cat ids.txt` ; do | |
echo $i | |
if ! test -f "${i}.tre" ; then | |
python grab.py "$i" > "${i}.tre" || exit 1 | |
fi | |
sleep 2 | |
done |
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
#!/usr/bin/env python | |
import requests | |
import sys | |
durl = 'http://www.timetree.org/ajax/newick/publishedtree/download' | |
for i in sys.argv[1:]: | |
url = 'http://www.timetree.org/api/widget/citation_data/{i}'.format(i=i) | |
s = requests.Session() | |
r = s.get(url) | |
nr = s.post(durl, data={'export': 'newick', 'rank': 'na'}) | |
nr.raise_for_status() |
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 | |
if ! test -d cruft ; then | |
mkdir cruft | |
fi | |
for i in ott*.tre ; do | |
j=`echo ${i} | sed -E 's/^ott//' | sed -E 's/\.tre//'` | |
echo $j >&2 | |
tail -n1 ${i} > cruft/tax.tre | |
ntax=`otc-degree-distribution cruft/tax.tre 2>&1 | tail -n2 | head -n1 | awk '{print $1}'` | |
nsoln=`otc-degree-distribution ../subproblem_solutions/${i} 2>&1 | tail -n2 | head -n1 | awk '{print $1}'` |
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
#!/usr/bin/env python3 | |
"""Tool to compress tree_slice_comparison JSON | |
otc-explain-phylo-diffs writes a form of this JSON in which multiple | |
adjacent slices of the tree can have the same topology for each | |
of the two trees that were compared. | |
This tool merges adjacent slices that are not differing in topology | |
to produces a terser representation that is easier to display | |
Roughly speaking, the schema of the JSON is: |
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 | |
n="$1" | |
if test -z $n ; then | |
echo "Expecting a machine name for the opentreeoflife.org domain as first arg" | |
exit 1 | |
fi | |
if test -z $2 ; then | |
u=admin | |
else | |
u="${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
#!/bin/bash | |
n=${1} | |
if test -z $n ; then | |
echo "Takes a number argument n that, as ot${n}.opentreeoflife.org should be the machine to update" | |
exit 1 | |
fi | |
u=${2} | |
if test -z $u ; then | |
u=admin | |
fi |
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 | |
i="${1}" | |
if test -z $i ; then | |
echo "Number like 51 for ot51 needed as an arg" | |
exit 1 | |
fi | |
echo "fetching cert from ot$i to compare to a local copy of a cert from ot50" | |
if echo | openssl s_client -servername ot${i}.opentreeoflife.org -connect ot${i}.opentreeoflife.org:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > ot${i}-certificate.crt | |
diff ot50-certificate.crt ot${i}-certificate.crt ; then | |
echo "Success" |
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
#!/usr/bin/env python3 | |
def func(arg): | |
a_var.append(1) | |
loc_a_var = arg | |
b_var = list(arg) | |
print('func({} with id: {} and ids: {})'.format(repr(arg), id(arg), [id(i) for i in arg])) | |
print(' locals: {}'.format({k: id(v) for k, v in locals().items() if not k.startswith('__')})) | |
print(' globals: {}'.format({k: id(v) for k, v in globals().items() if not k.startswith('__')})) |
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
#!/usr/env python | |
""" Example of wrapping a call to gnparser from python | |
See https://gitlab.com/gogna/gnparser#command-line | |
Adapted based on instructions on | |
https://medium.com/learning-the-go-programming-language/calling-go-functions-from-other-languages-4c7d8bcc69bf | |
""" | |
import ctypes | |
import json | |
lib = ctypes.cdll.LoadLibrary("./libgnparser.so") |
NewerOlder