Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
set -e
USERNAME=
TOKEN=
METRIC=
SLEEP=5
probe() {
diff -ur zkc-3.4.5-orig/c/src/zookeeper.c zkc-3.4.5/c/src/zookeeper.c
--- zkc-3.4.5-orig/c/src/zookeeper.c 2012-09-30 10:53:32.000000000 -0700
+++ zkc-3.4.5/c/src/zookeeper.c 2013-09-07 21:25:24.000000000 -0700
@@ -1650,14 +1650,16 @@
// a PING
if (zh->state==ZOO_CONNECTED_STATE) {
send_to = zh->recv_timeout/3 - idle_send;
- if (send_to <= 0 && zh->sent_requests.head==0) {
-// LOG_DEBUG(("Sending PING to %s (exceeded idle by %dms)",
-// format_current_endpoint_info(zh),-send_to));
require 'zookeeper'
require 'zk-server'
require 'fileutils'
require 'tmpdir'
SLEEP_TIME = 30
STDOUT.sync = true
if ENV['DEBUG']
def zookeeper_logger(from)
describe :child_watcher_behavior do
describe :async_watch, :async => true do
it_should_behave_like "all success return values"
before do
@watcher = Zookeeper::Callbacks::WatcherCallback.new
@cb = Zookeeper::Callbacks::StringsCallback.new
@rv = zk.get_children(:path => path, :watcher => @watcher, :watcher_context => path, :callback => @cb, :callback_context => path)
wait_until { @cb.completed? }
@eric
eric / gist:6432496
Last active December 22, 2015 06:39
(def levels {:trace org.apache.log4j.Level/TRACE
:debug org.apache.log4j.Level/DEBUG
:info org.apache.log4j.Level/INFO
:warn org.apache.log4j.Level/WARN
:error org.apache.log4j.Level/ERROR
:fatal org.apache.log4j.Level/FATAL})
(defn set-level
"Set the level for the given logger, by string name. Use:
(set-level \"skuld.node\", :debug)"
@eric
eric / README.md
Last active December 21, 2015 20:39
Steps to get Sentry working over SSL on the JVM

Sentry and the JVM

Unfortunately Java's built-in cacerts do not include StartCom SSL root certificates.

Because of this, you must tell java to trust these certificates.

The easiest way I've found to do it is as follows:

1. Make a copy of the JRE cacerts

@eric
eric / README.md
Last active December 21, 2015 08:09
Get graphs directly from codahale/metrics
// Originally from:
// * http://blog.stephenboak.com/2011/08/07/easy-as-a-pie.html
// * http://jsfiddle.net/stephenboak/hYuPb/
//
// Improved by Eric Lindvall to be more d3-ish
function donutChart() {
var width = 450;
var height = 300;
var radius = 100;
reader: zookeeper: initiating connection to localhost:2181
reader: zookeeper: #zkc_set_running_and_notify!
reader: zookeeper: #event_thread_body starting event thread
reader: zookeeper: init returned!
reader: zookeeper: event_thread waiting until running: true
reader: zookeeper: event_thread running: true
zookeeper_server: Accepted socket connection from /fe80:0:0:0:0:0:0:1%1:54365
zookeeper_server: Accepted socket connection from /127.0.0.1:54366
zookeeper_server: Session establishment request from client /fe80:0:0:0:0:0:0:1%1:54365 client's lastZxid is 0x0
zookeeper_server: Connection request from old client /fe80:0:0:0:0:0:0:1%1:54365; will be dropped if server is in r-o mode
# from https://github.com/slyphon/zk/issues/68
require 'zk'
ZK_PATH = '/test/path/child'
CHILD_PATH = ZK_PATH + '/foo'
SLEEP_TIME = 1
class Writer
def initialize(start_signal, finish_signal)