Skip to content

Instantly share code, notes, and snippets.

View tuor713's full-sized avatar

Valentin Mahrwald tuor713

View GitHub Profile
(use 'uwh.common.jline)
(use '[clojure.contrib.io :only (file read-lines)])
(def processor (atom identity))
(defn nil-safe [f] #(if (nil? %) % (f %)))
(defn add! [f] (swap! processor #(comp (nil-safe f) %)))
(run
(commands
(transform [f :file]
@tuor713
tuor713 / gist:1033937
Created June 19, 2011 08:14
Animal sniffler for Java 5
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<dependencies>
<dependency>
<groupId>org.codehaus.mojo</groupId>
<artifactId>animal-sniffer-enforcer-rule</artifactId>
<version>1.6</version>
</dependency>
</dependencies>
@tuor713
tuor713 / ObjectSizer
Created July 21, 2011 19:16
Calculating total size of Java object graph
import java.lang.instrument.Instrumentation;
import java.lang.reflect.Array;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.IdentityHashMap;
public class ObjectSizer {
private static Instrumentation instrumentation;