Skip to content

Instantly share code, notes, and snippets.

View kellymclaughlin's full-sized avatar
🏠
Working from home

Kelly McLaughlin kellymclaughlin

🏠
Working from home
View GitHub Profile
@kellymclaughlin
kellymclaughlin / luwak_file_iterate.erl
Created November 29, 2011 16:50
Luwak inspection
Fun = fun(C, File) ->
{ok, TLObj} = C:get(<<"luwak_tld">>, File, 2),
{_, TLVal} = hd(riak_object:get_contents(TLObj)),
FileRoot = proplists:get_value(root, TLVal),
{ok, RootObj} = C:get(<<"luwak_node">>, FileRoot),
{_, RootVal} = hd(riak_object:get_contents(RootObj)),
{_, _, ChunkKeys} = RootVal,
[begin
case C:get(<<"luwak_node">>, K) of
{ok, _} ->

Setting up the Emacs daemon on OS X

Warning: I only use terminal emacs so I have no idea how well this will work otherwise.

Install emacs 23 or later.

Here's what I use to get the very latest emacs goodies:

sudo brew install emacs --cocoa --use-git-head --HEAD
@kellymclaughlin
kellymclaughlin / pb_status_anon.txt
Created September 28, 2012 21:18
How to get poolboy status for each Riak Vnode
PBStatusFun = fun() ->
VnodePids = [Pid || {_, Pid} <- riak_core_vnode_manager:all_index_pid(riak_kv_vnode)],
Links = [process_info(Pid, [links]) || Pid <- VnodePids],
WorkerPoolPids = [WPPid || [{links,[_, WPPid]}] <- Links],
WorkerPoolLinks = [process_info(Pid, [links]) || Pid <- WorkerPoolPids],
PoolboyPids = [PoolboyPid || [{links,[_, PoolboyPid]}] <- WorkerPoolLinks],
[poolboy:status(Pid) || Pid <- PoolboyPids]
end.
PBStatusFun = fun(Index) ->
@kellymclaughlin
kellymclaughlin / gist:3834437
Created October 4, 2012 15:32
Change # of schedulers online
%% Get current number of online schedulers
Schedulers = erlang:system_info(schedulers_online).
%% Reduce number online to 1
erlang:system_flag(schedulers_online, 1).
%% Restore to original number of online schedulers
erlang:system_flag(schedulers_online, Schedulers).
@kellymclaughlin
kellymclaughlin / node1-after.txt
Created November 3, 2012 22:07
Stuck Schedulers: Before and after changing online schedulers from 64 to 1 and back to 64
(riak@node1)1> schedstat:run().
<0.3422.460>
=== in scheduler count===
[{1,65},
{2,5},
{3,0},
{4,0},
{5,14},
{6,73},
{7,0},
@kellymclaughlin
kellymclaughlin / gist:4043845
Created November 9, 2012 05:16
riakc PUT with 2I
Indexes = [{<<"index1_bin">>, <<"val">>},
{<<"index2_int">>, 1}],
Meta = dict:store(<<"index">>, Indexes, dict:new()),
Obj = riakc_obj:new(<<"mybucket">>, <<"mykey">>, <<"myval">>),
Obj1 = riakc_obj:update_metadata(Obj, Meta),
riakc_pb_socket:put(RiakPid, Obj1).
@kellymclaughlin
kellymclaughlin / httpraw.config
Created December 4, 2012 04:46
Webmachine benchmark results
{mode, max}.
{duration, 120}.
{concurrent, 30}.
{driver, basho_bench_driver_http_raw}.
{code_paths, ["deps/ibrowse"]}.
diff --git a/rebar.config b/rebar.config
index dc5bd68..b475012 100644
--- a/rebar.config
+++ b/rebar.config
@@ -4,6 +4,6 @@
{edoc_opts, [{preprocess, true}]}.
{deps, [
- {mochiweb, "1.5.1", {git, "git://github.com/basho/mochiweb",
- {tag, "1.5.1-riak-1.0.x-fixes"}}}
22:58:43:s3tmp $ s3cmd -c ~/.s3cfg-amz mb s3://kellys_bucket
Bucket 's3://kellys_bucket/' created
10:12:51:s3tmp $ s3cmd -c ~/.s3cfg-amz mb s3://kellys_bucket
Bucket 's3://kellys_bucket/' created
10:12:52:s3tmp $ s3cmd -c ~/.s3cfg-amz mb -v -d s3://kellys_bucket
DEBUG: ConfigParser: Reading file '/Users/kelly/.s3cfg-amz'
DEBUG: ConfigParser: access_key->AK...17_chars...Q
DEBUG: ConfigParser: bucket_location->US
DEBUG: ConfigParser: cloudfront_host->cloudfront.amazonaws.com
DEBUG: ConfigParser: cloudfront_resource->/2010-07-15/distribution
#!/bin/sh
oIFS=$IFS
IFS="
"
ROOTDIR=`pwd`
if [ "$1" = "-p" ]; then
PRINT=1
else