Skip to content

Instantly share code, notes, and snippets.

Install Erlang Dependencies

Note: This assumes you are using GTK, if not, choose a different version of the libwx or you'll end up installing all of GTK. If you aren't using a window manager, you don't need WX at all, but you'll miss out on some cool built in GUIs.

sudo apt-get install build-essential libncurses5-dev libssl-dev libwxgtk3.0-dev

Download and compile Erlang

FROM elixir:1.5.1
RUN mkdir /app
WORKDIR /app
EXPOSE 7777
ENV PORT=7777
ENV MIX_ENV=prod
RUN mix local.hex --force && mix local.rebar --force
@sionide21
sionide21 / counter.ex
Created February 10, 2018 16:27
Counter CRDT
defmodule Counter do
use GenServer
@announce_interval 5_000
def start_link do
GenServer.start_link(__MODULE__, [], name: __MODULE__)
end
def increment() do
GenServer.cast(__MODULE__, :increment)
defmodule Debug do
defmacro debug_case(ast) do
ast
|> Macro.postwalk(fn
{:->, ctx, [[clause], expr]} ->
debug = quote do
IO.puts("Hit clause: #{unquote(Macro.to_string(clause))}")
end
{:->, ctx, [[clause], {:__block__, [], [debug, expr]}]}