brew install qcachegrind
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
%% @author Florian Odronitz <[email protected]> | |
-module(dets_to_lets). | |
-export([ | |
init/0, | |
test/1 | |
]). | |
-include("lets.hrl"). |
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
% This is a demonstration of a gen_server | |
% which receives a message, does not reply but | |
% puts it into its own mailbox again so it will reply later. | |
% This way the execution is deferred and other pending messages are processed first. | |
-module(msg_looper). | |
-behaviour(gen_server). | |
%% API | |
-export([start_link/0, stop/1]). |
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
-module(gen_server_skeleton). | |
-behaviour(gen_server). | |
-export([start_link/0, init/1, handle_call/3, handle_cast/2, handle_info/2, terminate/2, code_change/3]). | |
%% Public API | |
start_link() -> | |
gen_server:start_link(?MODULE, [], []). |
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
-module(ponos_session). | |
-behaviour(gen_server). | |
-export([start/2, init/1, handle_call/3, handle_cast/2, handle_info/2, terminate/2, code_change/3]). | |
-record(state, {tasks :: list(), task_state :: any() }). | |
%% == usage == | |
%% 1> ponos_session:start([{print, "Hello"}, {wait, 1000}, {print, "World"}, print_call_count], 0). | |
%% "Hello" |
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 BindInPipes do | |
defmacro bind(state, variable) do | |
ast = quote do | |
{:__block__, [], [ | |
{:=, [], [{:var!, [context: Elixir, import: Kernel], [{unquote(variable), [], Elixir}]}, unquote(state)]}, | |
unquote(state) | |
]} | |
end | |
{result, []} = Code.eval_quoted(ast, [], __ENV__) | |
result |
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
* Find release at http://pkg.freebsd.org/ | |
* create repo file: | |
> cat /usr/local/etc/pkg/repos/FreeBSD10Release.conf | |
FreeBSD10Release: { | |
url: "pkg+http://pkg.freebsd.org/FreeBSD:10:amd64/release/0", | |
mirror_type: "srv", | |
signature_type: "fingerprints", | |
fingerprints: "/usr/share/keys/pkg", | |
enabled: yes |
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
"""Short and sweet LSTM implementation in Tensorflow. | |
Motivation: | |
When Tensorflow was released, adding RNNs was a bit of a hack - it required | |
building separate graphs for every number of timesteps and was a bit obscure | |
to use. Since then TF devs added things like `dynamic_rnn`, `scan` and `map_fn`. | |
Currently the APIs are decent, but all the tutorials that I am aware of are not | |
making the best use of the new APIs. | |
Advantages of this implementation: |
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 LimitedBuffer do | |
use GenServer | |
# Client | |
def start_link(size, name \\ nil) do | |
GenServer.start_link(__MODULE__, [size, name]) | |
end | |
def push(server, item) do |