Skip to content

Instantly share code, notes, and snippets.

View fkuehnel's full-sized avatar

Frank Kuehnel fkuehnel

View GitHub Profile
@fkuehnel
fkuehnel / HashTable.java
Created December 12, 2012 00:13
Associative Map Performance Tests
// provide plenty of heap memory java -Xmx1500m ...
import java.util.*;
public class HashTable {
public static void main(String[] args) {
long insertDurationSum = 0;
long[] insertDurationMeas = new long[10];
final Hashtable<Integer,Double> ht = new Hashtable<Integer,Double>();
@fkuehnel
fkuehnel / Clifford.hs
Created December 11, 2012 21:55
Haskell module for Clifford Algebra tensor representations, and a Geometric Algebra module utilizing the tensor representation
-- credit goes to sigfpe
{-# LANGUAGE MultiParamTypeClasses
,TemplateHaskell
,GeneralizedNewtypeDeriving
,DeriveFunctor
,FunctionalDependencies
,FlexibleInstances
,UndecidableInstances
,FlexibleContexts
,Rank2Types #-}
@fkuehnel
fkuehnel / FastSudokuSolver5.hs
Created December 11, 2012 03:29
Fast Sudoku Solver
module Main where
import qualified Data.Vector.Unboxed as V
import qualified Data.Vector as BV (generate,(!))
import Data.List (foldl',sort,group)
import Data.Char (chr, ord)
import Data.Word
import Data.Bits
import Control.Monad
import Data.Maybe
@fkuehnel
fkuehnel / ExtractMath.java
Created March 11, 2012 22:30
PDFBox extension to extract previously tagged math areas from a PDF document
package org.apache.pdfbox;
import org.apache.pdfbox.exceptions.InvalidPasswordException;
import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.pdmodel.PDPage;
import org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotation;
import org.apache.pdfbox.pdmodel.common.PDRectangle;
import org.apache.pdfbox.util.PDFTextStripperByArea;
@fkuehnel
fkuehnel / mathmltagger.lua
Created March 11, 2012 21:15
Tagging Math Expressions in PDF documents with Lualatex
-- element tree, http://etree.luaforge.net/ (is a bit buggy for the {decl = false} option)
local el = require "etree"
-- nodelist visualization (optional), https://gist.github.com/556247
-- local viz = require "viznodelist"
function convertToMathML(head)
return {tag="not implemented"}
end