Skip to content

Instantly share code, notes, and snippets.

View electrum's full-sized avatar
🚀
Working on @trinodb at @starburstdata

David Phillips electrum

🚀
Working on @trinodb at @starburstdata
View GitHub Profile
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
public final class Types
{
private Types() {}
public static <A, B extends A> B checkType(A value, Class<B> target, String name)
{
checkNotNull(value, "%s is null", name);
@electrum
electrum / README.md
Last active January 14, 2020 21:26
Presto release scripts
@electrum
electrum / gist:cce45ec91149e3c17277
Last active December 28, 2015 19:28
Build Hadoop native on Mac OS X
mvn clean package -pl hadoop-common-project/hadoop-common -DskipTests -P native -Dsnappy.include=/usr/local/include -Dsnappy.lib=/usr/local/lib -Drequire.snappy=true
@electrum
electrum / java6
Created September 27, 2013 01:27
java6
#!/bin/sh -eu
export JAVA_HOME=$(/usr/libexec/java_home -v 1.6)
export PATH=$JAVA_HOME/bin:$PATH
exec "$@"
import com.google.common.util.concurrent.ExecutionError;
import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.SettableFuture;
import com.google.common.util.concurrent.UncheckedExecutionException;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Executor;
import java.util.concurrent.Future;
import javax.inject.Qualifier;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.PARAMETER;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
@electrum
electrum / build-native-mac.sh
Last active July 16, 2020 06:34
Compile native libraries on Mac OS X
brew install snappy
CPPFLAGS=-I/usr/local/include LDFLAGS=-L/usr/local/lib ant compile-native
chmod 644 build/native/Mac_OS_X-x86_64-64/lib/*
ls -l /usr/local/lib/libsnappy.dylib
ls -l build/native/Mac_OS_X-x86_64-64/lib/libhadoop.dylib
import java.io.Closeable;
import java.io.IOException;
import java.lang.ref.PhantomReference;
import java.lang.ref.ReferenceQueue;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Preconditions.checkState;
public class Resource
{
@electrum
electrum / gist:5248077
Created March 26, 2013 18:51
IntelliJ IDEA add Jackson @JsonProperty constructor parameter annotations
(\w+) (\w+)([,)])
@JsonProperty("$2") $1 $2$3\n