Skip to content

Instantly share code, notes, and snippets.

@baskaufs
baskaufs / foaf.ttl
Created February 26, 2016 17:54
FOAF vocabulary in Turtle (from the RDF/XML, not the RDFa)
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>.
@prefix xsd: <http://www.w3.org/2001/XMLSchema#>.
@prefix xml: <http://www.w3.org/XML/1998/namespace>.
@prefix owl: <http://www.w3.org/2002/07/owl#>.
@prefix vs: <http://www.w3.org/2003/06/sw-vocab-status/ns#>.
@prefix foaf: <http://xmlns.com/foaf/0.1/>.
@prefix wot: <http://xmlns.com/wot/0.1/>.
@prefix dc: <http://purl.org/dc/elements/1.1/>.
@baskaufs
baskaufs / 1979.1185P.json
Created January 23, 2023 20:07
Simple test manifest
{
"@context": "http://iiif.io/api/presentation/2/context.json",
"@id": "https://iiif-manifest.library.vanderbilt.edu/gallery/1979/1979.1185P.json",
"@type": "sc:Manifest",
"label": "Ask Your Dealer For Shoes Like These",
"description": "print by Artist Unknown",
"logo": "https://iiif.library.vanderbilt.edu/iiif/3/vanderbilt_logo.png/full/!100,100/0/default.jpg",
"attribution": "Provided by Vanderbilt University Fine Arts Gallery",
"metadata": [
{
{
"@id": "https://texashistory.unt.edu/ark:/67531/metapth974141/manifest/",
"@context": "http://iiif.io/api/presentation/2/context.json",
"@type": "sc:Manifest",
"label": "[Galveston City Company Records: 1838-1857]",
"description": "Ledger containing meeting minutes, proceedings, and other organizational documentation and records for the Galveston City Company, based in Galveston, Texas, starting in 1838 and ending with minutes for a meeting of the board of directors on October 22, 1857.",
"metadata": [
{
"label": "title.addedtitle",
"value": "Records of the Organization and Proceedings of the Galveston City Company: 1838"
@baskaufs
baskaufs / nested_directories.py
Created September 9, 2022 18:25
Loop throrough directories and subdirectories to access every file
import os
base_path = '.'
directories = os.listdir(base_path + '/')
# directory outer loop
for directory in directories[:3]: # delete the index (square brackets and contents) to do all
if directory =='xml_jsonl_converter-master': # skip this directory, which doesn't have files to be processed
continue
if os.path.isdir(base_path + '/' + directory):
print(directory)
@baskaufs
baskaufs / nested_subdirectories.py
Created September 9, 2022 14:26
loop through nested subdirectories
directories = os.listdir('./')
for directory in directories:
print(directory)
if not '.' in directory:
subdirectories = os.listdir(directory)
for subdirectory in subdirectories:
if not '.' in subdirectory:
print(subdirectory)
files = os.listdir(subdirectory)
for file in files:
@baskaufs
baskaufs / signing-test.py
Created January 26, 2017 02:36
Fixed function to generate OAuth signature using HMAC-SHA1 hashing algorithm in Python 3
# HMAC-SHA1 hashing algorithm to generate the OAuth signature
# using code hacked from https://gist.github.com/binaryatrocity/7079332cab038da1394d
from base64 import b64encode # needed for create_signature function
import hmac # needed for create_signature function
import hashlib
import binascii
# here's the first function hacked from the binaryatrocity GIST:
def create_signature(secret_key, string):
@baskaufs
baskaufs / color-anova-example.csv
Last active April 28, 2022 22:35
electroretinogram example for ANOVA with randomized complete block
block color response
a red 1.9
b red 2.6
c red 3.4
d red 0.8
e red 5.3
f red 1.5
g red 4.5
h red 2.6
i red 1.16
@baskaufs
baskaufs / code.py
Last active April 1, 2022 13:32
CircuitPython code to use with VCNL 4040 proximity and lux sensor
import time
import board
import busio
import adafruit_vcnl4040
i2c = busio.I2C(board.SCL1, board.SDA1)
sensor = adafruit_vcnl4040.VCNL4040(i2c)
while True:
print("Proximity:", sensor.proximity)
@baskaufs
baskaufs / mermaid.md
Last active March 21, 2022 02:00
test of mermaid diagram
  graph TD;
    a[standard proposed]-->b[executive decision];
    b-->c[expert review];
    c-->d[executive decision];
@baskaufs
baskaufs / boot.py
Created February 21, 2022 14:41
boot script for switch-based control of QT Py RP2040 memory read/write
import board
import digitalio
import storage
switch = digitalio.DigitalInOut(board.D0)
switch.direction = digitalio.Direction.INPUT
switch.pull = digitalio.Pull.UP
# Connecting D0 to ground makes switch.value False
storage.remount("/", switch.value)