Skip to content

Instantly share code, notes, and snippets.

@pnc
pnc / observer.md
Last active September 9, 2023 23:32
Using Erlang observer/appmon remotely

Using OTP's observer (appmon replacement) remotely

$ ssh remote-host "epmd -names"
epmd: up and running on port 4369 with data:
name some_node at port 58769

Note the running on port for epmd itself and the port of the node you're interested in debugging. Reconnect to the remote host with these ports forwarded:

$ ssh -L 4369:localhost:4369 -L 58769:localhost:58769 remote-host
@scy
scy / README.md
Last active July 7, 2023 09:27
My OSX PF config for #30C3.

My OS X “VPN only” Setup For #30C3

You should never let passwords or private data be transmitted over an untrusted network (your neighbor’s, the one at Starbucks or the company) anyway, but on a hacker congress like the #30C3, this rule is almost vital.

Hackers get bored easily, and when they’re bored, they’re starting to look for things to play with. And a network with several thousand connected users is certainly an interesting thing to play with. Some of them might start intercepting the data on the network or do other nasty things with the packets that they can get.

If these packets are encrypted, messing with them is much harder (but not impossible! – see the end of this article). So you want your packets to be always encrypted. And the best way to do that is by using a VPN.

Target audience

@angrycub
angrycub / process.md
Last active October 17, 2017 10:03
Using Force Remove to Change a nodes IP address.

##Using Force Replace to Change a nodes IP address. ###Objective Previous to Riak 1.2, a cluster node's IP address could be changed by running riak-admin reip on each cluster node. As of Riak 1.2, this method has been replaced with riak-admin cluster force-replace which is safer and does not require any downtime.

###Scenario

Riak is running in a cluster of five nodes.

  • riak@64.214.83.25 on node1.localdomain (192.168.17.11)(64.214.83.25)
  • riak@64.214.83.26 on node2.localdomain (192.168.17.12)(64.214.83.26)
@w495
w495 / test_concat.erl
Created June 13, 2012 15:43
Тестирование скорости конкатенации
%%
%% @file test_concat.erl тестирование скорости конкатенации
%% Тестирование проводилось на списках и binary.
%% Тестировалось наивная конкатенация через:
%% * ++, для списков;
%% * <<X/binary,Y/binary>>>, для binary;
%% * вложенные списки (правильные и неправильные), cм ниже;
%% * конкатенация через lists:append, для списков;
%% * конкатенация через string:join, для списков;
%%
@gdamjan
gdamjan / record_to_list.hrl
Created October 8, 2011 19:45
An erlang macro that creates a function to convert a record to a key-value list
%%% This macro will create a function that converts a record to
%%% a {key, value} list (a proplist)
-define(record_to_list(Record),
fun(Val) ->
Fields = record_info(fields, Record),
[_Tag| Values] = tuple_to_list(Val),
lists:zip(Fields, Values)
end
).
@gdamjan
gdamjan / proplist_to_record.hrl
Created September 13, 2011 12:41
Erlang macro to create proplist_to_record functions
%%% This is a clever Erlang macro that given a record name will create a new function
%%% that converts from a property list to the record (which really is a taged tuple).
-define(proplist_to_record(Record),
fun(Proplist) ->
Fields = record_info(fields, Record),
[Tag| Values] = tuple_to_list(#Record{}),
Defaults = lists:zip(Fields, Values),
L = lists:map(fun ({K,V}) -> proplists:get_value(K, Proplist, V) end, Defaults),
list_to_tuple([Tag|L])