Skip to content

Instantly share code, notes, and snippets.

Steve Baskauf baskaufs

Block or report user

Report or block baskaufs

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@baskaufs
baskaufs / file.txt
Created Nov 20, 2019
A file for class
View file.txt
This is my file
@baskaufs
baskaufs / vandy_schools.json
Created Oct 29, 2019
Schools and colleges of Vanderbilt University and their Wikidata IDs
View vandy_schools.json
[
{
"label":"Blair School of Music",
"wikidataId":"Q4924165"
},
{
"label":"College of Arts & Science",
"wikidataId":"Q7914451"
},
{
View gis.txt
Creating & editing a new vector layer
Code snippets follow along
vl = QgsVectorLayer("Point", "temp", "memory")
from qgis.PyQt.QtCore import QVariant
pr = vl.dataProvider()
pr.addAttributes([QgsField("name", QVariant.String),
@baskaufs
baskaufs / vu_checker.py
Created Sep 9, 2019
Python script to use Wikidata Query Service to find Vanderbilt employees who have created works
View vu_checker.py
import requests
def getWikidata(query):
endpointUrl = 'https://query.wikidata.org/sparql'
# The endpoint defaults to returning XML, so the Accept: header is required
r = requests.get(endpointUrl, params={'query' : query}, headers={'Accept' : 'application/sparql-results+json'})
data = r.json()
statements = data['results']['bindings']
return statements
@baskaufs
baskaufs / query.url
Created Sep 8, 2019
Query Microsoft Academic Graph (http://ma-graph.org/sparql) for papers by Gary Sulikowski
View query.url
http://ma-graph.org/sparql?default-graph-uri=&query=PREFIX+rdf%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F1999%2F02%2F22-rdf-syntax-ns%23%3E%0D%0APREFIX+magc%3A+%3Chttp%3A%2F%2Fma-graph.org%2Fclass%2F%3E%0D%0APREFIX+dcterms%3A+%3Chttp%3A%2F%2Fpurl.org%2Fdc%2Fterms%2F%3E%0D%0APREFIX+foaf%3A+%3Chttp%3A%2F%2Fxmlns.com%2Ffoaf%2F0.1%2F%3E%0D%0APREFIX+fabio%3A+%3Chttp%3A%2F%2Fpurl.org%2Fspar%2Ffabio%2F%3E%0D%0APREFIX+prism%3A+%3Chttp%3A%2F%2Fprismstandard.org%2Fnamespaces%2F1.2%2Fbasic%2F%3E%0D%0APREFIX+xsd%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F2001%2FXMLSchema%23%3E%0D%0APREFIX+org%3A+%3Chttp%3A%2F%2Fwww.w3.org%2Fns%2Forg%23%3E%0D%0APREFIX+datacite%3A+%3Chttp%3A%2F%2Fpurl.org%2Fspar%2Fdatacite%2F%3E%0D%0A%0D%0Aselect+distinct+%3Fname+%3Fdoi+%3Ftitle%0D%0Awhere+%7B%0D%0A%3Fperson+a+%3Chttp%3A%2F%2Fma-graph.org%2Fclass%2FAuthor%3E.%0D%0A%3Fperson+foaf%3Aname+%3Fname.%0D%0A%3Fperson+foaf%3Aname+%22Gary+A.+Sulikowski%22%5E%5Exsd%3Astring.%0D%0A%3Fperson+org%3AmemberOf+%3Forg.%0D%0A%3Forg+foaf%3Aname+%22Vanderbilt+University%22%5E%5Exs
@baskaufs
baskaufs / convert.py
Created Feb 19, 2019
convert tape codes into database codes
View convert.py
import csv
monthDict = {'jan':'01', 'feb':'02', 'mar':'03', 'apr':'04', 'may':'05', 'jun':'06', 'jul':'07', 'aug':'08', 'sep':'09', 'oct':'10', 'nov':'11', 'dec':'12'}
def convertTapeCode(tape):
# has problems when the day doesn't have two digits
year = tape[7:11]
monthAbbrev = tape[0:3]
monthNumber = monthDict[monthAbbrev.lower()]
day = tape[4:6]
network = tape[12:15]
@baskaufs
baskaufs / scrape.py
Last active Jan 21, 2019
Python script to scrape chang.org
View scrape.py
import requests # best library to manage HTTP transactions
import csv # library to read/write/parse CSV files
from bs4 import BeautifulSoup # web-scraping library
acceptMime = 'text/html'
searchTerm = 'pollution'
baseUri = 'https://www.change.org/search?q='+searchTerm
r = requests.get(baseUri, headers={'Accept' : acceptMime})
View gist:78ba7892c8e4a8525be156944756fa22
prefix dcterms: <http://purl.org/dc/terms/>
prefix skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX lawd: <http://lawd.info/ontology/>
PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
SELECT * WHERE
{SELECT DISTINCT (COUNT(?place) AS ?count1)
WHERE {
graph <http://pelagios>
{
?place a lawd:Place.
View 423025-brief.ttl
<https://pleiades.stoa.org/places/423025> a <http://www.w3.org/2004/02/skos/core#Concept>;
dcterms:title "Roma";
dcterms:description "The capital of the Roman Republic and Empire.";
skos:altLabel "Roma"@la,
"Rome"@en,
"Ῥώμῃ"@grc;
skos:inScheme <https://pleiades.stoa.org/places>;
dcterms:bibliographicCitation "",
"Alföldi 1962 ",
"Carandini and Carafa 2017 ",
View alb-brief.ttl
<http://id.loc.gov/vocabulary/iso639-2/alb> a skos:Concept ;
skos:prefLabel "Albanisch"@de,
"Albanian"@en,
"albanais"@fr ;
skos:altLabel "Albanian",
"Albanisch",
"albanais" ;
skos:inScheme <http://id.loc.gov/vocabulary/iso639-2> ;
skos:related <http://id.loc.gov/vocabulary/iso639-2/sqi> ;
skos:exactMatch <http://id.loc.gov/vocabulary/iso639-1/sq>,
You can’t perform that action at this time.