Skip to content

Instantly share code, notes, and snippets.

@dcshock
dcshock / ChildFirstClassLoader.java
Created January 24, 2015 05:27
Child First ClassLoader
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.List;
public class ChildFirstClassLoader extends URLClassLoader {
@dcshock
dcshock / ProtoColumnType.kt
Last active January 27, 2018 04:25
Protocol Buffer to Postgres JSONB - Kotlin Exposed
// Protocol Buffer (protobuf) V3 - Kotlin Exposed columnType
// Converts to and from jsonb fields in postgres.
class ProtoColumnType(val message: Message) : ColumnType() {
override fun sqlType() = "JSONB"
override fun valueFromDB(value: Any): Any {
if (value is PGobject) {
return JsonFormat.parser().ignoringUnknownFields().merge(value.value, message.toBuilder())
}
throw RuntimeException("Can't parse object: ${value}")
@dcshock
dcshock / Dockerfile
Created January 21, 2019 21:03
gcsfuse install debian stretch
FROM debian:stretch
RUN apt-get update
RUN apt-get install --yes --no-install-recommends ca-certificates curl gpg
RUN echo "deb http://packages.cloud.google.com/apt gcsfuse-stretch main" | tee /etc/apt/sources.list.d/gcsfuse.list
RUN curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
RUN apt-get update
RUN apt-get install --yes gcsfuse
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*