Skip to content

Instantly share code, notes, and snippets.

View stoerr's full-sized avatar

Dr. Hans-Peter Störr stoerr

View GitHub Profile
stoerr / pom2dotty.xslt
Created September 29, 2014 14:09
Prints dependencies of a multi module maven project as graph in dotty / graphviz format
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="" xmlns:pom="">
<xsl:output method="text" version="1.0" encoding="UTF-8" indent="no"/>
Generiert Fragment von dotty-File für die Pom-Abhängigkeiten.
echo "digraph PomDependencies {"
find . -name pom.xml | xargs xsltproc pom2dotty.xslt | sort -u
echo "}"
stoerr / tilesgraph.xslt
Created September 29, 2014 14:11
Makes graph of tiles 1 definition extensions in dotty / graphviz format
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="" xmlns:fo="" xmlns:xs="" xmlns:fn="">
<xsl:output method="text" />
<xsl:template match="/" >
<xsl:text>digraph tilesdefs {
<xsl:for-each select="/tiles-definitions/definition[@extends]">
stoerr /
Last active August 2, 2017 07:19
Prolog snippet with term replacement system for symbolic differentiation (not quite complete)
rule((X+Y)*Z, (X*Z)+(Y*Z)).
stoerr / GenerateFelixPom.groovy
Created February 21, 2019 13:47
Creates a pom.xml in the directory a Sling launchpad runs for all JARs deployed in the Felix OSGI container there, enabling to import these easily into the IDE and download the sources/javadocs as well
println("Run in launchpad")
File topfile = new File("sling").canonicalFile
def pom = new FileWriter("pom.xml")
pom.append("""<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="" xmlns:xsi=""
stoerr / prepare-commit-msg
Created April 12, 2019 10:09
Automatically include ticket number from branch name into git commit messages
# If you use branch names with JIRA ticket numbers in them, e.g. feature/ABC-4324-do-something,
# this includes automatically the ticket number (ABC-4324) at the start of the the commit message.
# This way, it's later easy to see which change was done for which ticket, without any manual effort.
# You need to copy or link this file into .git/hooks/prepare-commit-msg
# You can customize which branches should be skipped when prepending commit message.
if [ -z "$BRANCHES_TO_SKIP" ]; then
BRANCHES_TO_SKIP=(master develop test)
stoerr / FileDupFinder.scala
Last active April 26, 2019 10:59
Finds duplicate files (i.e., with the same content) in a given set of directories.
package net.stoerr.dirdupfinder
import java.nio.ByteBuffer
import java.nio.file.{FileSystems, Files, Path, StandardOpenOption}
import sun.misc.BASE64Encoder
import scala.collection.JavaConversions._
stoerr / AutomaticTextGenerationCharbased.ipynb
Created May 16, 2019 20:24
Simple automatic language like text generation via a Tensorflow neural network
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
stoerr / threaddump.jsp
Last active October 8, 2019 14:09
Configurable dump of all threads with a configurable set of stati, equivalent stacktraces collected
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
This JSP lists all threads with stati as configured in a checklist, optionally whose names match a specified regex.
If two threads have the same stacktrace, they are shown together and the stacktrace is printed only once.
<%@page import="java.util.*"%>
<%@page import="javax.servlet.*"%>
<%@page import="*"%>
stoerr /
Last active November 6, 2019 15:39
Allows using a java.util.concurrent.lock in a Java try-with-resources statement
import javax.annotation.Nonnull;
import java.util.Objects;
import java.util.concurrent.locks.Lock;
* Allows using a {@link java.util.concurrent.locks.Lock} with a try with resources, e.g.:
* <code> try (LockAsAutoCloseable locked = LockAsAutoCloseable.lock(lock)) { ... } </code> .
public class LockAsAutoCloseable implements AutoCloseable {
stoerr /
Last active February 12, 2020 10:56
For testing purposes: generates various test strings with unusual characters which can be used to detect character encoding problems. Caution: this currently covers only relatively common stuff - it does not yet lead into the deeper realms of UTF like substitutes, right to left, Kanji, characters outside of 16 bit.
package net.stoerr.testing;
import java.util.ArrayList;
import java.util.List;
* Returns a couple of teststrings to detect character escaping problems. This file encodes all chars numerically to
* make sure we are independent of the encoding of this file. Caution: this currently covers only relatively common
* stuff - it does not yet lead into the deeper realms of UTF like substitutes, right to left, Kanji, characters