Skip to content

Instantly share code, notes, and snippets.

Bernd ecki

Block or report user

Report or block ecki

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ecki
ecki / gist:5638362
Created May 23, 2013
Java Networking 501 :)
View gist:5638362
package test;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.UnknownHostException;
/**
* Demonstrate that InetAddress#getByName() with a literal does not
* fill in the host name, which leads to (uncached) reverse lookups
View openantrag-j2c.ps1
#
# This will format http://openantrag.de/api/proposal/ID/gettop/100 JSON files into CSV
#
$list = @()
foreach($file in Get-ChildItem -Filter proposal-*.json .) {
$list += ((Get-Content -Encoding UTF8 $file) -join "`n" | ConvertFrom-Json)
}
# Inspect Result graphically: PS1> $list | Out-GridView
@ecki
ecki / SingletonAccess.java
Created Jan 31, 2014
JMH Problem with Inline Control in 0.3.1
View SingletonAccess.java
package net.eckenfels.tests.jmh;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;
import org.openjdk.jmh.annotations.CompilerControl;
import org.openjdk.jmh.annotations.CompilerControl.Mode;
import org.openjdk.jmh.annotations.GenerateMicroBenchmark;
import org.openjdk.jmh.annotations.OutputTimeUnit;
@ecki
ecki / VFSClassLoaderTest.java
Created Feb 4, 2014
VFS ClassLoader JAR verification
View VFSClassLoaderTest.java
package vfstest;
import static org.junit.Assert.assertTrue;
import java.io.File;
import java.net.URL;
import java.net.URLClassLoader;
import org.apache.commons.vfs2.CacheStrategy;
import org.apache.commons.vfs2.FileObject;
@ecki
ecki / gist:9518404
Last active Aug 29, 2015
Nicer Array Overflow Exception
View gist:9518404
throw new RuntimeException(" ________________________\n"+
"< Arrays have a 2GB Limit. >\n"+
" ------------------------\n"+
" \\ ^__^ \n"+
" \\ (oo)\\_______\n"+
" (__)\\ )\\/\\\n"+
" ||----w |\n"+
" || ||\n");
View logstashechocrash
C:\logtest>java -version
java version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)
C:\logtest>type inout.cfg
input {
stdin { }
}
@ecki
ecki / StringConcat.java
Created Aug 10, 2014
JMH Test to compare single-shot performance if StringBuffer and +=
View StringConcat.java
package net.eckenfels.jmh;
import java.util.concurrent.TimeUnit;
import org.openjdk.jmh.annotations.*;
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
@Warmup(iterations = 5, time = 1, timeUnit = TimeUnit.SECONDS)
@Measurement(iterations = 5, time = 4, timeUnit = TimeUnit.SECONDS)
@ecki
ecki / re-find.diff
Created Aug 22, 2014
JMH Patch for RE pattern matching
View re-find.diff
diff -r 0d74d2f85299 jmh-core/src/main/java/org/openjdk/jmh/runner/BenchmarkList.java
--- a/jmh-core/src/main/java/org/openjdk/jmh/runner/BenchmarkList.java Wed Aug 20 16:23:00 2014 +0400
+++ b/jmh-core/src/main/java/org/openjdk/jmh/runner/BenchmarkList.java Fri Aug 22 02:36:54 2014 +0200
@@ -85,7 +85,7 @@
}
/**
- * Gets all the micro benchmarks that matches the given regexp, sorted
+ * Gets all the micro benchmarks that matches the given regexp, sorted.
*
@ecki
ecki / MyBenchmark.java
Last active Aug 29, 2015
JMH Test for apache commons pool-277 (atomic max statistic)
View MyBenchmark.java
package net.eckenfels.jmh.testmax;
import java.util.Random;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicLong;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.Fork;
import org.openjdk.jmh.annotations.Measurement;
import org.openjdk.jmh.annotations.Scope;
@ecki
ecki / HashBenchmark.java
Created Dec 4, 2014
JMH Test Crypt Hash Performance
View HashBenchmark.java
package net.eckenfels.test.jmh;
import java.nio.ByteBuffer;
import java.security.InvalidKeyException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.concurrent.TimeUnit;
import javax.crypto.KeyGenerator;
You can’t perform that action at this time.