Skip to content

Instantly share code, notes, and snippets.

View dergraf's full-sized avatar

Andre Graf dergraf

  • Basel, Switzerland
View GitHub Profile
Secure Sockets Layer
TLSv1.2 Record Layer: Handshake Protocol: Client Hello
Content Type: Handshake (22)
Version: TLS 1.2 (0x0303)
Length: 99
Handshake Protocol: Client Hello
Handshake Type: Client Hello (1)
Length: 95
Version: TLS 1.2 (0x0303)
Random
require "auth/auth_commons"
-- In order to use this Lua plugin your webhook must return a JSON Object containing
-- the following properties:
--
-- - passhash: STRING (bcrypt)
-- - publish_acl: [ACL] (Array of ACL JSON Objects)
-- - subscribe_acl: [ACL] (Array of ACL JSON Objects)
--
-- The JSON array passed as publish/subscribe ACL contains the ACL objects topic

Keybase proof

I hereby claim:

  • I am dergraf on github.
  • I am dergraf (https://keybase.io/dergraf) on keybase.
  • I have a public key whose fingerprint is 7787 72BD 8D9D B08C A545 0810 1E5A AA1C 889A 5E5A

To claim this, I am signing this object:

@dergraf
dergraf / convert_retain_plugin.erl
Last active October 21, 2015 15:44
A simple VerneMQ auth_on_publish hook to disable retaining messages.
-module(convert_retain_plugin).
-behaviour(auth_on_publish_hook).
-export([auth_on_publish/6]).
auth_on_publish(_UserName, _SubscriberId, _QoS, _Topic, _Payload, _IsRetain) ->
{ok, [{retain, false}]}.
@dergraf
dergraf / vernemq_grafana.json
Created October 16, 2015 14:38
VerneMQ Grafana Single Node Dashboard
{
"id": 1,
"title": "VerneMQ",
"originalTitle": "VerneMQ",
"tags": [],
"style": "dark",
"timezone": "browser",
"editable": true,
"hideControls": false,
"sharedCrosshair": false,
@dergraf
dergraf / gist:b3aa9d495110ff30a010
Created October 10, 2014 13:24
set up a function call in its own process
make_request(Fun, Args) when is_function(Fun), is_list(Args) ->
Ref = make_ref(),
Caller = {self(), Ref},
ReqF = fun() ->
exit({Ref, apply(Fun, [Caller|Args])})
end,
try spawn_monitor(ReqF) of
{_, MRef} ->
receive
Ref ->
@dergraf
dergraf / hilbert.erl
Created July 19, 2013 12:19
space filling hilbert curve that maps two-dimensional space to a one-dimensional space
-module(hilbert).
-export([curve/1, curve/7, point_to_hilbert/3]).
-define(HILBERTMAP, [
{a, [{{0,0},{0,d}}, {{0,1},{1,a}}, {{1,0},{3,b}}, {{1,1},{2,a}}]},
{b, [{{0,0},{2,b}}, {{0,1},{1,b}}, {{1,0},{3,a}}, {{1,1},{0,c}}]},
{c, [{{0,0},{2,c}}, {{0,1},{3,d}}, {{1,0},{1,c}}, {{1,1},{0,b}}]},
{d, [{{0,0},{0,a}}, {{0,1},{3,c}}, {{1,0},{1,d}}, {{1,1},{2,d}}]}
]).
@dergraf
dergraf / kdtree.erl
Last active December 19, 2015 23:59
incomplete kdtree implementation in erlang.
-module(kdtree).
-export([new/1, search/2, distance/2, test/0, test/3]).
new([]) -> [];
new(PointList) ->
K = size(lists:nth(1, PointList)),
kdtree(K, PointList, 0).
kdtree(_, [], _) -> [];
kdtree(K, PointList, Depth) ->
-module(continuation_test).
-export([test/0]).
-define(SIZE, 100).
test() ->
ets:new(test, [named_table]),
[ets:insert(test, {I, I}) || I<- lists:seq(1,?SIZE)],
{Res, Cont} = ets:match_object(test, {'_', '_'}, 10),
L = [p(R) || R <- Res],
c(Cont, L).
-module(dbis_sample).
-export([i_am_a_function/1, pattern/1]).
%% this is a comment
i_am_a_function(Param) ->
Number = 10,
Atom = atom,
String = "string",
EmptyList = [],
List = [Param, Number, Atom, String, EmptyList],