Current section

Files

Jump to
blah src blah@internet.erl
Raw

src/blah@internet.erl

-module(blah@internet).
-compile(no_auto_import).
-export([username/0, email/0, password/0, passphrase/0, domain_name/0, url/0, ip_v4/0, ip_v6/0, mac/0, hex_color/0]).
-spec username() -> binary().
username() ->
Nonce = gleam@int:random(4, 2048),
case Nonce rem 4 of
0 ->
_pipe = [blah@en@word:adjective(), blah@name:last_name()],
blah@utils:join(_pipe, <<""/utf8>>);
1 ->
_pipe@2 = [blah@en@word:adjective(),
begin
_pipe@1 = blah@name:last_name(),
gleam@string:lowercase(_pipe@1)
end],
blah@utils:join(_pipe@2, <<"."/utf8>>);
2 ->
_pipe@4 = [blah@en@word:adjective(),
begin
_pipe@3 = blah@name:last_name(),
gleam@string:lowercase(_pipe@3)
end],
blah@utils:join(_pipe@4, <<"-"/utf8>>);
3 ->
_pipe@6 = [blah@en@word:adjective(),
begin
_pipe@5 = blah@name:last_name(),
gleam@string:lowercase(_pipe@5)
end],
blah@utils:join(_pipe@6, <<"_"/utf8>>)
end.
-spec email() -> binary().
email() ->
{ok, Email_domain@1} = case begin
_pipe = [<<"gmail.com"/utf8>>,
<<"yahoo.com"/utf8>>,
<<"hotmail.com"/utf8>>,
<<"protonmail.com"/utf8>>,
<<"proton.me"/utf8>>,
<<"aol.com"/utf8>>,
<<"ymail.com"/utf8>>,
<<"msn.com"/utf8>>,
<<"outlook.com"/utf8>>,
<<"mail.ru"/utf8>>,
<<"live.com"/utf8>>],
blah@utils:get_random_item(_pipe)
end of
{ok, Email_domain} -> {ok, Email_domain};
_try ->
erlang:error(#{gleam_error => assert,
message => <<"Assertion pattern match failed"/utf8>>,
value => _try,
module => <<"blah/internet"/utf8>>,
function => <<"email"/utf8>>,
line => 55})
end,
_pipe@1 = [username(), Email_domain@1],
blah@utils:join(_pipe@1, <<"@"/utf8>>).
-spec password() -> binary().
password() ->
Length = gleam@int:random(8, 32),
blah@en@string:alphanumeric(Length).
-spec passphrase() -> binary().
passphrase() ->
_pipe@1 = [blah@en@word:adjective(),
begin
_pipe = blah@name:first_name(),
gleam@string:lowercase(_pipe)
end,
blah@en@word:verb(),
blah@en@word:adverb()],
blah@utils:join(_pipe@1, <<" "/utf8>>).
-spec domain_name() -> binary().
domain_name() ->
Nonce = gleam@int:random(4, 2048),
Hostname = case Nonce rem 3 of
0 ->
_pipe = [blah@en@word:adjective(), blah@en@word:noun()],
blah@utils:join(_pipe, <<"."/utf8>>);
1 ->
_pipe@1 = [blah@en@word:adjective(), blah@en@word:noun()],
blah@utils:join(_pipe@1, <<"-"/utf8>>);
2 ->
_pipe@2 = [blah@en@word:adjective(), blah@en@word:noun()],
blah@utils:join(_pipe@2, <<"_"/utf8>>)
end,
{ok, Suffix@1} = case begin
_pipe@3 = [<<"com"/utf8>>,
<<"org"/utf8>>,
<<"net"/utf8>>,
<<"int"/utf8>>,
<<"edu"/utf8>>,
<<"gov"/utf8>>,
<<"mil"/utf8>>,
<<"io"/utf8>>,
<<"co"/utf8>>],
blah@utils:get_random_item(_pipe@3)
end of
{ok, Suffix} -> {ok, Suffix};
_try ->
erlang:error(#{gleam_error => assert,
message => <<"Assertion pattern match failed"/utf8>>,
value => _try,
module => <<"blah/internet"/utf8>>,
function => <<"domain_name"/utf8>>,
line => 96})
end,
_pipe@4 = [Hostname, Suffix@1],
blah@utils:join(_pipe@4, <<"."/utf8>>).
-spec url() -> binary().
url() ->
{ok, Protocol@1} = case begin
_pipe = [<<"http"/utf8>>, <<"https"/utf8>>],
blah@utils:get_random_item(_pipe)
end of
{ok, Protocol} -> {ok, Protocol};
_try ->
erlang:error(#{gleam_error => assert,
message => <<"Assertion pattern match failed"/utf8>>,
value => _try,
module => <<"blah/internet"/utf8>>,
function => <<"url"/utf8>>,
line => 105})
end,
_pipe@1 = [Protocol@1, <<"://"/utf8>>, domain_name()],
blah@utils:join(_pipe@1, <<""/utf8>>).
-spec ip_v4() -> binary().
ip_v4() ->
_pipe = gleam@list:repeat(<<""/utf8>>, 4),
_pipe@1 = gleam@list:map(_pipe, fun(_) -> gleam@int:random(0, 256) end),
_pipe@3 = gleam@list:map(
_pipe@1,
fun(Field) ->
_pipe@2 = Field,
gleam@int:to_string(_pipe@2)
end
),
blah@utils:join(_pipe@3, <<"."/utf8>>).
-spec ip_v6() -> binary().
ip_v6() ->
_pipe = gleam@list:repeat(<<""/utf8>>, 8),
_pipe@1 = gleam@list:map(_pipe, fun(_) -> gleam@int:random(0, 65536) end),
_pipe@4 = gleam@list:map(
_pipe@1,
fun(Field) ->
_pipe@2 = Field,
_pipe@3 = gleam@int:to_base16(_pipe@2),
gleam@string:lowercase(_pipe@3)
end
),
blah@utils:join(_pipe@4, <<":"/utf8>>).
-spec mac() -> binary().
mac() ->
_pipe = gleam@list:repeat(<<""/utf8>>, 6),
_pipe@1 = gleam@list:map(_pipe, fun(_) -> gleam@int:random(0, 256) end),
_pipe@4 = gleam@list:map(
_pipe@1,
fun(Field) ->
_pipe@2 = Field,
_pipe@3 = gleam@int:to_base16(_pipe@2),
gleam@string:lowercase(_pipe@3)
end
),
blah@utils:join(_pipe@4, <<":"/utf8>>).
-spec hex_color() -> binary().
hex_color() ->
_pipe@5 = [<<"#"/utf8>> |
begin
_pipe = gleam@list:repeat(<<""/utf8>>, 3),
_pipe@1 = gleam@list:map(
_pipe,
fun(_) -> gleam@int:random(0, 256) end
),
gleam@list:map(
_pipe@1,
fun(Field) ->
_pipe@2 = Field,
_pipe@3 = gleam@int:to_base16(_pipe@2),
_pipe@4 = gleam@string:lowercase(_pipe@3),
gleam@string:pad_left(_pipe@4, 2, <<"0"/utf8>>)
end
)
end],
blah@utils:join(_pipe@5, <<""/utf8>>).