Skip to content

Instantly share code, notes, and snippets.

View dklotz's full-sized avatar

David Koerdt dklotz

View GitHub Profile
@dklotz
dklotz / FindDups.java
Last active August 29, 2015 14:14
Go through a text file containing two tab-separated words per line, finding lines with duplicate words, case-insensitively
import java.nio.file.Files;
import java.nio.file.Paths;
import com.google.common.base.CharMatcher;
import com.google.common.base.Splitter;
// ...
public class FindDups {
// ...
public static void main(String[] args) throws Exception {
String filePath = "/Users/david/Documents/fileee/es_queries/de-lemma-utf8.txt";
@dklotz
dklotz / MyClassNames.java
Last active March 17, 2016 11:20
Java class name pitfalls, output below. TL/DR: Don't rely on class.getSimpleName() / class.getCanonicalName() to give you anything meaningful.
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import static java.lang.String.format;
/**
* Demo of some common pitfalls with class.getSimpleName() and class.getCanonicalName().
* @author David Klotz
*/
public class MyClassNames {
@dklotz
dklotz / InterceptorReproducer.java
Created March 22, 2017 21:14
Trying to reproduce a problem with interceptors in Vert.x
package com.fileee.experiments.vertx;
import io.vertx.core.Vertx;
import io.vertx.core.VertxOptions;
import io.vertx.core.eventbus.DeliveryOptions;
import io.vertx.core.eventbus.EventBus;
import io.vertx.core.eventbus.Message;
import io.vertx.spi.cluster.hazelcast.HazelcastClusterManager;
public class InterceptorReproducer {
public class TestMain {
public static void main(String[] args) {
// What does this program print when run?
// \u000d System.out.println("Hello ");
System.out.println("World!");
}
}
@dklotz
dklotz / keybase.md
Created November 26, 2019 16:44
keybase.md

Keybase proof

I hereby claim:

  • I am dklotz on github.
  • I am dklotz (https://keybase.io/dklotz) on keybase.
  • I have a public key ASDpgdzQAt6O49JRJRTFjvVWafCzMgQakZCm0iaitzEdcQo

To claim this, I am signing this object: