Skip to content

Instantly share code, notes, and snippets.

View peterstadler's full-sized avatar

Peter Stadler peterstadler

View GitHub Profile
@peterstadler
peterstadler / ranges.json
Created April 15, 2014 09:40
Proposal for a SMuFL ranges.json in addition to the current meta data files
{
"U+E000–U+E00F": {
"desc": "Staff brackets and dividers",
"start": "U+E000",
"end": "U+E00F"
},
"U+E010–U+E02F": {
"desc": "Staves",
"start": "U+E010",
"end": "U+E02F"
@peterstadler
peterstadler / example-chamisso_2.xml
Last active August 29, 2015 14:06
A simple example for an alternative <ct:correspDesc> context and structure
<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="https://raw.github.com/TEI-Correspondence-SIG/correspDesc/master/proposal_2.rng" type="application/xml" schematypens="http://relaxng.org/ns/structure/1.0"?>
<TEI xmlns="http://www.tei-c.org/ns/1.0"
xmlns:ct="http://wiki.tei-c.org/index.php/SIG:Correspondence/task-force-correspDesc">
<teiHeader>
<fileDesc>
<titleStmt>
<title>Letter from Adelbert von Chamisso to Louis de La Foye</title>
<title type="sub">Example TEI document with the inclusion of the proposed ct:correspDesc element for the encoding of correspondence specific meta data</title>
<respStmt>
@peterstadler
peterstadler / tei-database-rebuild.sh
Created September 15, 2014 10:14
updating p5subset.xml at the TEI's eXist db with curl
#!/bin/sh
LOCAL_PATH_P5SUBSET=/var/www/vhosts/tei-c.org/projects/tei/web/Vault/P5/current/xml/tei/odd/p5subset.xml
REMOTE_PATH_P5SUBSET=localhost:8080/exist/rest/db/TEI/p5subset.xml
LOCAL_PATH_INDEX_CONFIGURATION=/var/www/vhosts/tei-c.org/projects/tei/web/Vault/P5/current/xml/tei/xquery/index.xconf
REMOTE_PATH_INDEX_CONFIGURATION=localhost:8080/exist/rest/db/system/config/db/TEI/index.xconf
EXIST_USER=
EXIST_USER_PASS=
# All the parameters above can and shall be overwritten by a config file
xquery version "3.1";
declare namespace tei="http://www.tei-c.org/ns/1.0";
(: location of the old translation spreadsheet – translated via oxGarage to TEI :)
declare variable $local:spreadsheet := doc('/db/apps/TEI/tei-de-i18n.xml');
(: location of the TEI ODD customizations :)
declare variable $local:customizations := collection('/db/apps/TEI/odd')//tei:schemaSpec;
(: location of p5subset.xml:)
xquery version "1.0";
declare function local:upload() {
let $filename := request:get-uploaded-file-name('file')
return
<results>
<message>File {$filename} has been stored.</message>
</results>
@peterstadler
peterstadler / cmif2kml.xqm
Last active February 10, 2022 10:17
XQuery module for transforming CMIF files to KML
xquery version "3.1" encoding "UTF-8";
(:~
: XQuery module for extracting place information in KML from a CMIF file
:
: CMIF is the Correspondence Metadata Interchange format,
: see http://correspsearch.net/index.xql?id=participate_cmi-format
: The exported KML flavor is based on the europeana connect KML specification,
: see https://www.dropbox.com/s/httk62myn2tsi4p/M3.3.2_eConnect_KML_Specification_v1.0_UGOE.pdf
:)
@peterstadler
peterstadler / check-gnds.sh
Last active December 10, 2019 07:36
Check Beacon File for outdated IDs
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Script for checking GND IDs.
# 1. Grab all GNDs from the beacon file
# 2. Check every GND by making a HEAD request and see whether the returned status code is 303
import httplib
from urlparse import urlparse
#!/usr/bin/env python3
# this script adds new (old) versions to the TEI zenodo space
# it assumes the zip archives in the current folder along with
# the readme files. Naming convention is `tei-x.x.x.zip` for the
# archives and `readme-x.x.x.html.xml`(!) for the readme files.
# NB: The readme files (which are to be found in the current release)
# need to be transformed first by tei2zenodo-readme.xsl
import requests
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="http://www.w3.org/1999/xhtml"
xpath-default-namespace="http://www.w3.org/1999/xhtml"
version="2.0">
<!--
XSL script for transforming TEI readme files to Zenodo descriptions
-->
@peterstadler
peterstadler / make-stylesheets.sh
Last active December 17, 2019 13:16
use Docker to build the TEI Stylesheets locally
#!/bin/sh
# Docker image to use for building the Stylesheets and TEI Guidelines
#IMAGE=teic/teidev-docker
IMAGE=teic/jenkins
# local path to the TEI Stylesheets repo you cloned from https://github.com/teic/stylesheets
STYLESHEETS_PATH=/Users/pstadler/repos/TEI-Stylesheets
docker run --rm -v $STYLESHEETS_PATH:/stylesheet -w /stylesheet -it --entrypoint "make" $IMAGE $*