Skip to content

Instantly share code, notes, and snippets.

@neelsmith
neelsmith / kroki-fails.jl
Created April 12, 2023 14:31
Pluto notebook with Kroki.jl failing in Pluto 0.19.24
### A Pluto.jl notebook ###
# v0.19.24
using Markdown
using InteractiveUtils
# ╔═╡ d70be298-d93d-11ed-16da-d9dcd9751c6c
using Kroki
# ╔═╡ 6b417fb5-7e52-4487-bdad-6ec44a962168
@neelsmith
neelsmith / fax.sc
Last active May 18, 2020 08:30
A scala script (using ammonite shell imports) to write a facsimile edition of a codex from a CEX source file.
/*
* An Ammonite script to create a simple facsimile of a codex.
*
* The fax function loads a CITE Object repository from a CEX file.
* The repository should include a collection implementing
* the illustrated codex model from a CEX source file, and a collection of
* documentary images. The fax function writes out to a local
* directory a facsimile view as a series of markdown files with yaml headers suitable
* for dropping into a jekyll installation.
*/
@neelsmith
neelsmith / ict.sh
Last active May 5, 2020 18:37
Simplify starting a docker container with a citable image service
#!/bin/bash
#
# ict.sh version 1.1.0
#
# Start a docker container with a citable image service.
# See:
# https://github.com/cite-architecture/citable-images-container
#
# Mounts local working directory as /work in the container.
# Supports optionally setting values for port on the host OS,
@neelsmith
neelsmith / stringsToFromCodePoints.scala
Last active June 16, 2020 07:28
scala for String<->Vector of code points
// Compute Vector of code point values from String
def strToCps(s: String, cpVector: Vector[Int] = Vector.empty[Int], idx : Int = 0) : Vector[Int] = {
if (idx >= s.length) {
cpVector
} else {
val cp = s.codePointAt(idx)
strToCps(s, cpVector :+ cp, idx + java.lang.Character.charCount(cp))
}
}
@neelsmith
neelsmith / rjs.sh
Created August 18, 2017 19:09
Create reveal-js slide shows with pandoc
#!/bin/sh
#
# rjs.sh: use pandoc to write a reveal-js slide show.
#
# REQUIREMENTS
#
# A reveal.js template named "reveal.js" in same directory as markdown source.
# For the set up, see
# https://github.com/jgm/pandoc/wiki/Using-pandoc-to-produce-reveal.js-slides
#
@neelsmith
neelsmith / beam.sh
Last active August 27, 2017 13:55
Create pdf slide shows with pandoc and beamer
#!/bin/sh
#
# beam.sh: make a pdf slide show using pandoc and beamer.
#
# usage: beam.sh SLIDES THEME
#
# REQUIREMENTS
#
# xelatex
#
@neelsmith
neelsmith / config.cson
Last active June 19, 2017 11:39
Configure Atom editor to edit CEX files
tablr:
csvEditor:
columnDelimiter: "#"
comment: "#!"
eof: true
supportedCsvExtensions: [
"csv"
"tsv"
"CSV"
"TSV"
@neelsmith
neelsmith / uchtostr.groovy
Created March 27, 2016 18:41
Read Unicode code points in a string, convert to strings
// Use a UCharacterIterator to loop through code points in a Unicode string,
// and convert each code point to a String.
@Grab('com.ibm.icu:icu4j:3.4.4')
import com.ibm.icu.text.UCharacterIterator
String s = "μῆνιν"
def iter = UCharacterIterator.getInstance (s)
def cp
while(( cp=iter.nextCodePoint())!= UCharacterIterator.DONE){
@neelsmith
neelsmith / lcs.groovy
Last active March 28, 2016 12:12
Print longest common subsequence of two strings of characters
/* Compute Longest Common Subsequence of two strings of characters,
* and print it to standard output.
*
* Example:
*
* groovy lcs.groovy 'Dr Rock-and-Roll Star' 'Doctor Rock Star'
*
* prints
*
* Dr Rock Star
@neelsmith
neelsmith / scs.groovy
Last active March 28, 2016 12:13
Print Shortest Common Supersequence of two strings of characters
/* Compute Shortest Common Supersequence of two strings of characters,
* and print it to stanard output.
*
* Example:
*
* groovy scs.groovy 'Dr Rock-and-Roll Star' 'Doctor Rock Star'
*
* prints
*
* Doctor Rock-and-Roll Star