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
%% @copyright Geoff Cant 2010 | |
%% @author Geoff Cant <[email protected]> | |
%% @doc Erlang shell code to cause a gen* process to evaluate a fun. | |
%% | |
%% @license This code was translated from an ancient tome in the | |
%% Arkham university library (restricted section, 4th vault). As such, | |
%% use of this code is restricted to only those who see it as the | |
%% manifestly evil. Using this code under any circumstances other than in | |
%% dire need while debugging revokes your right to use, view, posess | |
%% said code. |
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
#!/bin/bash | |
rm -rf ~/erlang/otp/release | |
cd ~/otp | |
./otp_build release -a ~/erlang/otp/release && \ | |
(brew unlink erlang; \ | |
rm -rf ~/usr/Cellar/erlang/HEAD; \ | |
mv ~/erlang/otp/release ~/usr/Cellar/erlang/HEAD; \ | |
cd ~/usr/Cellar/erlang/HEAD; \ | |
./Install -minimal ~/usr/Cellar/erlang/HEAD; \ |
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
start(App) -> | |
start_ok(App, application:start(App)). | |
start_ok(_App, ok) -> ok; | |
start_ok(_App, {error, {already_started, _App}}) -> ok; | |
start_ok(App, {error, {not_started, Dep}}) -> | |
ok = start(Dep), | |
start(App); | |
start_ok(App, {error, Reason}) -> | |
erlang:error({app_start_failed, App, Reason}). |
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
a_start(App, Type) -> | |
start_ok(App, Type, application:start(App, Type)). | |
start_ok(_App, _Type, ok) -> ok; | |
start_ok(_App, _Type, {error, {already_started, _App}}) -> ok; | |
start_ok(App, Type, {error, {not_started, Dep}}) -> | |
ok = a_start(Dep, Type), | |
a_start(App, Type); | |
start_ok(App, _Type, {error, Reason}) -> | |
erlang:error({app_start_failed, App, Reason}). |
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(p2pphonebook). | |
-export([start/1, add/2, list_all/1, update/2,delete/2,find/2,join/2,join/3,splitContacts/2,updateContactsAndPeers/2]). | |
%% Interface | |
start(X) -> spawn(fun() -> loop({dict:new(),{'','',erlang:md5(X),''}}) end). | |
add(Pid, Contact) -> | |
rpc(Pid, {add, Contact}). |
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
erlang: | |
Installed: 1:13.b.1-dfsg-2ubuntu1.1 | |
Candidate: 1:14.b-0ubuntu1 | |
Version table: | |
1:14.b-0ubuntu1 0 | |
500 file: ./ Packages | |
*** 1:13.b.1-dfsg-2ubuntu1.1 0 | |
500 http://mirror.rightscale.com karmic-updates/universe Packages | |
500 http://mirror.rightscale.com karmic-security/universe Packages | |
100 /var/lib/dpkg/status |
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
aptitude install erlang=1:14.b-0ubuntu1 | |
Reading package lists... Done | |
Building dependency tree | |
Reading state information... Done | |
Reading extended state information | |
Initializing package states... Done | |
The following packages are BROKEN: | |
erlang erlang-ic-java | |
The following NEW packages will be installed: | |
ca-certificates-java{a} default-jre-headless{a} erlang-jinterface{a} icedtea-6-jre-cacao{a} java-common{a} liblcms1{a} libnspr4-0d{a} libnss3-1d{a} |
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(netmask). | |
-export([in_network/3]). | |
in_network(Net, CIDR, IP) | |
when is_binary(Net), is_binary(IP), is_integer(CIDR) -> | |
<<NetworkPrefix:CIDR/bits, _/bits>> = Net, | |
case IP of | |
<<NetworkPrefix:CIDR/bits, _Host/bits>> -> | |
in_net; | |
_ -> not_in_net |
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(tuple_match). | |
-export([match/2, match2/2, | |
match_elements/2]). | |
-include_lib("eunit/include/eunit.hrl"). | |
match(any, T) when is_tuple(T) -> | |
true; | |
match(P, Q) | |
when is_tuple(P), is_tuple(Q) -> |
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
Frame 4: 116 bytes on wire (928 bits), 116 bytes captured (928 bits) | |
Arrival Time: Aug 30, 2011 13:05:27.159310000 PDT | |
Epoch Time: 1314734727.159310000 seconds | |
[Time delta from previous captured frame: 0.000137000 seconds] | |
[Time delta from previous displayed frame: 0.000137000 seconds] | |
[Time since reference or first frame: 0.000285000 seconds] | |
Frame Number: 4 | |
Frame Length: 116 bytes (928 bits) | |
Capture Length: 116 bytes (928 bits) | |
[Frame is marked: False] |