Skip to content

Instantly share code, notes, and snippets.

View pgundlach's full-sized avatar
💭
Working on boxes and glue

Patrick Gundlach pgundlach

💭
Working on boxes and glue
View GitHub Profile
@pgundlach
pgundlach / numbers2latex.scpt
Created May 1, 2010 14:43
numbers2latex table converter
-- Numbers to LaTeX converter
-- this small AppleScript takes the first table in the first sheet of the first
-- Numbers document and turns it into a LaTeX table (well, sort of).
-- It will be copied to the clipboard.
-- This is a 5-minute quick hack and mostly unsupported, but if you like it or
-- if you have any enhancements (not feature request :-)), plese send them to
-- gundlach <at> speedata.de
tell application "Numbers"
@pgundlach
pgundlach / transform-fontawesome.xsl
Created June 27, 2017 19:30
XSL-Transformation of HTML style fontawesome include to a custom tag with code
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
exclude-result-prefixes="#all">
<!--
This transformation turns <i class="fa fa-..."></i> into
<fa>&#x...;</fa>
This is useful for the layout files in the speedata Publisher.
https://github.com/speedata/publisher
@pgundlach
pgundlach / rng2adoc.xsl
Created March 22, 2018 12:11
Simple RELAX NG to adoc transformation
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
exclude-result-prefixes="xs"
xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"
version="2.0">
<xsl:output method="xml" indent="no" omit-xml-declaration="yes"/>
<xsl:variable name="startxml"><xsl:text>
[source, xml]
-------------------------------------------------------------------------------
@pgundlach
pgundlach / xmlparser.lua
Created April 26, 2012 13:01
XML Parser based on lpeg
-- xml parser
local require,lpeg,io,select,string,type,tonumber,tostring=require,lpeg,io,select,string,type,tonumber,tostring
local w = w
local printtable=printtable
module(...)
bit = require('bit')
local C,P,R,S,V = lpeg.C,lpeg.P,lpeg.R,lpeg.S,lpeg.V
@pgundlach
pgundlach / data.xml
Last active September 7, 2020 10:07
Example for table construction
<data>
<entry>E3Q7wpaCuqlEW7IpD5wLZ%EKnL6l6KzJ</entry>
<entry>0wLL7=Y6XKUDw$rS3STaxq6vGnPC,S,s</entry>
<entry>uIB9xFJ7o1c9cpvdW-fuAn8%7V6XjsP5</entry>
<entry>ApBxPOQAeqn1vLBDZgUhsMCa:yoEw3-O</entry>
<entry>XMa0V%Cgp09GLHlGNiby8,2zwHgPqs.r</entry>
<entry>5A;ybcJtNQ.k58Vium=PFdShVJ5X1pg4</entry>
<entry>XFfpSQa2nfVzUgNPwfGDdzu*@6SLAyd3</entry>
<entry>7r@ZQdXckXVzIVTdpg2nEFRJ7h*IZd52</entry>
<entry>GzazyelFpKWU8&amp;79IL.o6k5QS9gq2gVZ</entry>
@pgundlach
pgundlach / mkparagraph.lua
Created July 4, 2011 11:20
Small example of creating a node list and let TeX do the linebraking
function mknodes( text )
local current_font = font.current()
local font_parameters = font.getfont(current_font).parameters
local n, head, last
-- we should insert the paragraph indentation at the beginning
head = node.new("glue")
head.spec = node.new("glue_spec")
head.spec.width = 20 * 2^16
last = head
@pgundlach
pgundlach / cksum.go
Last active October 16, 2021 01:57
A simple version of the unix utility "cksum" in Go
package main
import (
"bufio"
"fmt"
"io"
"os"
)
// A simple version of the unix utility "cksum" in Go
@pgundlach
pgundlach / viznodelist.lua
Last active January 10, 2022 01:43
LuaTeX nodelist visualization
--
-- viznodelist.lua
-- speedata publisher
--
-- Written 2010-2020 by Patrick Gundlach.
-- This file is released in the spirit of the well known MIT license
-- (see https://opensource.org/licenses/MIT for more information)
--
-- visualizes nodelists using graphviz