Skip to content

Instantly share code, notes, and snippets.

@digulla
digulla / RunPlattyRun_V5
Last active December 31, 2015 17:39
Writing Games with Processing: Eating Platty
// Version 5: Eating Platty
int px = 320, py = 240;
int tileSize = 20;
int signum(float value) {
return value < 0 ? -1 : value > 0 ? 1 : 0;
}
class Enemy {
@digulla
digulla / RunPlattyRun_V6
Created December 18, 2013 15:09
Writing Games with Processing: Winning
// Version 6: Winning the game
int px = 320, py = 240;
int tileSize = 20;
int signum(float value) {
return value < 0 ? -1 : value > 0 ? 1 : 0;
}
class Enemy {
@digulla
digulla / RunPlattyRun_V7
Created December 18, 2013 20:51
Writing Games with Processing: Highscore!
// Version 7: Scoring
int px = 320, py = 240;
int tileSize = 20;
int score = 0;
int signum(float value) {
return value < 0 ? -1 : value > 0 ? 1 : 0;
}
@digulla
digulla / Default (Linux).sublime-keymap
Last active August 21, 2018 16:34
Eclipse keyboard mapping for Sublime Text 2+3, based on https://gist.github.com/thbkrkr/3194275
// Put this in .../Packages/User/Default (**YOUR_OS_HERE**).sublime-keymap
[
// Eclipse keyboard mapping for Sublime Text 2+3, based on https://gist.github.com/thbkrkr/3194275
{ "keys": ["f12"], "command": "htmlprettify"},
{ "keys": ["f1"], "command": "fold" },
{ "keys": ["f2"], "command": "unfold" },
{ "keys": ["ctrl+l"], "command": "show_overlay", "args": {"overlay": "goto", "text": "@"} },
{ "keys": ["ctrl+space"], "command": "auto_complete" },
{ "keys": ["ctrl+space"], "command": "replace_completion_with_auto_complete", "context":
@digulla
digulla / OrphanNodesTool.groovy
Created October 24, 2014 10:20
Groovy tool to count, list or delete orphaned nodes in a database with proper FK relations
import groovy.sql.Sql
class OrphanNodesTool {
Sql sql;
String schema;
Set<String> tablesTargetedByForeignKeys() {
def query = '''\
@digulla
digulla / c't_Inhaltsverzeichnis_sortieren.user.js
Last active August 29, 2015 14:12
Sortiert das Inhaltsverzeichnis der c't nach Seitenzahl, wenn man auf "aktuell" klickt
// ==UserScript==
// @name c't Inhaltsverzeichnis sortieren
// @namespace http://www.pdark.de/
// @version 1.0
// @description Sortiert das Inhaltsverzeichnis der c't nach Seitenzahl, wenn man auf "aktuell" klickt
// @match https://www.heise.de/artikel-archiv/ct/*
// @copyright 2014+, Aaron Digulla
// @grant unsafeWindow
// ==/UserScript==
@digulla
digulla / H2TransactionTest.java
Last active August 22, 2018 19:03
Test case for multi-threaded access to an H2 database
package de.pdark.h2.txtest;
import static org.junit.Assert.*;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import org.h2.jdbcx.JdbcDataSource;
import org.junit.Test;
public class H2TransactionTest {
@digulla
digulla / Dockerfile.template
Last active December 22, 2015 06:25
Oracle XE 11 Docker image without license issues
FROM ubuntu:14.04.1
MAINTAINER Wei-Ming Wu <wnameless@gmail.com>
ADD chkconfig /sbin/chkconfig
ADD init.ora /
ADD initXETemp.ora /
@PARTS@
RUN cat /@BASENAME@.deb?? > /@BASENAME@.deb
@digulla
digulla / README.md
Last active April 29, 2016 01:56
Make ZK play nice with Fediz SSO
@digulla
digulla / DangerousPathChecker.java
Last active August 31, 2023 19:14
How to check whether a file is on a network share with Java
/** Copyleft (C) 2016 by Aaron Digulla. Use as you wish. This copyright notice can be removed. */
package bug507401;
import java.io.BufferedReader;
import java.io.File;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.List;