Skip to content

Instantly share code, notes, and snippets.

@lawlesst
lawlesst / .gitignore
Last active October 8, 2021 20:45
Sample notebooks for Constellate: https://constellate.org
.ipynb_checkpoints/*
@lawlesst
lawlesst / tesseract-setup.ipynb
Last active June 3, 2021 15:33
Constellate Binder Tesseract
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@lawlesst
lawlesst / .gitignore
Last active July 7, 2020 16:06
tdm-pilot.org gists
datasets/
.ipynb*
@lawlesst
lawlesst / clean_nbs.py
Last active May 21, 2020 11:28 — forked from cmoscardi/clean_nbs.py
Jupyter Notebook Output Cleaning Script
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 March 15, 2019 20:05
Connect RDFLib's SPARQL Store to Amazon Neptune
"""
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 October 17, 2016 02:40
baseball and wikidata fame
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 October 6, 2016 18:59
Lookup UTs in AMR and output to CSV.
"""
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 August 17, 2016 17:58
Config for LDF Server VivoSparqlDatasource
{
"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 August 15, 2016 15:10
Sample call and response for Links AMR web service
<?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 -->
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