Skip to content

Instantly share code, notes, and snippets.

@jeffreycwitt
jeffreycwitt / gist:cb4ab709db98f1317d4b
Created May 16, 2015 20:57
A ruby script to auto load git repos into webdav mounted exist volume
#!/usr/bin/env ruby
require 'bundler/setup'
require 'lbp'
puts "welcome to the scta index loader"
puts "i'm going to help you load git repos into the existdb database"
local_load_dir = "/Volumes/db-1/apps/scta/"
remote_load_dir = "/Volumes/db/apps/scta/"
use_load_dir = remote_load_dir
@jeffreycwitt
jeffreycwitt / iiifsearch.xq
Created October 2, 2015 01:15
existdb to IIIF search results
xquery version "3.0";
declare namespace tei="http://www.tei-c.org/ns/1.0";
declare namespace output="http://www.w3.org/2010/xslt-xquery-serialization";
import module namespace console="http://exist-db.org/xquery/console";
declare option output:method "json";
declare option output:media-type "application/json";
declare function local:render($node) {
@jeffreycwitt
jeffreycwitt / wordcount-lucene.xq
Created October 11, 2015 21:13
existdb-xquery word frequency report with Lucene index
xquery version "3.0";
declare namespace tei="http://www.tei-c.org/ns/1.0";
declare option exist:serialize "method=html media-type=text/html ident=no";
let $collection := "scta/lombardsententia"
let $terms :=
<terms>
{
@jeffreycwitt
jeffreycwitt / Sentences-Commentary-Manuscripts-in-Bodleian.md
Created October 14, 2015 14:59
Some manuscripts containing Sentences commentaries in the Bodleian

Sentences Commentary Manuscripts in Bodleian

Shelfmark MS. Barlow 15 Summary Catalogue no. 6422

Shelfmark MS. Hamilton 17 Summary Catalogue no. 24447 ff. 176-226 (author unknown)

Shelfmark MS. Hamilton 19

# regex pattern to wrap a line in <p></p> tags
(.+?)(\n|$)+
and replace it with:
<p>$1</p>\n\n
taken from here: http://stackoverflow.com/questions/33269223/wrapping-paragraphs-new-line-in-p-tags
@jeffreycwitt
jeffreycwitt / cool trick to find all non-ASCII characters in UNIX
Created December 6, 2016 13:55
cool trick to find all non-ASCII characters in UNIX
cool trick to find all non-ASCII characters in UNIX
pcregrep --color='auto' -n "[\x80-\xFF]" filename.xml
See http://stackoverflow.com/questions/3001177/how-do-i-grep-for-all-non-ascii-characters-in-unix
@jeffreycwitt
jeffreycwitt / gist:d83e845316422be1516b8616fae53ac9
Created February 25, 2017 13:38
bash loop to change directory, file, and remote origin url
for file in *
do
oldfile=$file
newfile=${file//263/da-236}
echo $oldfile
echo $newfile
mv $oldfile $newfile
cd $newfile
mv $oldfile.xml $newfile.xml
git remote set-url origin ssh://[email protected]/jeffreycwitt/$newfile
#!/usr/bin/env bash
##==================
## script modified from
#https://saintgimp.org/2013/01/22/merging-two-git-repositories-into-one-repository-without-losing-file-history/
## INstructions
# create new empty folders
# create dummy commit
# then follow instructions bewlo
@jeffreycwitt
jeffreycwitt / manifest-create-for-directory.rb
Last active May 19, 2019 14:30
A ruby script for auto generating a iiif manifest for all files in a given directory (requires Ruby and imagemagick)
require 'json'
dir = "/Users/jcwitt/Documents/projects_current/PittIIIFWorkshop/WorkshopDir/images/"
canvases = []
slug = "custom"
no = 1
urlbase = "http://jeffreycwitt.com"
imageurlbase = "http://localhost:8182/iiif/2"
## list of files in directory to be skipped
{
"@context": "http://iiif.io/api/presentation/2/context.json",
"@id": "https://scta.info/iiif/plaoulcommentary/sorb/manifest",
"@type": "sc:Manifest",
"label": "plaoulcommentary/sorb",
"description": "Manifest Description",
"license": "https://creativecommons.org/publicdomain/zero/1.0/",
"service": {
"@context": "http://iiif.io/api/search/1/context.json",
"@id": "https://exist.scta.info/exist/apps/scta-app/iiif/plaoulcommentary/sorb/search",