Skip to content

Instantly share code, notes, and snippets.

View whatyouhide's full-sized avatar
🇮🇹

Andrea Leopardi whatyouhide

🇮🇹
View GitHub Profile
-module(connection).
-behaviour(gen_statem).
-export([start_link/1, request/2]).
-export([callback_mode/0, init/1]).
-export([disconnected/3, connected/3]).
%% Public API.
start_link(Opts) ->

Setting up Samba

First, install Samba:

sudo apt-get install samba

Now, you have to setup Samba to be accessed only by your user (that we'll call whatyouhide). First, be sure that the whatyouhide Unix user exists. Then, set a Samba password for it:

@whatyouhide
whatyouhide / testing_defps.ex
Created January 7, 2016 22:26
Testing private functions in Elixir
defmodule TestDefp do
defmacro __using__(_) do
quote do
import Kernel, except: [defp: 2]
end
end
# Let's redefine `defp/2` so that if MIX_ENV is `test`, the function will be
# defined with `def/2` instead of `defp/2`.
defmacro defp(fun, body) do