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
Demo playlist + segments |
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 | |
%%% You need an OTP with fixes for sendmsg types | |
%%% see https://github.com/erlang/otp/pull/2400 | |
-module(sendsock). | |
-mode(compile). | |
-export([main/1]). |
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(otp_compat_transform). | |
-export([parse_transform/2]). | |
-export([add_otp21_nowarn/1]). % Export to avoid unused function warning on OTP20 | |
%% OTP_RELEASE is defined in OTP21, not before | |
-ifdef(OTP_RELEASE). | |
parse_transform(AST, _) -> | |
add_otp21_nowarn(AST). | |
-else. | |
parse_transform(AST, _) -> |
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(udptest). | |
-export([start_sender/2, start_reader/2]). | |
start_sender(Addr, Port) -> | |
Options0 = [{broadcast, true}, {reuseaddr, true}, {active, once}, {multicast_loop, true}, | |
{multicast_ttl, 4}, {high_msgq_watermark, 262144}, {low_msgq_watermark, 65536}, {sndbuf, 262144}], | |
% {multicast_if, {127,0,0,1}}], | |
Options = Options0, |
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(timetop). | |
-export([top/2]). | |
top(Duration, Count) -> | |
OldPrio = erlang:process_flag(priority, high), | |
Result = scheduled_time_top(Duration), | |
erlang:process_flag(priority, OldPrio), | |
lists:sublist(Result, Count). |
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(deser_gs). | |
-export([start_link/0]). | |
-export([init/1, handle_call/3, terminate/2]). | |
-export([hello/2, handle_hello/3]). | |
-export([world/1, handle_world/3]). | |
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 | |
%% -*- mode: erlang -*- | |
%%! -pa ranch/ebin -sname ranch_race +P 1000000 +A 200 +K true -env ERL_MAX_PORTS 1000000 | |
%% This script is tested only in Linux environment. | |
%% I could not make it work with Mac OS (it limits connection rate). | |
%% | |
%% Warning: you are likely going to hit max open files limit. | |
%% Before running this script you should raise max fds by executing: | |
%% sudo -E -- bash -c "ulimit -n 1000000; sudo -E -u $USER bash --login" |
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(cue_parse). | |
-export([parse_md/1]). | |
parse_md(<<CatNumber:128/binary, LeadInNum:64/integer, IsCD:1, 0:2071, TrackNum:8, Rest/binary>>) -> | |
Metadate = #{cat_number => CatNumber, lead_in => LeadInNum, is_cd => (IsCD == 1), tracks => TrackNum}, | |
{ok, Metadate, Rest}; | |
parse_md(<<_/binary>>) -> | |
{error, not_enough_data}. |
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(bininspector). | |
% For inspecting binary usage by all accessible ETS tables, run | |
% [{T, (catch ets:foldl(fun bininspector:collect/2, {0, 0}, T))} || T <- ets:all()]. | |
-export([collect/2]). | |
collect(B, {S, R}) when is_bitstring(B) -> | |
{S + byte_size(B), R + binary:referenced_byte_size(B)}; | |
collect(T, Acc) when is_tuple(T) -> |
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 | |
%% -*- mode: erlang -*- | |
%% vim: sw=2 ts=2 | |
% This escript sends valid TLSv1.2 client_hello to specified server | |
% crashing the OTP 17.0 acceptor due to bad hashsign default value | |
% | |
% Usage example: ./tlsv12_no_hs.escript localhost 9998 | |
-module(tlsv12_no_hs). | |
-include_lib("ssl/src/ssl_handshake.hrl"). |
NewerOlder