Skip to content

Instantly share code, notes, and snippets.

View lukebakken's full-sized avatar

Luke Bakken lukebakken

View GitHub Profile
package main
import "fmt"
// fibonacci is a function that returns
// a function that returns an int.
func fibonacci() func() int {
x0, x1 := 0, 1
return func() (f int) {
f = x0 + x1
@lukebakken
lukebakken / Makefile
Last active September 28, 2015 18:34
Riak - Go client examples
.PHONY: all install-deps lint run
PROJDIR = $(realpath $(CURDIR))
RUNCMD = go run $(wildcard *.go)
all: install-deps lint run
install-deps:
go get -t ./...
git clone git://github.com/basho/riak_pb.git
(cd riak_pb && git checkout --track end-to-end/timeseries)

git clone git://github.com/basho/riak-python-client.git
(cd riak-python-client && git checkout --track end-to-end/timeseries)

Build Riak PB messages for Python. This requires the protoc command to be in your PATH. Your distro may have a protoc or protobuf package, or you can build from source easily (installs to /usr/local/bin/protoc):

@lukebakken
lukebakken / querying-data.py
Last active December 5, 2015 19:01
Riak TS / Python examples
import datetime
from riak.client import RiakClient
epoch = datetime.datetime.utcfromtimestamp(0)
def unix_time_millis(dt):
td = dt - epoch
return int(td.total_seconds() * 1000.0)
tenMins = datetime.timedelta(0, 600)

Keybase proof

I hereby claim:

  • I am lukebakken on github.
  • I am krakken (https://keybase.io/krakken) on keybase.
  • I have a public key whose fingerprint is E778 02C6 EEEB EABC DC03 2495 1074 AF46 F589 A49C

To claim this, I am signing this object:

@lukebakken
lukebakken / advanced.config
Last active September 7, 2023 14:49
Verify Riak precommit hook
[
{riak_kv, [
{add_paths, ["/home/lbakken/Projects/customers/riak-users/sanket-agrawal/"]}
]}
].
@lukebakken
lukebakken / di-configure-object.md
Last active July 30, 2016 14:57
di-configure-object
public interface IYoMamaService
{
    bool IsSoFat { get; }
}

public interface IYoMamaServiceConfig
{
    int SoFatSize { get; }
}
@lukebakken
lukebakken / nuke-gems
Created August 1, 2016 20:01
Remove all gems in your rbenv environment
#!/usr/bin/env bash
RBENV_ROOT="$HOME/.rbenv"
if [[ -d "$RBENV_ROOT/bin" ]]
then
export RBENV_ROOT
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
else
echo "Expected to find rbenv in $RBENV_ROOT!" 2>&1
@lukebakken
lukebakken / ruby-1.9.3-ext-openssl-extconf.rb.patch
Last active November 18, 2016 18:38
Ruby 1.9.3 on Arch Linux
diff --git a/ext/openssl/extconf.rb b/ext/openssl/extconf.rb
index 8c04cb5..132d803 100644
--- a/ext/openssl/extconf.rb
+++ b/ext/openssl/extconf.rb
@@ -104,6 +104,9 @@
have_func("SSLv2_method")
have_func("SSLv2_server_method")
have_func("SSLv2_client_method")
+have_func("SSLv3_method")
+have_func("SSLv3_server_method")
@lukebakken
lukebakken / haproxy.conf
Last active November 23, 2016 17:44
Riak / haproxy
global
log /dev/log local0 info
pidfile /home/lbakken/run/haproxy.pid
defaults
log global
timeout connect 1s
timeout client 50ms
timeout server 1s