$ erlc -S test.erl
-module(rec_test). | |
-compile(export_all). | |
-include_lib("kernel/src/inet_dns.hrl"). | |
%% Requires R12B5 + | |
-include_lib("eunit/include/eunit.hrl"). | |
%% Retrieves the value stored in the record Rec in field Field. | |
info(Field, Rec) -> | |
Fields = fields(Rec), | |
info(Field, Fields, tl(tuple_to_list(Rec))). |
-module(benchmark). | |
-author('cooldaemon@gmail.com'). | |
-export([run/1]). | |
run(Count) -> | |
Keys = lists:seq(1, Count), | |
lists:foreach( | |
fun ({F, TargetName}) -> | |
{[SetRunTime, SetWallClock], [GetRunTime, GetWallClock]} = F(Keys), |
%% move cursor to beginning of the line | |
io:format("\e[H"). | |
%% clear the console | |
io:format("\e[J"). | |
%% both | |
io:format("\e[H\e[J"). |
Version numbers should be the ones you want. Here I do it with the last ones available at the moment of writing.
The simplest way to install elixir is using your package manager. Sadly, at the time of writing only Fedora shows
the intention to keep its packages up to date. There you can simply sudo dnf install erlang elixir
and you are good to go.
Anyway, if you intend to work with several versions of erlang or elixir at the same time, or you are tied to
a specific version, you will need to compile it yourself. Then asdf
is your best friend.
#参考资料
###下载单个文件,默认将输出打印到标准输出中(STDOUT)中
curl http://www.centos.org
$ 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
This is what the [official documentation][1] says about the terminate/2
callback for a gen_server:
This function is called by a gen_server when it is about to terminate. It should be the opposite of Module:init/1 and do any necessary cleaning up. When it returns, the gen_server terminates with Reason. The return value is ignored.
Reason is a term denoting the stop reason and State is the internal state of the gen_server.
Reason depends on why the gen_server is terminating. If it is because another callback function has returned a stop tuple {stop,..}, Reason will have the value specified in that tuple. If it is due to a failure, Reason is the error reason.