Skip to content

Instantly share code, notes, and snippets.

Dmitry Klionsky ten0s

Block or report user

Report or block ten0s

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:06e2fdc13123d21f7945c787cfbd40e2
for i in `seq 1 5`; do erl -sname n${i} -noshell -eval 'io:format("~p~n", [erlang:md5(term_to_binary(lists:foldl(fun(I, Acc) -> Acc#{{abc, I} => I} end, #{}, lists:seq(1,100))))]), init:stop().' ; done
What's up?
View gist:8f67551fe7c3ac32501c20f7b7a39c6f
dropbox stop
# Pretent Dropbox is running
# See 'is_dropbox_running' function
# Simulate 'dropbox' string in /proc/%d/cmdline
bash -c 'read dropbox' &
View gist:ede7eea028798c22df51c66723446b9e
%?ERROR("ERROR: load_lrn(nil, Opts)~n", [Action, Opts]),
ten0s / gist:0b5458b50ba6c9655e6af827c8b8af30
Created May 6, 2016
Distributed publish using gproc w/o gen_leader
View gist:0b5458b50ba6c9655e6af827c8b8af30
Re: [erlang-questions] gproc and gen_event
Of course, for a distributed pub/sub, you don't really need to turn on
the distributed parts of gproc. Running a local gproc instance on each
node, you can publish like so:
publish(Event, Data) ->
gproc, send,
[{p, l, {?MODULE, Event}}, {?MODULE, Event, Data}]).
ten0s / gist:1d7c426e7d59ef938c74e16eb19f9b0b
Last active Apr 13, 2016
Quick timed evaluation of erlang function call
View gist:1d7c426e7d59ef938c74e16eb19f9b0b
(fun() ->
{Time, Value} = timer:tc(fun() -> Call end),
io:format("Call: ~s took: ~p ms~n", [??Call, Time/1000]),
In the code:
ten0s / gist:4cd1050aebf7054008ac
Created Feb 29, 2016
Run an erlang script without global erlang installed, but with a release's erts
View gist:4cd1050aebf7054008ac
$ scp remote:/home/user/
$ pwd
$ ./
ten0s /
Last active Feb 18, 2016
Erlang escript + signal handling
$ ./
erl: started.
erl: working...
erl: working...
erl: working...
^Cerl: working...
erl: stopped.
ten0s / gist:5cab692c2e935312874c
Created Feb 16, 2016
Add a dot to standard input
View gist:5cab692c2e935312874c
awk '{ print $0 } END { print "." }'
View gist:ea19610f94ae1f1803e8
$ fc-match "open sans"
DejaVuSans.ttf: "DejaVu Sans" "Book"
$ mkdir -p ~/.fonts
$ cd ~/.fonts
# download google fonts downloader, make it executable
$ wget
$ chmod +x google-font-download
ten0s / gist:0c4ee92260242786e4af
Last active Mar 16, 2016
Setup the default browser in Ubuntu/Mint
View gist:0c4ee92260242786e4af
sudo update-alternatives --config x-www-browser
gvfs-mime --query x-scheme-handler/http
gvfs-mime --query x-scheme-handler/https
gvfs-mime --set x-scheme-handler/http google-chrome.desktop | firefox.desktop
gvfs-mime --set x-scheme-handler/https google-chrome.desktop | firefox.desktop
You can’t perform that action at this time.