Skip to content

Instantly share code, notes, and snippets.

View nickdos's full-sized avatar

Nick dos Remedios nickdos

View GitHub Profile
@nickdos
nickdos / caab_names_images_merge.py
Last active May 26, 2020 02:46
CAAB names and images from ALA
import urllib.request
import json
import csv
# pull out names, imageID, image URL, etc., from ALA occurrences API
url = "https://biocache-ws.ala.org.au/ws/occurrences/search?q=data_resource_uid:dr660&pageSize=5000"
req = urllib.request.Request(url)
r = urllib.request.urlopen(req).read()
content = json.loads(r.decode('utf-8'))
counter = 0
@nickdos
nickdos / Dwc_terms_biocache.sh
Last active May 14, 2020 09:29
Shell scripts for biocache using JQ
# find all DwC terms in index/fields
curl -s https://biocache-ws.ala.org.au/ws/index/fields | jq -r '.[] | select(.dwcTerm != null) | .dwcTerm '
curl -s "https://biocache-ws.ala.org.au/ws/index/fields" | jq -r '.[] | select(.dwcTerm != null) | "\(.name)|\(.dwcTerm)" '
#!/usr/local/bin/bash
#
# Script to generate distinct values and counts for DwC fields in the ALA (CSV output)
# Requires the jq tool to be installed - see https://stedolan.github.io/jq/
# Requires BASH v.4+
#
# Author: Nick dos Remedios <nick.dosremedios@csiro.au> 2018-07-04
#
# requested fields:
#
@nickdos
nickdos / collectory-doi-counts.sh
Last active April 22, 2020 00:22
Collectory GBIF DOI citations lookup
#!/usr/local/bin/bash
#
# Iterate over list of GBIF DOI keys from data_resource table and get a count of the
# distinct publication citations via GBIF API by storing each citation DOI (ID) in an
# associative array and then reading the length of the this array.
#
# Requires BASH version > 4 and JQ command line tool (https://github.com/stedolan/jq)
#
# SQL: select gbif_registry_key from data_resource where gbif_registry_key <> '';
#
@nickdos
nickdos / collectory-sql-script-1.sh
Last active December 18, 2019 10:07
BASH script to analyse data in Collectory
#!/bin/bash
# https://unix.stackexchange.com/a/295528
# get list of fields:
# mysql -u root -ppassword -D collectory -s -e "describe data_resource;" (paste into Excel and copy first column)
#
# run as ./collectory-sql-script-1.sh data_resource_fields.txt > data_resource_fields.csv
TABLE="data_hub"
USER="root" # change to your DB user
@nickdos
nickdos / index.html
Last active August 25, 2019 02:32
ALA WMS with Google Maps API 2018
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<style type="text/css">
html { height: 100% }
body { height: 100%; margin: 0px; padding: 0px }
#map_canvas { height: 100% }
</style>
@nickdos
nickdos / .block
Last active September 2, 2020 01:10
Demo ALA map
license: apache-2.0
height: 800
@nickdos
nickdos / index.html
Last active March 1, 2016 22:15
ALA map legend generator
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>ALA map legend generator</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">
<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap-theme.min.css">
@nickdos
nickdos / README.md
Last active May 26, 2020 23:28
Get list of commits for change log in GitHub (via latest release change page)

Browser bookmark

  • create a bookmark with a URL:
javascript:Array.from(document.getElementsByClassName("link-gray")).filter(x=>x.getAttribute('title')!=null).reduce((c,i)=>c+'* '+i.getAttribute('title').replace(/[\n\r]+/g," - ")+'<br>',"");
  • view the project's releases page
  • under the most recent release find the link that looks like N commits to master since this release and follow the link (noting the current version number for later)
  • run the bookmark from the bookmark menu
  • copy the MD text on the screen
  • "draft a new release" and paste the MD text into the release description
@nickdos
nickdos / README.md
Last active August 29, 2015 14:06
Pigeonhole demo

Pigeonhole Demo

A species identification tool/widget that narrows down an identification based on a location and higher taxa hints.