This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%% create dummy.dat with: | |
%% dd if=/dev/random of=dummy.dat bs=1024 count=1024 | |
-module(test). | |
-compile([export_all, nowarn_export_all]). | |
-compile(bin_opt_info). | |
-include_lib("kernel/include/logger.hrl"). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module(t7). | |
-export([test/2, test/3]). | |
test(Prefix, Tries) -> | |
T = [1, 2, 4, 8, 16, 24, 32, 33, 64, 128], | |
Res = [test_3(Prefix, Items, Tries) || Items <- T], | |
io:format("| Tries | Atom | Binary | List |\n" | |
"|-------|--------------------------------|--------------------------------|--------------------------------|\n"), | |
[io:format("| ~5w | ~10w µs, ~f µs/try | ~10w µs, ~f µs/try | ~10w µs, ~f µs/try |~n", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module(testm). | |
-behaviour(gen_statem). | |
-export([start_link/0, run/1, run/2]). | |
-export([callback_mode/0, init/1, terminate/3]). | |
-export([handle_event/4]). | |
-define(SERVER, ?MODULE). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env escript | |
%% -*- erlang -*- | |
%%! +sbtu +A1 | |
-mode(compile). | |
-export([init_server/1]). | |
-define(UNIT, nanosecond). | |
%%-define(UNIT, millisecond). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env escript | |
-include_lib("kernel/include/inet.hrl"). | |
-include_lib("kernel/include/inet_sctp.hrl"). | |
main([Protocol, IP, Port, Len, Cnt]) -> | |
bench(list_to_atom(Protocol), inet:parse_address(IP), | |
list_to_integer(Port), list_to_integer(Len), list_to_integer(Cnt)); | |
main(_) -> | |
io:format("invalid arguments~n~n"), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module(aes_cmac). | |
%% R20 will have CMAC in crypto.... | |
-export([aes_cmac/2, generate_subkeys/1]). | |
-define(Zero, <<0:128>>). | |
-define(Rb, <<16#87:128>>). | |
-define(BlockSize, 16). | |
%% +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%%---------------------------------------------------------------------- | |
%% Purpose : UDP API Wrapper | |
%%---------------------------------------------------------------------- | |
-module(capwap_udp). | |
-behavior(gen_server). | |
-include("capwap_debug.hrl"). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module(echo_ssl_udp). | |
-compile([export_all]). | |
%%-include_lib("ssl/include/ssl_srp.hrl"). | |
main() -> | |
application:ensure_all_started(ssl), | |
application:set_env(ssl, dtls_msg_seq, [[1],[2,1,3]]), | |
{ok, ListenSocket} = ssl:listen(4433, mk_opts("server")), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module(dtls_client). | |
-export([connect/1]). | |
psk_verify(Username, UserState) -> | |
io:format("Server Hint: ~p~n", [Username]), | |
{ok, UserState}. | |
connect(Port) -> | |
[application:start(X) || X <- [crypto, asn1, public_key, ssl]], |