Skip to content

Instantly share code, notes, and snippets.

@mtholder
mtholder / hide_prev.sh
Created January 4, 2023 16:29
server side custom synth hiding
#!/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
@mtholder
mtholder / do-dwca-export.sh
Last active March 4, 2025 17:59
export OTT to Darwin Core - currently without synonyms .
#!/bin/bash
#
# This requires a build of otcetera that from any branch that incorporates:
# https://github.com/OpenTreeOfLife/otcetera/commit/f29521709b60ee2a4a8e754a7c3a111b22761718
# As of the writing of this gist that is only the dwca-dump of otcetera
# See also https://github.com/SpeciesFileGroup/2025_workshop_on_taxon_names
set -x
od="${1}"
inp="${2}"
@mtholder
mtholder / re-export-ott.sh
Created March 4, 2025 18:40
create several OTT DWCa dumps - see comments
#!/bin/bash
#
# Master script using MTH's hard-coded paths used to create darwin core
# archives
# Requires do-dwca-export.sh available from https://gist.github.com/mtholder/f733a75fe1616af1841ded62aadb4f04
# See also https://github.com/SpeciesFileGroup/2025_workshop_on_taxon_names
set -x
od=ott3.7.2-dwca
@mtholder
mtholder / basic_taxa_json_dump.py
Last active July 9, 2025 15:36
pulling taxa from wikidata JSON dump
# Tweaked example script from qwikidata
import sys
import time
from qwikidata.entity import WikidataItem
from qwikidata.json_dump import WikidataJsonDump
from qwikidata.utils import dump_entities_to_json
from subprocess import call
P_IS_INSTANCE_OF = "P31"
Q_TAXON = "Q16521"
@mtholder
mtholder / author_using_qwikidata.py
Last active July 4, 2025 14:42
extract entities with specific entity IDs from the full wikidata JSON dump using https://github.com/kensho-technologies/qwikidata/tree/develop
#Tweaked example script from qwikidata
import sys
import time
from qwikidata.entity import WikidataItem
from qwikidata.json_dump import WikidataJsonDump
from qwikidata.utils import dump_entities_to_json
from subprocess import call
def dump_block_of_taxa(taxa, out_fp):
sys.stderr.write(f"Dumping {len(taxa)} to {out_fp} ...\n")