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 -*- | |
Dep = | |
fun(A,Cs) -> | |
Key = "dep_" ++ A, | |
case [U || [K, U] <- Cs, K =:= Key] of | |
[] -> error({not_found, Key}); | |
[URI] -> | |
{list_to_atom(A), ".*", {git,URI,"HEAD"}} | |
end | |
end. |
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
#!/usr/bin/env escript | |
%% License: http://www.mozilla.org/MPL/2.0/ | |
%% Author: Ulf Wiger <[email protected]> | |
-mode(compile). | |
main([]) -> | |
{ok, Fs} = file:list_dir("."), |
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
#!/usr/bin/env escript | |
%% -*- mode: erlang;erlang-indent-level: 4;indent-tabs-mode: nil -*- | |
%% Copyright 2013 Ulf Wiger <[email protected]> | |
%% License: http://opensource.org/licenses/MIT | |
main(Args) -> | |
Options = check_args(Args), | |
start_dist(Options), | |
Result = rpc(Options), |
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
#!/usr/bin/env escript | |
%% -*- erlang -*- | |
%% Copyright 2011-12 Feuerlabs Inc. | |
%% License: "BSD New" (http://www.opensource.org/licenses/BSD-3-Clause) | |
%% Author: Ulf Wiger <[email protected]> | |
-mode(compile). | |
-record(state, {target, rel, vm_args = []}). |
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
Fun = fun() -> | |
io:fwrite("~p starting...~n",[self()]), | |
Res = jobs:dequeue(q, 3), | |
io:fwrite("Res = ~p~n", [Res]) | |
end, | |
application:set_env(jobs, queues, | |
[{pool, producer, Fun, | |
[{regulators, [ | |
{counter,[{limit,3}]} | |
]} |
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
%% In Erlang, re. https://gist.github.com/723543 | |
calc_price(Foo, [List|Rest]) -> | |
case get_price_for(Foo, List) of | |
undefined -> calc_price(Rest); % recurse | |
P -> adjust_price(Foo, P) % return | |
end. |
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 2010 Erlang Solutions Ltd (ESL). All rights reserved. | |
%% Redistribution and use in source and binary forms, with or without | |
%% modification, are permitted provided that the following conditions are met: | |
%% | |
%% 1. Redistributions of source code must retain the above copyright notice, | |
%% this list of conditions and the following disclaimer. | |
%% | |
%% 2. Redistributions in binary form must reproduce the above copyright | |
%% notice, this list of conditions and the following disclaimer in | |
%% the documentation and/or other materials provided with the distribution. |