Skip to content

Instantly share code, notes, and snippets.

View ashneyderman's full-sized avatar

Alex Shneyderman ashneyderman

  • Wayne, Pennsylvania
View GitHub Profile
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
@ashneyderman
ashneyderman / gist:5eca8b1bed16a7b6f4be
Created September 10, 2015 22:10
Use of gun from elixir
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)
@ashneyderman
ashneyderman / stones.erl
Created November 2, 2011 11:13
Stones puzzle
#!/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 ],