Skip to content

Instantly share code, notes, and snippets.

View russelldb's full-sized avatar

Russell Brown russelldb

View GitHub Profile
# Config for Nginx to act as a front-end for Riak
# The main goal is to proxy all GETs directly to Riak, and disallow anything else (POST, PUT, etc)
# Also, disallow use of the map/reduce query links (i.e. /riak/bucket/key/_,_,_)
# Config is in /etc/nginx/sites-available/default or somewhere like that
# Set up load-balancing to send requests to all nodes in the Riak cluster
# Replace these IPs/ports with the locations of your Riak nodes
upstream riak_hosts {
server 127.0.0.1:8098;
1) Use build_flymake.sh to compile flymake.erl into the eflymake script.
2) Replace your existing eflymake script with the newly built one.
NOTE: Don't forget to make a back up copy of your original eflymake in case this one has bugs!
.mouse, #preview{
position: absolute;
background-repeat: no-repeat;
height: 22px;
min-width: 15px;
z-index: 100;
}
.mouse{
background-image: url('../images/cursor.png');
cp -R path/to/old/release app_0.9
cp -R path/to/new/release app_1.0
cp app_1.0/releases/1.0/app.rel app_1.0.rel
LIBPATH="app_0.9/releases/*/ */lib/*/ebin"
erl +Bd -noinput -noshell -pa $LIBPATH -eval 'systools:make_relup("app_1.0", ["app"], ["app"])' -run init stop
erl +Bd -noinput -noshell -pa $LIBPATH -eval 'systools:make_script("app_1.0", [] )' -run init stop
erl +Bd -noinput -noshell -pa $LIBPATH -eval 'systools:make_tar("app_1.0")' -run init stop
tar zxvf app_1.0.tar.gz
cp app_1.0/releases/1.0/start_clean.boot releases/1.0/
cd releases/1.0/
@cstar
cstar / gist:970445
Created May 13, 2011 12:33
Fake your webmachine requests for unit testing.
make_wrq(Method, RawPath, Headers) ->
{ok, Dispatch} = file:consult(filename:join(
[filename:dirname(code:which(?MODULE)),
"..", "priv", "dispatch.conf"])),
R0 = wrq:create(Method, {1,1}, RawPath, mochiweb_headers:from_list(Headers)),
R1 = wrq:set_peer("127.0.0.1", R0),
{_, _, HostTokens, Port, PathTokens, Bindings, AppRoot, StringPath} =
webmachine_dispatcher:dispatch("127.0.0.1", RawPath, Dispatch),
wrq:load_dispatch_data(Bindings,
HostTokens,
@jonm
jonm / shallow-vs-deep.html
Created December 8, 2011 02:08
Shallow vs. deep representations in XHTML Hypermedia APIs
<html>
<body>
<!-- the following div is a sample representation of a 'car' domain object; it can be identified as
such by the presence of 'car' in its @class. In this case, the car has two attributes, a make
and a model, and both are included right here. This is what I call a deep/complete/concrete
representation. -->
<div id="car123" class="car">
<span class="make">Ford</span>
<span class="model">Mustang</span>
</div>
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active May 23, 2024 18:01
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname

on the guest SmartOS VM

pkg_add http://pkgsrc.joyent.com/sdc6/2012Q1/i386/All/smtools
# note this is going to shut down the VM
sm-prepare-image

on the global zone

@argv0
argv0 / gist:3372596
Created August 16, 2012 18:49
Getting detailed per-request timing in Riak
(riak@127.0.0.1)1> {ok, C} = riak:local_client().
{ok,{riak_client,'riak@127.0.0.1',undefined}}
(riak@127.0.0.1)2> Object = riak_object:new(<<"testbucket">>, <<"testkey">>, <<"testvalue">>).
{r_object,<<"testbucket">>,<<"testkey">>,
[{r_content,{dict,0,16,16,8,80,48,
{[],[],[],[],[],[],[],[],[],[],[],[],[],[],...},
{{[],[],[],[],[],[],[],[],[],[],[],[],...}}},
<<"testvalue">>}],
[],
{dict,1,16,16,8,80,48,

Step 1: From you logs I have decoded the bucket/key

binary_to_term(<<131,109,0,0,0,9,85,114,108,84,111,83,99,97,110>>).
<<"UrlToScan">>
binary_to_term(<<131,109,0,0,0,61,104,116,116,112,37,51,97,37,50,102,37,50,102,119,119,119,46,97,110,104,114,105,46,110,101,116,37,50,102,37,51,102,102,101,101,100,37,51,100,114,115,115,50,37,50,54,97,109,112,37,51,98,112,37,51,100,55,51,49,49,48>>).
<<"http%3a%2f%2fwww.anhri.net%2f%3ffeed%3drss2%26amp%3bp%3d73110">>

Step 2: Please run the below snippits from riak attach to identify the owning partitions of this bucket/key