Skip to content

Instantly share code, notes, and snippets.

Avatar

David Phillips electrum

View GitHub Profile
@electrum
electrum / LoggingInterceptor.java
Created May 13, 2020
OkHttp LoggingInterceptor
View LoggingInterceptor.java
package io.prestosql.client;
import okhttp3.Interceptor;
import okhttp3.Request;
import okhttp3.Response;
import java.io.IOException;
import static io.airlift.units.Duration.nanosSince;
import static java.lang.String.format;
View git-release-changes.sh
#!/bin/sh
set -eu
CURRENT=$1
git log --format='%<|(21)%cn %<|(39)%cd %<|(50)%h %s' --date=format-local:'%m-%d %H:%M:%S' $CURRENT.. | \
grep -vF '[maven-release-plugin]' | sort | \
awk '
{
@electrum
electrum / gist:bf90fe825140f3102b839b64694c39f5
Created Jan 20, 2019
Presto SPI classes moved to connector package
View gist:bf90fe825140f3102b839b64694c39f5
BucketFunction
CatalogSchemaName
CatalogSchemaTableName
ColumnHandle
ColumnMetadata
ColumnNotFoundException
ConnectorHandleResolver
ConnectorIndex
ConnectorIndexHandle
ConnectorInsertTableHandle
@electrum
electrum / gist:d05be32d334773e022b7d3a8f7c5efad
Created Aug 29, 2018
Drift notes for unknown field preservation
View gist:d05be32d334773e022b7d3a8f7c5efad
@ThriftStruct
class Foo {
@ThriftId(2);
String foo;
@ThriftId(3)
ThriftString foo;
@ThriftUnknown
Map<Short, ThriftObject> unknown;
View gist:4ba3da9e7bbf0e47de1b2c2a3f71fed2
package com.facebook.presto.sql.parser;
import org.antlr.v4.runtime.Token;
import org.antlr.v4.runtime.atn.ATN;
import org.antlr.v4.runtime.atn.ATNState;
import org.antlr.v4.runtime.atn.NotSetTransition;
import org.antlr.v4.runtime.atn.Transition;
import org.antlr.v4.runtime.misc.IntervalSet;
import org.testng.annotations.Test;
View Batchable.java
package org.jdbi.v3.sqlobject;
/**
* A mixin interface to expose batching methods on the SQL object.
*/
public interface Batchable
{
/**
* Begin a SQL batch that will send multiple statements to the database
* at once. After this is called, a single
View GuiceLogger.java
package javatest8;
import com.google.inject.Binder;
import com.google.inject.Guice;
import com.google.inject.Injector;
import com.google.inject.Key;
import com.google.inject.Module;
import com.google.inject.matcher.Matchers;
import com.google.inject.spi.Dependency;
import com.google.inject.spi.DependencyAndSource;
View travis-debug.sh
#!/bin/sh -eu
job=$1
token=$(perl -ne '/access_token: (.*)/ && print $1' ~/.travis/config.yml)
curl -sS -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Travis-API-Version: 3" \
View git-release-changes.sh
#!/bin/sh -eu
CURRENT=$1
git log --format='%<|(21)%cn %<|(34)%ct %<|(48)%h %s' $CURRENT.. |
grep -vF '[maven-release-plugin]' | sort | cut -c1-21,34- |
awk '
{
if (NR > 1) {
name = substr($0, 1, 21)
View ClassInitializer.java
public final class ClassInitializer
{
private final String name;
public ClassInitializer()
{
System.out.println(name);
}
{