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
#!/bin/bash
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
brew install asdf
ASDF_CONF=$(
cat <<EOF
export ASDF_DIR="$(brew --prefix asdf)"
. ${ASDF_DIR}/asdf.sh
@binarytemple
binarytemple / b2f.erl
Created April 29, 2020 10:32 — forked from kevsmith/b2f.erl
Erlang/Elixir BEAM decompiler
#! /usr/bin/env escript
%% -*- mode: erlang -*-
%% -*- tab-width: 4;erlang-indent-level: 4;indent-tabs-mode: nil -*-
%% ex: ts=4 sw=4 ft=erlang et
%%
%% Copyright 2016 Operable, Inc. All Rights Reserved.
%%
%% This file is provided to you under the Apache License,
%% Version 2.0 (the "License"); you may not use this file
@binarytemple
binarytemple / UserMetadata.java
Created October 17, 2017 10:22 — forked from angrycub/UserMetadata.java
Using User Metadata on a Riak Object
// Build Test Data
IRiakObject cat = RiakObjectBuilder.newBuilder("Pets-Template", "Cat").
withValue("{\"sound\":\"Meow\",\"legs\":4}").
build();
rc.store(cat);
// Build User Metadata Map
Map<String, String> usermeta = new HashMap<String, String>();
usermeta.put("parentLinkBucket", "Pets-Template");
usermeta.put("parentLinkKey", "Cat");
@binarytemple
binarytemple / graph_ring
Created October 17, 2017 10:22 — forked from angrycub/graph_ring
Escript to Graph a Riak Ring using HTML5 and Graph.JS
#!/usr/bin/env escript
%% -*- erlang -*-
%%! -smp enable -sname graph_ring -mnesia debug verbose
main([RingFile, OutFile]) ->
{ok, Binary} = file:read_file(RingFile),
Ring = binary_to_term(Binary),
OwnerList = element(2,element(4,Ring)),
%io:format("~s~n", [lists:flatten(header(body(footer([]),OwnerList)))]);
Compute_Next = fun(Ring1,Ring2) ->
Owners1 = riak_core_ring:all_owners(Ring1),
Owners2 = riak_core_ring:all_owners(Ring2),
Owners3 = lists:zip(Owners1, Owners2),
[{Idx, PrevOwner, NewOwner, [], awaiting}
|| {{Idx, PrevOwner}, {Idx, NewOwner}} <- Owners3,
PrevOwner /= NewOwner]
end.
N = app_helper:get_env(riak_core,target_n_val,4),
#!/usr/bin/env escript
%% -*- erlang -*-
%%! -smp enable -sname convert_binary_ring -mnesia debug verbose
main([RingFile, OutFile]) ->
try
{ok, Binary} = file:read_file(RingFile),
Ring = binary_to_term(Binary),
try
file:write_file(OutFile, io_lib:format("~p.~n", [Ring])),
@binarytemple
binarytemple / QueryingRiakSearch2.0.md
Created October 17, 2017 10:22 — forked from angrycub/QueryingRiakSearch2.0.md
Querying Riak Search 2.0
@binarytemple
binarytemple / configuration.md
Created October 17, 2017 10:22 — forked from angrycub/configuration.md
Configuring PostFix on OSX 10.10

##Configure Postfix for Gmail SMTP## ###Edit file /etc/postfix/main.cf###

sudo vim /etc/postfix/main.cf

and add in the following to the bottom of the file:

relayhost = [smtp.gmail.com]:587
@binarytemple
binarytemple / GetInfoByModule.erl
Created October 17, 2017 10:22 — forked from angrycub/GetInfoByModule.erl
Get Info and Status by Module
GetInfoAndStatusByModule = fun (Module) ->
IsProcessInModule = fun (Module, ProcessInfo) ->
case proc_lib:translate_initial_call(ProcessInfo) of
{ICMod, _ICFun, _ICArity} when Module =:= ICMod -> true;
_ -> false
end
end,
ProcessTable = erlang:processes(),
CurriedPredicate = fun (P) -> IsProcessInModule(Module, P) end,
Pids = lists:filter(CurriedPredicate, ProcessTable),
@binarytemple
binarytemple / MonitoringRiak.md
Created October 17, 2017 10:22 — forked from angrycub/MonitoringRiak.md
Additional Information about Monitoring Riak

Additional Information about Monitoring Riak

Riak is a complex system that includes many moving parts to monitor, such as the health of the hardware, the well-being of the software, and the responsiveness of the network. This document will discuss metrics, thresholds, and values that indicate when your monitoring system should be sending alarms.

System metrics to monitor