Skip to content

Instantly share code, notes, and snippets.

View natemurthy's full-sized avatar

Nathan Murthy natemurthy

View GitHub Profile
@timcharper
timcharper / leader.sc
Last active January 8, 2017 02:33
Ammonite scala script showing leader election
#!/usr/bin/env amm
import $ivy.`org.apache.curator:curator-recipes:2.11.0`
import java.util.concurrent.Executors
import org.apache.zookeeper.KeeperException.{ NoNodeException, NodeExistsException }
import org.apache.curator.framework.CuratorFrameworkFactory
import org.apache.curator.retry.ExponentialBackoffRetry
import org.apache.curator.framework.recipes.leader.LeaderLatch
import org.apache.curator.framework.recipes.leader.LeaderLatchListener
import scala.util.Random
@bryfry
bryfry / gzip.go
Last active August 28, 2023 09:23
Idiomatic golang net/http gzip transparent compression (works with Alice)
package main
import (
"compress/gzip"
"io"
"net/http"
"strings"
)
// Gzip Compression
@mscharhag
mscharhag / Java8DateTimeExamples.java
Created February 24, 2014 19:53
Examples for using the Java 8 Date and Time API (JSR 310)
import java.time.*;
import java.time.format.DateTimeFormatter;
import java.time.format.FormatStyle;
import java.time.temporal.ChronoUnit;
import java.time.temporal.TemporalAdjusters;
import java.util.*;
import static java.time.temporal.TemporalAdjusters.*;
public class Java8DateTimeExamples {