-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, long_hex_color/0, short_hex_color/0, hex_color/0]). -spec username() -> binary(). username() -> Adjective = blah@en@word:adjective(), Last_name = blah@name:last_name(), Nonce = gleam@int:random(4, 2048), case Nonce rem 4 of 0 -> _pipe = [Adjective, Last_name], blah@utils:join(_pipe, <<""/utf8>>); 1 -> _pipe@2 = [Adjective, begin _pipe@1 = Last_name, gleam@string:lowercase(_pipe@1) end], blah@utils:join(_pipe@2, <<"."/utf8>>); 2 -> _pipe@4 = [Adjective, begin _pipe@3 = Last_name, gleam@string:lowercase(_pipe@3) end], blah@utils:join(_pipe@4, <<"-"/utf8>>); 3 -> _pipe@6 = [Adjective, begin _pipe@5 = Last_name, gleam@string:lowercase(_pipe@5) end], blah@utils:join(_pipe@6, <<"_"/utf8>>) end. -spec email() -> binary(). email() -> {ok, Email_domain@1} = case blah@utils:get_random_item( [<<"aol.com"/utf8>>, <<"gmail.com"/utf8>>, <<"hotmail.com"/utf8>>, <<"live.com"/utf8>>, <<"mail.ru"/utf8>>, <<"msn.com"/utf8>>, <<"outlook.com"/utf8>>, <<"proton.me"/utf8>>, <<"protonmail.com"/utf8>>, <<"yahoo.com"/utf8>>, <<"ymail.com"/utf8>>] ) 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 => 57}) end, _pipe = [username(), Email_domain@1], blah@utils:join(_pipe, <<"@"/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() -> Adjective = blah@en@word:adjective(), Noun = blah@en@word:noun(), Nonce = gleam@int:random(4, 2048), Hostname = case Nonce rem 3 of 0 -> _pipe = [Adjective, Noun], blah@utils:join(_pipe, <<"."/utf8>>); 1 -> _pipe@1 = [Adjective, Noun], blah@utils:join(_pipe@1, <<"-"/utf8>>); 2 -> _pipe@2 = [Adjective, Noun], blah@utils:join(_pipe@2, <<"_"/utf8>>) end, {ok, Suffix@1} = case blah@utils:get_random_item( [<<"co"/utf8>>, <<"com"/utf8>>, <<"edu"/utf8>>, <<"gov"/utf8>>, <<"int"/utf8>>, <<"io"/utf8>>, <<"mil"/utf8>>, <<"net"/utf8>>, <<"org"/utf8>>] ) 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 => 98}) end, _pipe@3 = [Hostname, Suffix@1], blah@utils:join(_pipe@3, <<"."/utf8>>). -spec url() -> binary(). url() -> {ok, Protocol@1} = case blah@utils:get_random_item( [<<"http"/utf8>>, <<"https"/utf8>>] ) 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 = [Protocol@1, <<"://"/utf8>>, domain_name()], blah@utils:join(_pipe, <<""/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@2 = gleam@list:map(_pipe@1, fun gleam@int:to_string/1), blah@utils:join(_pipe@2, <<"."/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 long_hex_color() -> binary(). long_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>>). -spec short_hex_color() -> binary(). short_hex_color() -> _pipe@4 = [<<"#"/utf8>> | begin _pipe = gleam@list:repeat(<<""/utf8>>, 3), _pipe@1 = gleam@list:map( _pipe, fun(_) -> gleam@int:random(0, 15) end ), gleam@list:map( _pipe@1, fun(Field) -> _pipe@2 = Field, _pipe@3 = gleam@int:to_base16(_pipe@2), gleam@string:lowercase(_pipe@3) end ) end], blah@utils:join(_pipe@4, <<""/utf8>>). -spec hex_color() -> binary(). hex_color() -> Nonce = gleam@int:random(4, 2048), case Nonce rem 2 of 0 -> long_hex_color(); 1 -> short_hex_color() end.