This file contains hidden or 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
defmodule SocketsPry do | |
def pes({Phoenix.Endpoint.Server, _, _, _}), do: true | |
def pes(_), do: false | |
def rls({{:ranch_listener_sup,_}, _, _, _}), do: true | |
def rls(_), do: false | |
def rcs({:ranch_conns_sup, _, _, _}), do: true | |
def rcs(_), do: false |
This file contains hidden or 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
defmodule Transport do | |
def connect(params) do | |
hostname = params.hostname | |
port = params.port | |
path = params.path | |
timeout = params.connection_timeout | |
{:ok, conn} = :gun.open(hostname, port) | |
{:ok, :http} = :gun.await_up(conn) | |
:gun.ws_upgrade(conn, path) |
This file contains hidden or 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 | |
main(_Args) -> | |
% Generate all combinations of weights that add up to 40 | |
StoneWeights = [ {St1,St2,St3,St4} || St1 <- lists:seq(1,37), | |
St2 <- lists:seq(1,37), | |
St3 <- lists:seq(1,37), | |
St4 <- lists:seq(1,37), | |
(St1 + St2 + St3 + St4) == 40 ], |