Skip to content

Instantly share code, notes, and snippets.

@alanmackenzie
alanmackenzie / linux-kconfig-grep
Last active January 5, 2016 23:47
Hate it when you can't find the right menu tree for an option in gconfig.
grep -A 25 -R --include='Kconfig' 'LOCALVERSION_AUTO' *
python -t -t -m py_compile file.py
@alanmackenzie
alanmackenzie / scrape_datacite_doi.py
Created March 20, 2017 16:22
DOI to institution look up
"""
Credits: Carl Wilson (Open Preservation Foundation)
Using the search root for datacite: https://search.datacite.org/data-centers?member-id=bl&page=
I iterate through the data centres (in this case those that are BL assigned), then for each data centre I visit the
works page, e.g. https://search.datacite.org/data-centers/bl.ads and cycle through the works. I stop
(usually on the first) when I can scrape the doi from something like
https://doi.org/10.15124/19B43AA8-744A-404B-A8FF-7B0F931BF6D3 where the 3rd part of the URL is the DOI, in this case
for York University.
// Not valid JSON due to comments.
// The majority of the fields are missing.
{
"messageHeader": {
"id": "9e8f3cfc-29c2-11e7-93ae-92361f002671",
// Values here are different from the documentation.
"messageType": "MetadataRecordCreate"
aws s3 ls s3://${BUCKET} --recursive | awk '{print "http://${DOMAIN_NAME}/"$4 }'