Follow these steps to install graphite on OS X Mavericks.
- Homebrew
- Python 2.7
- Git
% Using https://github.com/Feuerlabs/netlink | |
{ok, _} = application:ensure_all_started(lager). | |
{ok, _} = application:ensure_all_started(netlink). | |
{ok, Ref} = netlink:subscribe("eth1", all, [flush]). | |
% or | |
{ok, Ref} = netlink:subscribe("eth1", [address, operstate], [flush]). | |
flush(). |
#!/usr/bin/env escript | |
%%! -pa deps/chef_authn/ebin deps/mochijson2/ebin | |
% Deps: | |
% https://github.com/chef/chef_authn | |
% https://github.com/electricimp/mochijson2 | |
-record(opts, { | |
node_name, | |
client_key, |
#include <sys/types.h> | |
#include <sys/socket.h> | |
#include <netinet/in.h> | |
#include <netinet/tcp.h> | |
#include <stdio.h> | |
#include <memory.h> | |
#include <unistd.h> | |
int main(int argc, char *argv[]) | |
{ |
lists:sort(fun({_, X}, {_, Y}) -> X > Y end, | |
dict:to_list(lists:foldl( | |
fun(Pid, Dict) -> | |
InitialCall = case erlang:process_info(Pid, initial_call) of | |
{initial_call,{proc_lib,init_p,A}} -> | |
case erlang:process_info(Pid, dictionary) of | |
{dictionary, D} -> proplists:get_value('$initial_call', D, undefined); | |
_ -> {proc_lib,init_p,A} | |
end; | |
{initial_call,{erlang,apply,A}} -> |
%% from /usr/include/netinet/in.h (Linux and OS X) | |
-define(IPPROTO_TCP, 6). | |
%% from /usr/include/netinet/tcp.h (Linux) | |
-define(TCP_MAXSEG, 2). | |
-define(TCP_KEEPIDLE, 4). | |
-define(TCP_KEEPINTVL, 5). | |
-define(TCP_KEEPCNT, 6). | |
%% @doc If you pass multiple raw options to ssl:listen, it appears to drop all |
-module(partitionzipwith). | |
-export([partitionzipwith/3]). | |
%% @doc A combination of lists:partition/2 and lists:zipwith/3. | |
%% Given two lists of equal length, call Combine(X, Y) for each. | |
%% If it returns {true, T}, then T is added to Satisfying. | |
%% If it returns {false, F}, then F is added to NotSatisfying. | |
-spec partitionzipwith(Combine, List1, List2) -> | |
{Satisfying, NotSatisfying} | |
when |
-module(example_server). | |
-export([start_link/0, start/0]). | |
-behaviour(gen_server). | |
-export([init/1, handle_call/3, handle_cast/2, handle_info/2, terminate/2, code_change/3]). | |
start_link() -> | |
gen_server:start_link({local, ?MODULE}, ?MODULE, [], []). | |
start() -> | |
gen_server:start({local, ?MODULE}, ?MODULE, [], []). |
// To discover empegs connected over Ethernet, we need to broadcast a '?', and listen for the response | |
var dgram = new byte[] { 0x3F }; // ASCII '?' | |
var client = new UdpClient(new IPEndPoint(IPAddress.Any, 8300)); | |
client.EnableBroadcast = true; | |
client.Client.ReceiveTimeout = 500; | |
client.Send(dgram, dgram.Length, new IPEndPoint(IPAddress.Broadcast, 8300)); | |
const int retryCount = 10; | |
for (int i = 0; i < retryCount; ++i) | |
{ |