Skip to content

Instantly share code, notes, and snippets.

View phi-gamma's full-sized avatar
💤
Does nothing unless polled.

Philipp Gesang phi-gamma

💤
Does nothing unless polled.
View GitHub Profile
points:
exact answer: 5
time: 1
location: 1
culture: 1
players: p a
score:
@phi-gamma
phi-gamma / -
Created January 29, 2017 16:37
fontforge -script ./outlines.py
#!/usr/bin/env texlua
local stringformat = string.format
local texprint = tex.print
local stringgsub = string.gsub
local stringrep = string.rep
package.path = "/usr/share/lua/5.2/?.lua;/usr/share/lua/5.2/?/init.lua"
package.cpath = "/usr/lib/lua/5.2/?.so"
>>> processing slovakia-slovenia.dat
>>> language data : 54
>>> greatest distance : 6 (language[s]: uk)
>>> mean distance : 2.8
>>> median distance : 3.0
>>> standard deviation : 1.020
>>> #0, line #7: “cs” “Slovensko” “Slovinsko” → δ=1 scaled=(0.167 84 0x54)
>>> #1, line #47: “sk” “Slovensko” “Slovinsko” → δ=1 scaled=(0.167 84 0x54)
>>> #2, line #1: “be” “Славакія” “Славенія” → δ=2 scaled=(0.333 105 0x69)
>>> #3, line #2: “bg” “Словакия” “Словения” → δ=2 scaled=(0.333 105 0x69)
@phi-gamma
phi-gamma / prs.lua
Last active January 25, 2016 06:34
making sense of a windows registy dump
#!/usr/bin/env texlua
kpse.set_program_name "luatex"
require "lualibs"
local rawset = rawset
local lpeg = require "lpeg"
local P, R, S = lpeg.P, lpeg.R, lpeg.S
local lpegmatch = lpeg.match
local C, Cc, Cf = lpeg.C, lpeg.Cc, lpeg.Cf
local Cg, Cmt, Cs, Ct = lpeg.Cg, lpeg.Cmt, lpeg.Cs, lpeg.Ct
ocamlc -ccopt "-I/usr/lib/ocaml -DZ_OCAML_HASH -DZ_OCAML_COMPARE_EXT -DHAS_GMP -DZ_ELF -DZ_DOT_LABEL_PREFIX -O3 -Wall -Wextra " -c caml_z.c
In file included from /usr/include/stdio.h:33:0,
from caml_z.c:24:
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/include/stddef.h:212:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘typedef’
typedef __SIZE_TYPE__ size_t;
^
In file included from caml_z.c:24:0:
/usr/include/stdio.h:48:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘typedef’
typedef struct _IO_FILE FILE;
^
\input luaotfload.sty
\font \foo = file:Iwona-Regular.otf:+smcp;letterspace=1.25 at 42pt
\font \foo = file:MinionPro-Regular.otf:+smcp;letterspace=1.25 at 42pt
\foo It works!
\bye
\input luaotfload.sty
\font \foo = file:Iwona-Regular.otf:+smcp;letterspace=1.25 at 42pt
\foo It works!
\bye
@phi-gamma
phi-gamma / tex
Created May 14, 2014 04:40
pln-cambria.tex
\input luaotfload.sty
\font \cambria = "Cambria"
\font \cambriamath = "Cambria Math"
\cambria foo
\cambriamath bar
\bye
@phi-gamma
phi-gamma / luatex-0.78.3_prevent-PTEX.FileName.patch
Created February 24, 2014 21:27
Prevent Luatex from writing filesystem location of included PDFs to the document.
Index: source/texk/web2c/luatexdir/image/writeimg.w
===================================================================
diff --git a/trunk/source/texk/web2c/luatexdir/image/writeimg.w b/trunk/source/texk/web2c/luatexdir/image/writeimg.w
--- a/trunk/source/texk/web2c/luatexdir/image/writeimg.w (revision 4837)
+++ b/trunk/source/texk/web2c/luatexdir/image/writeimg.w (working copy)
@@ -693,7 +693,7 @@
// write additional information
snprintf(s, 20, "%s.FileName", pdfkeyprefix);
pdf_add_name(pdf, s);
- pdf_printf(pdf, " (%s)", convertStringToPDFString(p, strlen(p)));