Skip to content

Instantly share code, notes, and snippets.

View cowtowncoder's full-sized avatar

Tatu Saloranta cowtowncoder

View GitHub Profile
@cowtowncoder
cowtowncoder / gist:1bcc39fceb077d9115f7
Created January 12, 2015 23:03
Simple immutable byte[]->Object Trie, in this case for looking up Enum values from raw UTF-8 string
import java.nio.charset.Charset;
import java.util.Arrays;
/**
* Trie container/wrapper, in this case implements Enum-value lookup.
* Sample code to possibly use for streamlined-lookup by dictionary, using
* UTF-8 bytes of {@link Enum#name()} as the key.
*/
public class EnumByBytesLookup<E extends Enum<E>>
{
@cowtowncoder
cowtowncoder / gist:4e0b2308b1f660b8b855
Created February 4, 2015 18:15
Trie (tr13) builder that uses a LevelDB instance to create a tr13 file to use for reading (note: mem usage linear to result size)
import com.ning.tr13.KeyValueSource;
import com.ning.tr13.impl.bytes.BytesValueReader;
import com.ning.tr13.impl.bytes.SimpleBytesTrieBuilder;
import org.iq80.leveldb.CompressionType;
import org.iq80.leveldb.DB;
import org.iq80.leveldb.DBIterator;
import org.iq80.leveldb.Options;
import org.iq80.leveldb.impl.Iq80DBFactory;
import java.io.*;
@cowtowncoder
cowtowncoder / IapDatabind.java
Created February 5, 2016 05:24
Example of how IAP/ION codec for jvm-serializers could look like
package serializers;
import java.util.Arrays;
import com.jenkov.iap.ion.read.IonObjectReader;
import com.jenkov.iap.ion.write.IonObjectWriter;
import data.media.MediaContent;
/**
Started by upstream project "pipeline/publish-the-world" build number 148
originally caused by:
Started by user [ME]
Obtained jenkinsfiles/FFF from git git@XXX
Running in Durability level: PERFORMANCE_OPTIMIZED
Loading library pipeline@release/2.x
Attempting to resolve release/2.x from remote references...
> git --version # timeout=10
using GIT_SSH to set credentials SSH key for Gitlab
> git ls-remote -h git@XXX # timeout=10