Skip to content

Instantly share code, notes, and snippets.

View binarytemple's full-sized avatar

Bryan Hunt binarytemple

  • The mountains of mourne
View GitHub Profile

Wrapper shell script:

$ cat ./riak_cs_inspector.sh
#!/bin/bash
ERL_LIBS=dev/dev1/lib dev/dev1/erts-5.9.3.1/bin/escript \
    dev/dev1/lib/riak_cs/priv/tools/internal/riak_cs_inspector.erl $*

Usage:

@binarytemple
binarytemple / ring.erl.converted.for.tanodb.mark
Last active November 18, 2015 17:40 — forked from bsparrow435/ring.erl
tanodb getting preflist
```
Calc = fun(Bucket,Key) ->
BKey = {Bucket,Key},
{ok, Ring} = riak_core_ring_manager:get_my_ring(),
DocIdx = riak_core_util:chash_key(BKey),
NValue = 1,
UpNodes = riak_core_node_watcher:nodes(tanodb),
Preflist2 = riak_core_apl:get_apl_ann(DocIdx, NValue, Ring, UpNodes),
[Res] = [Part || {{Part,Node}, Type} <- Preflist2],
Res
%%% Run with 'escript app_deps.erl'
%%% Change the path in filelib:wildcard/1 as required to capture all
%%% your dependencies.
%%%
%%% Rectangular nodes will represent library apps (no processes involved)
%%% and the circular nodes will represent regular apps. An arrow going from
%%% 'A -> B' means 'A depends on B'.
%%%
%%% This script depends on graphviz being present on the system.
-module(app_deps).
%%% Run with 'escript app_deps.erl'
%%% Change the path in filelib:wildcard/1 as required to capture all
%%% your dependencies.
%%%
%%% Rectangular nodes will represent library apps (no processes involved)
%%% and the circular nodes will represent regular apps. An arrow going from
%%% 'A -> B' means 'A depends on B'.
%%%
%%% This script depends on graphviz being present on the system.
-module(app_deps).
/*
* This file is provided to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-module(localstream).
-export([load/1, keys/0, bucket/0, map/3]).
-define(QUERY, [{map, {modfun, localstream, map}, none, true}]).
load(HowMany) ->
{ok, Client} = riak:local_client(),
lists:foreach(fun(Index) ->
BIndex = list_to_binary(integer_to_list(Index)),
{ok, C} = riak:local_client().
{ok, Obj} = C:get(<<"bucket">>, <<"key">>).
iolist_size(term_to_binary(Obj)).
{ok, C} = riak:local_client().
{ok, Buckets} = C:list_buckets().
[ lk:fsm(B) || B <- Buckets ].
import urllib
import httplib
import json
import sys
def get_stats(ip, port=80):
url = 'http://%s:%s/stats' % (ip, port)
sock = urllib.urlopen(url)
jsons = sock.read()
obj = json.loads(jsons)