Skip to content

Instantly share code, notes, and snippets.

View vinoski's full-sized avatar

Steve Vinoski vinoski

View GitHub Profile
@vinoski
vinoski / riak-core-patch-for-17
Created December 1, 2014 04:26
unofficial riak_core changes for Erlang/OTP 17
diff --git a/include/riak_core_handoff.hrl b/include/riak_core_handoff.hrl
index 9956205..e34c4c8 100644
--- a/include/riak_core_handoff.hrl
+++ b/include/riak_core_handoff.hrl
@@ -30,7 +30,7 @@
transport_mon :: reference(),
timestamp :: tuple(),
status :: any(),
- stats :: dict(),
+ stats :: dict:dict(),
@vinoski
vinoski / gs.erl
Created April 6, 2016 19:00
example gen_server
-module(gs).
-behaviour(gen_server).
-export([start/0, stop/0]).
-export([init/1, handle_call/3, handle_cast/2, handle_info/2,
terminate/2, code_change/3]).
-record(state, {count}).
start() ->
@vinoski
vinoski / x.erl
Last active October 18, 2016 19:06
bitwise xor of bit lists
-module(x).
-export([lxor/2]).
%%% see http://stackoverflow.com/a/40098595/409228 for context
lxor(L1,L2) when is_list(L1), is_list(L2) ->
%% convert the input lists to binaries, then call lxor/2 on the results
lxor(list2bin(L1),list2bin(L2));
lxor(B1,B2) when is_binary(B1), is_binary(B2) ->
%% decode unsigned integers from the input binaries, then call lxor/2