Skip to content

Instantly share code, notes, and snippets.

View jaredmorrow's full-sized avatar

Jared Morrow jaredmorrow

View GitHub Profile
........................................
......... ..........
....... ........
..... ......
.... .....
... ....... ....
.. ....... .. ...
. .......... .. ..
. ....... .... .. .
. ..... ..... .
@aschepis
aschepis / config.erl
Created August 24, 2011 17:37
Updating properties in a riak config file
#!/usr/bin/env escript
-export([main/1]).
main([]) ->
{ok,[AppConfig]} = file:consult("app.config"),
[Http] = get_config_value(AppConfig, riak_core, http),
io:format("HTTP Address: ~p~n", [Http]),
Updated = update_config_value(AppConfig, riak_core, http, [{"0.0.0.0", 8080}]),
io:format("Original Values:~n~p~n", [AppConfig]),
io:format("Updated Values:~n~p~n", [Updated]).
@jaredmorrow
jaredmorrow / ssh pub key
Created September 6, 2011 23:58
Jared (Basho) SSH Public Key
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAtcK9RaMacrCGw33ALoPDXm85VsmSFe33qg4yjg+/2QWs1ti7HYgS1uCnfuP9/kuYaNK1MbGfk2l1rScSwKv3GP+uyDttKTRQPkLJEmcqaoSv3tjfl1rG44IuKGIGNrcVWGF2/5qGp4r64BRMPzsJi8LSeEAPMulM7KcZLEdXIf1vsBPa8HMFbUUrYIIfI6xzKgOFA2fBedsrVKd+dn+sYb7lRkDWCVmabqHz/Q8nV\
km9tZ/4EHrbHllDicBhCc+wOP+Z7vIk0r2o1Cc4l2ArElVi0F7z8ipAU9jsl3yjfyzhtNdBgiiosgLAwIpHwbsiqVaFqHadqSrcuvDM2PrhVw== jared@basho.com
if [ ! $# == 2 ]; then
echo "Usage: $( basename $0 ) /path/to/bin/riak dest_dir"
exit
fi
src_riak_script="$1"
src_riak_root="$( cd -P "$( dirname "$1" )" && pwd )"
src_riak_admin_script="$src_riak_root/riak-admin"
src_riak_search_cmd="$src_riak_root/search-cmd"
-module(timeit).
-export([timeit/3,
timeit/4,
timeit/5]).
-export([simple_test/0]).
timeit(Mod, Fun, Arity) ->
timeit(all, Mod, Fun, Arity, undefined).
gsed -i -e 's:OpenSolaris:OmniOS:g' $TMPDIR/$BUILDDIR/package/Makefile
$MAKE clean
CC=gcc CXX=g++ CFLAGS="-m64" $MAKE -C package buildrel REPO=riak REPO_TAG=riak-$VER PKG_VERSION=$VER
mkdir -p $DESTDIR/$PREFIX
cp -r -p rel/riak/* $DESTDIR/$PREFIX/
license LICENSE license=Apache2
group gid=98 groupname=riak
user ftpuser=false gcos-field="Riak Server" group=riak login-shell=/usr/bin/bash password=NP uid=98 username=riak home-dir=/opt/riak/etc
<transform dir path=opt/riak/data.* -> set owner riak>
<transform dir path=opt/riak/data.* -> set group riak>
<transform dir path=opt/riak/log.* -> set owner riak>
<transform dir path=opt/riak/log.* -> set group riak>
<transform dir path=opt/riak/etc -> set owner riak>
<transform dir path=opt/riak/etc -> set group riak>
<transform file path=opt/riak/etc/.* -> set owner riak>

I've been playing more with this Erlang factoring technique. As an exercise, I've been trying to force myself to adopt the method, by writing functions that are 3 or less lines long (function clauses actually, so multiple pattern-matched claues are OK).

Death to receive expressions

One place I noticed was causing myself

@serby
serby / gist:3933039
Created October 22, 2012 18:05
Increase max file descriptors SmartOS
projdel node
projadd -c "node settings" -U admin -G staff -K "process.max-file-descriptor=(basic,65535,deny)" node
svccfg -s node-nodestack-service setprop 'method_context/project=node'
svcadm disable node-nodestack-service
svcadm enable node-nodestack-service
pgrep node
@kevsmith
kevsmith / bench.erl
Last active December 14, 2015 07:09
Simple Erlang message passing benchmark
-module(bench).
-export([run_suite/3, run/1]).
run_suite(Name, Passes, Messages) ->
Results = run_suite1(Passes, Messages, []),
Avg = lists:sum(Results) / Passes,
StdDev = math:sqrt(lists:sum([math:pow(X - Avg, 2) || X <- Results]) / Passes),
Summary = [{avg, Avg}, {stddev, StdDev}, {min, lists:min(Results)},
{max, lists:max(Results)}],