Skip to content

Instantly share code, notes, and snippets.

View arcusfelis's full-sized avatar

Michael Uvarov arcusfelis

View GitHub Profile
@arcusfelis
arcusfelis / manual-install.sh
Last active June 30, 2022 13:27
Install graphite/graphana for MongooseIM
# Create volumes and a networking
docker volume create grafana-var
docker volume create grafana-etc
docker volume create grafana-log
docker volume create graphite-conf
docker volume create graphite-storage
docker network create monitoring
rp(lists:reverse([{Len, case erlang:process_info(TopPid, registered_name) of {_,X} -> X; _ -> TopPid end, erlang:process_info(TopPid, current_stacktrace)} || {Len, TopPid} <- lists:sublist(lists:reverse(lists:keysort(1, [{try element(2,erlang:process_info(Pid, memory)) catch _:_ -> -1 end, Pid} || Pid <- erlang:processes()])), 20)])).
@arcusfelis
arcusfelis / gist:2fc38093e26a70c4b43c729385c635ef
Created April 3, 2022 23:56
debug erlang message queues in mongooseim
rp(lists:reverse([{Len, case erlang:process_info(TopPid, registered_name) of {_,X} -> X; _ -> TopPid end, erlang:process_info(TopPid, current_stacktrace)} || {Len, TopPid} <- lists:sublist(lists:reverse(lists:keysort(1, [{try element(2,erlang:process_info(Pid, message_queue_len)) + proplists:get_value('$internal_queue_len', element(2, erlang:process_info(Pid, dictionary)), 0) catch _:_ -> -1 end, Pid} || Pid <- erlang:processes()])), 20)])).
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="../../../../xv-browser.xsl"?>
<history xmlns:stream="http://etherx.jabber.org/streams">
<incoming_stanza jid="alicE86.23644@localhost/res1" offset="532">
<stream:features>
<starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls"/>
<compression xmlns="http://jabber.org/features/compress">
<method>zlib</method>
</compression>
<mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl">
@arcusfelis
arcusfelis / fux.md
Created April 7, 2016 14:01
Updates and functions

Create fux

-module(fux).                                                                        
-export([make_fun/0, version/0]).                                                    
                                                                                     
version() -> 1.                                                                      
make_fun() -> fun() -> ok end.                                                       
@arcusfelis
arcusfelis / gist:6c9f9c0ade7cee8d20e3
Created March 9, 2016 10:54
Bootstrap ejabberd database (mongooseim)
create database ejabberd;
create user 'ejabberd'@'%' identified by 'ejabberd';
create user 'ejabberd'@'localhost' identified by 'ejabberd';
set password for 'ejabberd'@'%' = password('ejabberd');
set password for 'ejabberd'@'localhost' = password('ejabberd');
grant all privileges on ejabberd.* to 'ejabberd'@'%' with grant option;
grant all privileges on ejabberd.* to 'ejabberd'@'localhost' with grant option;
flush privileges;
mysql -h localhost -u ejabberd -pejabberd ejabberd < mysql.sql
@arcusfelis
arcusfelis / govnocod.erl
Created January 19, 2016 12:46
govnocod.erl
Neotoma1 = filename:dirname(escript:script_name()) ++ "/../deps/neotoma/ebin",
Neotoma2 = filename:dirname(escript:script_name()) ++ "/../../neotoma/ebin",
code:add_pathz(filename:absname(Neotoma1)),
code:add_pathz(filename:absname(Neotoma2)),
neotoma:file("priv/katt_blueprint.peg", [{output, "src/"}]).
@arcusfelis
arcusfelis / kill.md
Last active November 2, 2015 16:21
Kill the listeners!111

TLDR: kill ejabberd_listeners and check its children.

Commands:

supervisor:which_children(ejabberd_listeners).                                       
timer:sleep(500).                                                                    
code:purge(ejabberd_listener).                                                       
code:load_file(ejabberd_listener).                                                   
timer:sleep(500).                                                                    
@arcusfelis
arcusfelis / unicode.erl
Last active October 15, 2015 11:20
Unicode support
X = <<243,48,236,8>>.
file:write_file("/tmp/xxx", io_lib:format("~p.", [X])).
file:consult("/tmp/xxx").
@arcusfelis
arcusfelis / ejabberd.cfg.erl
Last active October 14, 2015 12:19
Write comments!
{loglevel,5}.
{hosts,["table.get.interval.com","db.token.password.org","interval.user.com",
"set.token.table.io","delay.set.get.org","get.token.table.io",
"delay.token.set.io"]}.
{listen,[{33868,mod_db_riak_handler,[]},
{52284,mod_messages_linux,[]},
{55521,mod_redis_room_linux_kernel,[]},
{43643,mod_queries_log_room_lib,[]},
{49587,mod_open_session,[]},
{820,mod_last_websockets_mnesia_cassa_redis,[]},