Skip to content

Instantly share code, notes, and snippets.

@lawlesst
lawlesst / .gitignore
Last active Jul 7, 2020
tdm-pilot.org gists
View .gitignore
datasets/
.ipynb*
@lawlesst
lawlesst / clean_nbs.py
Last active May 21, 2020 — forked from cmoscardi/clean_nbs.py
Jupyter Notebook Output Cleaning Script
View clean_nbs.py
import io
import sys
from nbformat import read, write
# Handle either stdin or a filename
if __name__ == '__main__':
for filename in sys.argv[1:]:
print(filename, file=sys.stderr)
@lawlesst
lawlesst / rdflib_neptune.py
Created Mar 15, 2019
Connect RDFLib's SPARQL Store to Amazon Neptune
View rdflib_neptune.py
"""
RDFLib SPARQLStore wrapper for use with Neptune
"""
import sys
import os
import warnings
from rdflib import URIRef, Graph, ConjunctiveGraph
@lawlesst
lawlesst / top10_by_language_pages.csv
Last active Oct 17, 2016
baseball and wikidata fame
View top10_by_language_pages.csv
We can make this file beautiful and searchable if this error is corrected: It looks like row 10 should actually have 5 columns, instead of 4. in line 9.
name,pages,rank,wikidata,baseball_ref
Babe Ruth,55,1,http://www.wikidata.org/entity/Q213812,http://www.baseball-reference.com/players/r/ruthba01.shtml
Ichiro Suzuki,52,2,http://www.wikidata.org/entity/Q600,http://www.baseball-reference.com/players/s/suzukic01.shtml
Yogi Berra,46,3,http://www.wikidata.org/entity/Q367566,http://www.baseball-reference.com/players/b/berrayo01.shtml
Jackie Robinson,42,4,http://www.wikidata.org/entity/Q221048,http://www.baseball-reference.com/players/r/robinja02.shtml
Joe DiMaggio,40,5,http://www.wikidata.org/entity/Q297142,http://www.baseball-reference.com/players/d/dimagjo01.shtml
Jim Thorpe,39,6,http://www.wikidata.org/entity/Q221482,http://www.baseball-reference.com/players/t/thorpji01.shtml
Hank Aaron,36,7,http://www.wikidata.org/entity/Q215777,http://www.baseball-reference.com/players/a/aaronha01.shtml
Mickey Mantle,30,8,http://www.wikidata.org/entity/Q345004,http://www.baseball-reference.com/players/m/mantlmi01.shtml
Alex Rodriguez,29,9,http://www.wikidata.org/entity/Q558664
@lawlesst
lawlesst / incites_batch_lookup.py
Last active Oct 6, 2016
Lookup UTs in AMR and output to CSV.
View incites_batch_lookup.py
"""
Look up batches of UTs in InCites.
Run as:
$ python incites_batch_lookup.py sample_file.csv outputfile.csv
"""
import csv
@lawlesst
lawlesst / vivo-sparql-datasource-config.json
Last active Aug 17, 2016
Config for LDF Server VivoSparqlDatasource
View vivo-sparql-datasource-config.json
{
"title": "Linked Data Fragments server",
"datasources": {
"local-vivo": {
"title": "VIVO",
"type": "VivoSparqlDatasource",
"description": "local VIVO",
"settings": {
"endpoint": "http://localhost:8080/vivo/api/sparqlQuery",
@lawlesst
lawlesst / amr.xml
Last active Aug 15, 2016
Sample call and response for Links AMR web service
View amr.xml
<?xml version="1.0" encoding="UTF-8" ?>
<request xmlns="http://www.isinet.com/xrpc41" src="app.id=InternalVIVODemo">
<fn name="LinksAMR.retrieve">
<list>
<!-- authentication -->
<map>
<val name="username">xxx</val>
<val name="password">xxx</val>
</map>
<!-- what to to return -->
View players_all.csv
We can't make this file beautiful and searchable because it's too large.
birthCity,birthState,birthYear,lat,long
Aberdeen,MD,1935,39.515856,-76.170180
Aberdeen,MD,1869,39.515856,-76.170180
Aberdeen,MS,1901,33.828299,-88.554741
Aberdeen,SD,1977,45.464678,-98.468104
Aberdeen,SD,1893,45.464678,-98.468104
Aberdeen,SD,1959,45.464678,-98.468104
Aberdeen,SD,1943,45.464678,-98.468104
Aberdeen,WA,1959,46.976677,-123.809718
Aberdeen,WA,1914,46.976677,-123.809718
@lawlesst
lawlesst / ldf-hdt-heroku.md
Last active Sep 26, 2015
Notes on running ldf-server on Heroku with an HDT backend
View ldf-hdt-heroku.md

September 25, 2015

Steps to run ldf-server on Heroku with an HDT backend.

  • Read the Node troubleshooting guide from Heroku for background.
  • Run the commands in the Start with a Blank Slate section of the guide.
  • Add package.json to your git repository if it isn't already.
  • For my project, I had to explicitly add hdt - 1.2.2 as a dependendency.

package.json

@lawlesst
lawlesst / petl.md
Last active Sep 27, 2015
Quick intro to petl for VIVO Apps & Tools working group.
View petl.md