Skip to content

Instantly share code, notes, and snippets.

import com.google.common.base.Objects;
import com.google.common.collect.Lists;
import com.google.inject.AbstractModule;
import com.google.inject.Binding;
import com.google.inject.BindingAnnotation;
import com.google.inject.Guice;
import com.google.inject.Inject;
import com.google.inject.Injector;
import com.google.inject.Key;
import com.google.inject.Module;
@bbeck
bbeck / PersistentEphemeralNode.java
Created October 30, 2012 13:39
Persistent ephemeral node for ZooKeeper
package com.netflix.curator.framework.recipes.nodes;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Throwables;
import com.google.common.util.concurrent.SettableFuture;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import com.netflix.curator.framework.CuratorFramework;
import com.netflix.curator.framework.api.PathAndBytesable;
import com.netflix.curator.utils.EnsurePath;
import com.netflix.curator.utils.ZKPaths;
@bbeck
bbeck / groupby.py
Created September 5, 2012 16:03
Groupby
#!/usr/bin/env python
from __future__ import with_statement
import copy
import functools
import itertools
import sys
from decimal import Decimal
class aggregation(object):
aggregations_by_name = {}
@bbeck
bbeck / gist:3342273
Created August 13, 2012 16:16
Coding style for IntelliJ
<?xml version="1.0" encoding="UTF-8"?>
<code_scheme name="Bazaarvoice">
<option name="FIELD_NAME_PREFIX" value="_" />
<option name="CLASS_COUNT_TO_USE_IMPORT_ON_DEMAND" value="999" />
<option name="NAMES_COUNT_TO_USE_IMPORT_ON_DEMAND" value="999" />
<option name="JD_DO_NOT_WRAP_ONE_LINE_COMMENTS" value="true" />
<XML>
<option name="XML_LEGACY_SETTINGS_IMPORTED" value="true" />
</XML>
<codeStyleSettings language="JAVA">
@bbeck
bbeck / setup.sh
Created June 27, 2012 03:53
Setup Asgard on Ubuntu 12.04
#################
# Update packages
#################
DEBIAN_FRONTEND="noninteractive" sudo apt-get --assume-yes update
DEBIAN_FRONTEND="noninteractive" sudo apt-get --assume-yes upgrade
########################
# Install the Oracle JDK
########################
@bbeck
bbeck / Thread Dump
Created June 26, 2012 03:28
Asgard Issues
Debugger attached successfully.
Server compiler detected.
JVM version is 20.0-b12
Deadlock Detection:
No deadlocks found.
Thread 10819: (state = BLOCKED)
- java.lang.Thread.sleep(long) @bci=0 (Interpreted frame)
- com.amazonaws.http.IdleConnectionReaper.run() @bci=3, line=75 (Interpreted frame)
@bbeck
bbeck / EnsurePathBug.java
Created June 7, 2012 22:01
EnsurePath bug
import com.google.common.io.Closeables;
import com.netflix.curator.framework.CuratorFramework;
import com.netflix.curator.framework.CuratorFrameworkFactory;
import com.netflix.curator.retry.RetryNTimes;
import com.netflix.curator.test.TestingServer;
import com.netflix.curator.utils.EnsurePath;
public class EnsurePathBug {
public static void main(String[] args) throws Exception {
int iteration = 0;
@bbeck
bbeck / EphemeralNodeTest.java
Created May 31, 2012 23:01
Curator ephemeral node test that fails...
package curator;
import com.google.common.base.Strings;
import com.google.common.base.Throwables;
import com.google.common.io.Closeables;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import com.netflix.curator.framework.CuratorFramework;
import com.netflix.curator.framework.CuratorFrameworkFactory;
import com.netflix.curator.framework.state.ConnectionState;
import com.netflix.curator.framework.state.ConnectionStateListener;