Skip to content

Instantly share code, notes, and snippets.

View platinumthinker's full-sized avatar
🌐
Waiting

PlatinumThinker platinumthinker

🌐
Waiting
View GitHub Profile
#!/usr/bin/env escript
-include_lib("kernel/include/inet.hrl").
-include_lib("kernel/include/inet_sctp.hrl").
main([Protocol, IP, Port, Len, Cnt]) ->
bench(list_to_atom(Protocol), inet:parse_address(IP),
list_to_integer(Port), list_to_integer(Len), list_to_integer(Cnt));
main(_) ->
io:format("invalid arguments~n~n"),
@platinumthinker
platinumthinker / latency.markdown
Created May 30, 2017 17:52 — forked from mjt0704/latency.markdown
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@platinumthinker
platinumthinker / LTTng+erlang:trace
Last active June 21, 2017 08:35 — forked from bokner/LTTng+erlang:trace
LTTng+erlang:trace for tracing function calls/returns
1> l(dyntrace).
{module,dyntrace}
2> erlang:trace_pattern({'_','_','_'}, [{'_', [], [{return_trace}]}], [local]). %% For function_call info
3> erlang:trace_pattern({'_','_','_'}, [{'_', [], [{exception_trace}]}], [local]). %% For exception info
4> erlang:trace(all, true, [call,'receive', send, {tracer,dyntrace,[]}]). %% Trace function calls with dyntrace (i.e. LTTng) and messaging
26
5> erlang:now(). %% Or whatever function call you want to trace. See the traces coming in LTTng log.
@platinumthinker
platinumthinker / compact.cpp
Created December 30, 2015 10:16 — forked from Wunkolo/compact.cpp
Ascii Raymarcher
#include <math.h>
#include <algorithm>
#include <string>
#include <pmmintrin.h>
using namespace std;typedef float R;
#define _W 79
#define _H 39
#define EP 0.01f
#define OP operator
#define C const