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
-module(timeit).
-compile(export_all).
%% @doc Dynamically add timing to MFA. There are various types of
%% timing.
%%
%% all - time latency of all calls to MFA
%%
%% {sample, N, Max} - sample every N calls and stop sampling after Max
%%

Summary

I'm trying to figure out how to use rebar to:

  • create erlang project
  • add a dependency on an erlang module from github
  • start the app via the erl console
  • create a release and start the app from the release (via the generated scripts)
import scala.concurrent.duration._
import scala.concurrent.ExecutionContext
import scala.concurrent.Future
import akka.pattern.after
import akka.actor.Scheduler
/**
* Given an operation that produces a T, returns a Future containing the result of T, unless an exception is thrown,
* in which case the operation will be retried after _delay_ time, if there are more possible retries, which is configured through
* the _retries_ parameter. If the operation does not succeed and there is no retries left, the resulting Future will contain the last failure.
From 005be2e442074ea529ae0a188399eda553cb8783 Mon Sep 17 00:00:00 2001
From: evan <evan@basho.com>
Date: Tue, 18 Jun 2013 17:52:54 -0400
Subject: [PATCH] backport sfwi to R15B01
---
erts/emulator/beam/erl_init.c | 16 +++++++
erts/emulator/beam/erl_process.c | 89 ++++++++++++++++++++++++++++++++++++--
erts/emulator/beam/erl_process.h | 9 ++++
erts/etc/common/erlexec.c | 1 +
@binarytemple
binarytemple / 2i.markdown
Last active August 29, 2015 14:03 — forked from kellymclaughlin/gist:4043845
riakc secondary index put

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).

-module(cs_manifest_siblings).
-compile(export_all).
start() ->
start(1).
%% @doc Trace to determine the number of siblings of Riak CS manifest
%% objects. The `Threshold' parameter is used to limit the output to
%% manifest objects whose sibling count is >= to `Threshold'.
start(Threshold) ->
#!/usr/bin/env escript
%% -*- coding: utf-8 -*-
%%! -pa /usr/lib64/riak-cs/lib/riakc-1.3.1.1/ebin /usr/lib64/riak-cs/lib/riak_pb-1.3.0/ebin /usr/lib64/riak-cs/lib/protobuffs-0.8.0/ebin /usr/lib/riak-cs/lib/riakc-1.3.1.1/ebin /usr/lib/riak-cs/lib/riak_pb-1.3.0/ebin /usr/lib/riak-cs/lib/protobuffs-0.8.0/ebin /usr/lib/riak-cs/ebin
-include_lib("riak_cs/include/riak_cs.hrl").
-define(USERS_BUCKET, <<"moss.users">>).
-define(DEFAULT_RIAK_IP, "127.0.0.1").
-define(DEFAULT_RIAK_PORT, 8087).
%% 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).
-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;
%% Old version. Boo!!
tenant_id(TokenItems) ->
{struct, AccessItems} = proplists:get_value(<<"access">>, TokenItems, []),
{struct, UserItems} = proplists:get_value(<<"user">>, AccessItems, []),
case proplists:get_value(<<"tenantId">>, UserItems) of
undefined ->
failed;
TenantId ->
{ok, TenantId}
end.