Skip to content

Instantly share code, notes, and snippets.

View devinrsmith's full-sized avatar

Devin Smith devinrsmith

  • Deephaven Data Labs
View GitHub Profile
@devinrsmith
devinrsmith / LMDBIntKey.java
Last active April 19, 2017 14:31
MDB_INTEGERKEY
import java.io.File;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.file.Files;
import org.lmdbjava.Cursor;
import org.lmdbjava.Dbi;
import org.lmdbjava.DbiFlags;
import org.lmdbjava.Env;
import org.lmdbjava.Txn;
@devinrsmith
devinrsmith / UnicodeTest.java
Last active February 2, 2017 23:13
Unicode testing w/ jackson
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import org.junit.Test;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.fail;
@devinrsmith
devinrsmith / CQCompoundIssue.java
Created August 5, 2016 14:43
issue describing CQ compound class cast exception
import com.googlecode.cqengine.ConcurrentIndexedCollection;
import com.googlecode.cqengine.IndexedCollection;
import com.googlecode.cqengine.attribute.SimpleAttribute;
import com.googlecode.cqengine.index.compound.CompoundIndex;
import com.googlecode.cqengine.query.option.QueryOptions;
import com.googlecode.cqengine.resultset.ResultSet;
import static com.googlecode.cqengine.query.QueryFactory.and;
import static com.googlecode.cqengine.query.QueryFactory.equal;
import static com.googlecode.cqengine.query.QueryFactory.in;

Keybase proof

I hereby claim:

  • I am devinrsmith on github.
  • I am thundza (https://keybase.io/thundza) on keybase.
  • I have a public key ASAlSaR_IWYFj5wrQStDmkdbokcE2XRud33tT8jBjO-npgo

To claim this, I am signing this object:

@devinrsmith
devinrsmith / SimpleProducer.java
Created August 6, 2015 02:23
Trying to create simple producer with new KafkaProducer
import org.apache.kafka.clients.producer.KafkaProducer;
import org.apache.kafka.clients.producer.Producer;
import org.apache.kafka.clients.producer.ProducerRecord;
import java.util.Properties;
import java.util.concurrent.ExecutionException;
/**
* Created by dsmith on 8/5/15.
*/
@devinrsmith
devinrsmith / SpliteratorTest.java
Created July 21, 2015 20:45
Testing spliterator visibility
import java.util.Spliterator;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import java.util.stream.StreamSupport;
/**
* Created by dsmith on 7/21/15.
*/
public class SpliteratorTest {
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URI;
/**
* Created by dsmith on 4/8/15.
*/
public class UrlTest {
public static void main(String[] args) throws IOException {
final HttpURLConnection urlConnection = (HttpURLConnection)
@devinrsmith
devinrsmith / GuavaConcatIssue.java
Last active August 29, 2015 14:17
Guava Concat Issue
import com.google.common.base.Suppliers;
import com.google.common.collect.AbstractIterator;
import com.google.common.collect.Iterators;
import java.util.*;
import java.util.function.Consumer;
import java.util.function.Supplier;
/**
* Created by dsmith on 3/19/15.
@devinrsmith
devinrsmith / DoubleCheckedSupplier.java
Last active June 29, 2020 03:45
Double Checked Locking made easy with Java 8 Suppliers
import java.util.function.Supplier;
/**
* Created by dsmith on 2/16/15.
*
* https://en.wikipedia.org/wiki/Double-checked_locking
*
*/
public class DoubleCheckedSupplier<T> implements Supplier<T> {
public static <T> Supplier<T> of(Supplier<T> supplier) {
@devinrsmith
devinrsmith / gist:a55b55e2ac12d50c4559
Created January 15, 2015 16:44
weedfs multi part error
Log file created at: 2015/01/14 16:22:07
Running on machine: xxx
Binary: Built with gc go1.3.1 for linux/amd64
Log line format: [IWEF]mmdd hh:mm:ss threadid file:line] msg
I0114 16:22:07 00001 file_util.go:20] Folder /data Permission: -rwxr-xr-x
I0114 16:22:07 00001 volume.go:108] loading file /data/images_3.idx readonly false
I0114 16:22:08 00001 store.go:225] data file /data/images_3.dat, replicaPlacement=001 v=2 size=582434260 ttl=
I0114 16:22:08 00001 volume.go:108] loading file /data/images_6.idx readonly false
I0114 16:22:08 00001 store.go:225] data file /data/images_6.dat, replicaPlacement=001 v=2 size=568452399 ttl=
I0114 16:22:08 00001 store.go:232] Store started on dir: /data with 2 volumes max 16