Skip to content

Instantly share code, notes, and snippets.

View ruthtillman's full-sized avatar

Ruth ruthtillman

View GitHub Profile
@ruthtillman
ruthtillman / chat-gpt-ogl-apology.md
Created January 13, 2023 19:36
Chat GPT OGL apology

Asking ChatGPT3

Input

Write an apology from Wizards of the Coast and Hasbro for announcing a change to the open gaming license that angered many D&D players and other game designers

Output

Dear D&D players and game designers,

@ruthtillman
ruthtillman / wikidata_entity_Q57983524.ttl
Created September 26, 2022 13:43
The Wikidata Entity Data for Ruth Tillman, Q57983524, as of 2022-09-26 about 09:32:00T-04.
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix ontolex: <http://www.w3.org/ns/lemon/ontolex#> .
@prefix dct: <http://purl.org/dc/terms/> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix wikibase: <http://wikiba.se/ontology#> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
@prefix schema: <http://schema.org/> .
@prefix cc: <http://creativecommons.org/ns#> .
@ruthtillman
ruthtillman / worldcat_entity_E39PBJh8RBvdBvpxqFm6CFptrq.json
Created September 26, 2022 13:38
The WorldCat Entity Data for Ruth Tillman E39PBJh8RBvdBvpxqFm6CFptrq as of 2022-09-26 about 09:25:00T-04
{
"props": {
"pageProps": {
"data": [
{
"entity": {
"id": "E39PBJh8RBvdBvpxqFm6CFptrq",
"labels": {
"ca": {
"language": "ca",
@ruthtillman
ruthtillman / parsing-tweets.py
Created December 9, 2019 22:24
starter python script
import json, csv
with open('all_tweets.csv', 'w', newline='') as CSVfile:
fieldnames= ["id","tweet","created_at"]
writer = csv.DictWriter(CSVfile, fieldnames=fieldnames)
writer.writeheader()
with open("../tweet.js", "r") as myJSON:
recorddata = json.loads(myJSON.read())
for item in recorddata:
the_ID = '"' + item["id"] + '"'
@ruthtillman
ruthtillman / python-xml-to-csv-snippets.md
Created November 11, 2019 17:58
Python snippets for parsing XML into CSV

Make sure you've got these:

from lxml import etree
import csv

The snippets will all be related to parsing XPaths with etree vs. CSV stuff.

A useful function to test how many nodes match a single xpath. e.g. if you have 3 dc:creator fields at 0, 1, 2, it will return 3. This is super helpful if you need to set up a condition for processing 1 element vs. multiples.

@ruthtillman
ruthtillman / lccns-to-mads.md
Last active June 28, 2019 15:00
curling LCCNs to madsrdf

curl http://id.loc.gov/authorities/names/nb2015017302.madsrdf.rdf -o nb2015017302.rdf

The difference here is you have to know what kind of authority you're querying. So you'll need to do names, subjects, etc. separately, whereas for the lccn query, it's straight-up lccn.

Working from a simple list:

names: for lccn in nb2015017302 n89223874; do curl http://id.loc.gov/authorities/names/$lccn.madsrdf.rdf -o $lccn.rdf; sleep 3; done

subjects: for lccn in sh2016002835 sh86003754; do curl http://id.loc.gov/authorities/subjects/$lccn.madsrdf.rdf -o $lccn.rdf; sleep 3; done

@ruthtillman
ruthtillman / lccn-to-marcxml.md
Last active November 7, 2019 20:37
Curling LCCNs to MARCXML

curl https://lccn.loc.gov/sh2018002914/marcxml -o sh2018002914.xml

Working from a simple list:

for lccn in nb2015017302 sh2018002914 n89223874; do curl https://lccn.loc.gov/$lccn/marcxml -o $lccn.xml; sleep 1; done

Separate the lccns with a single space. Added a second of sleep to avoid getting shut out.

If it gets longer, consider making a full bash script, as below:

@ruthtillman
ruthtillman / parse-string-authors.php
Last active July 7, 2019 22:06
Parse authors C4LJ Wordpress
<?php
/*
where our site saves the authors as a string created by a meta field.
and this string is entered as anything from "Ruth Tillman and Becky Yoose" to "Ruth Tillman & Becky Yoose" to "Ruth Tillman, A. Scarlet Galvan, Becky Yoose" and must be parsed
run substitutions so names are all ', ' separated
exploding single name with no separator makes a one-item array
*/
$authors = get_the_author(); // gets the author as a string but doesn't echo, which the_author() does.
@ruthtillman
ruthtillman / desired-bl-features.md
Last active May 16, 2019 16:57
Public gist of identified blacklight features and examples.

These were originally collected as research/benchmarking for Penn State's Blacklight catalog. They range from core features like the call number browse, which will enable us to see materials across 30+ libraries displayed on a single "shelf," to desired "someday" enhancements like the incorporation of knowledge cards and digital collections display.

Search Partial Subjects from Item Record

Catalogers generally apply the most specific subject heading possible. This heading is made up of increasingly more specific parts, when the most general might be helpful in finding results. If someone has found a book on African-American quiltmakers, for example, and the subject is African American quiltmakers—Michigan—Biography, how can we make it easy for them to search only for African American quiltmakers?

Princeton: https://catalog.princeton.edu/catalog/1968400

Relationships Between Bound-Withs

@ruthtillman
ruthtillman / marked-by-ashes.md
Last active March 6, 2019 21:08
Marked by Ashes, by Walter Brueggemann

Marked by Ashes by Walter Brueggemann

Ruler of the Night, Guarantor of the day ...
This day — a gift from you.
This day — like none other you have ever given, or we have ever received.
This Wednesday dazzles us with gift and newness and possibility.
This Wednesday burdens us with the tasks of the day, for we are already halfway home
halfway back to committees and memos,
halfway back to calls and appointments,
halfway on to next Sunday,