This file contains 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
%%%------------------------------------------------------------------- | |
%%% File : bfize.erl | |
%%% Author : Jesper Louis Andersen <jesper.louis.andersen@gmail.com> | |
%%% Description : Brainfuckize a text message | |
%%% | |
%%% Created : 27 Oct 2010 by Jesper Louis Andersen <jesper.louis.andersen@gmail.com> | |
%%%------------------------------------------------------------------- | |
-module(bfize). | |
%% API, the single export from the module, taking one parameter |
This file contains 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(moddeps). | |
-compile(export_all). | |
write_to(Filename) -> | |
xref:start(s), | |
xref:add_directory(s, "ebin"), | |
{ok, Calls} = xref:q(s, "XC"), | |
Mods = [{From, To} || {{From,_,_}, {To,_,_}} <- Calls], |
This file contains 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
{sys, [ | |
%%% This says where to look for applications | |
{lib_dirs, ["../deps", "../apps"]}, | |
%%% Name and version of the release. | |
%%% The list is the list of applications to include and start when the embedded system is booted | |
{rel, "etorrent", "1.2.0", | |
[ | |
kernel, | |
stdlib, | |
crypto, |
This file contains 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(sort). | |
-export([bu_merge/1]). | |
-export([bench/0]). | |
-ifdef(TEST). | |
-include_lib("eqc/include/eqc.hrl"). | |
-include_lib("eunit/include/eunit.hrl"). | |
-endif. |
This file contains 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
(etorrent@127.0.0.1)2> rerb:analyze(). | |
ok | |
(etorrent@127.0.0.1)4> rerb:list({clusters, 0.5}). | |
Cluster: | |
Size: 89 -- Representatives: [16,4492,32] | |
Cluster: | |
Size: 90 -- Representatives: [4438,4570,4464] | |
ok | |
(etorrent@127.0.0.1)5> rerb:list({clusters_full, 0.5}). | |
Cluster: |
This file contains 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(foo). | |
-compile(export_all). | |
-record(foo, {a,b,c}). | |
foo_to_proplist(#foo{} = F) -> | |
[{K, element(I, F)} || | |
{K, I} <- lists:zip(record_info(fields, foo), | |
lists:seq(2,record_info(size, foo)))]. |
This file contains 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(foo). | |
-compile(export_all). | |
%% Create a binary tree in O(depth) | |
build(0, T) -> T; | |
build(K, T) -> build(K-1, {T, T}). | |
%% What is the size of such a tree | |
sz(X) when is_atom(X) -> 1; |
This file contains 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(item). | |
-export([gen_shield/0]). | |
-export([transmogrify/2, as_item/1]). | |
-export([weapon_damage/1, look/1]). | |
-record(item, { | |
%% Rather arbitrary identity | |
id :: term(), | |
%% Proplist of items properties |
This file contains 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
master(State = #ms{socket = Socket}) -> | |
receive | |
%% Loop cases | |
{tcp_error, Socket, Reason} -> | |
io:format("Socket error [~w]: ~s~n", [Socket, Reason]), | |
master(State); | |
{announce, Text} -> | |
send(Socket, "PRIVMSG " ++ State#ms.channel ++ " :" ++ Text), | |
send(File, State#ms.channel ++ " :" ++ Text), | |
master(State); |
This file contains 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(z). | |
-compile(export_all). | |
pow(0, 0) -> 0; | |
pow(0, _N) -> 1; | |
pow(K, N) -> N * pow(K-1, N). | |
binary_to_integer(B) when is_binary(B) -> | |
{_, N} = binary_to_integer1(B), | |
N. |