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
@bdha
bdha / gist:c456cf6e5484ea5ad256
Last active August 29, 2015 14:15
Building Haskell on SmartOS
@kellymclaughlin
kellymclaughlin / bitcask_merge.erl
Last active July 14, 2017 17:12
An Erlang module to induce Riak to merge all bitcask data directories. **WARNING** It is not advisable to use this on a production system. There could be significant impact to request latencies.
-module(bitcask_merge).
-export([merge_dirs/0]).
bitcask_data_dir() ->
bitcask_data_dir(application:get_env(riak_kv, multi_backend),
application:get_env(bitcask, data_root)).
bitcask_data_dir(undefined, undefined) ->
undefined;
@vinoski
vinoski / fd_setsize_on_osx.md
Last active November 7, 2017 06:20
How to raise the maximum number of file descriptors when building Erlang/OTP on OS X.

When you build Erlang/OTP on OS X, it unfortunately defaults to handling a maximum of 1024 file descriptors. You can get around this limitation with the right combination of configuration options and manual changes to a generated config file.

First, go into your unpacked Erlang/OTP source directory and run the following command, replacing the value 10000 with whatever value you want for max file descriptors:

perl -i -pe 's/(define\s+FD_SETSIZE\s+)\d+/\1 10000/' erts/config.h.in 

Next, when you run configure in your Erlang/OTP source directory, be sure to include the right CFLAGS setting, as shown below:

CFLAGS='-DREDEFINE_FD_SETSIZE -DFD_SETSIZE=15000 -D_DARWIN_UNLIMITED_SELECT' ./configure --enable-kernel-poll <other options>
@kellymclaughlin
kellymclaughlin / ring_examples.erl
Created September 20, 2011 16:50
Examining the Riak ring
%% Get the state for the local node
%% The get_my_ring function really returns the ring
%% plus other state information about the cluster.
{ok, State} = riak_core_ring_manager:get_my_ring().
%% Get number of partitions
riak_core_ring:num_partitions(State).
%% Get the names of custom buckets
riak_core_ring:get_buckets(State).
@kellymclaughlin
kellymclaughlin / 2i_queries.txt
Created July 25, 2011 16:37
2I test queries
# Index some documents...
curl -v -X PUT \
-d 'data1' \
-H "Content-Type: application/json" \
-H "x-riak-index-field1_bin: val1" \
-H "x-riak-index-field2_int: 1001" \
http://127.0.0.1:8098/riak/mybucket/mykey1
curl -v -X PUT \