<div dir="ltr">```<div><div>% -*- coding: utf8 -*-</div><div>-module(bomb).</div><div>-export([loop/0, main/0]).</div><div>-import(lists, [map/2]).</div><div>-import(pg2, [pid/0, join/2, get_members/1]).</div><div><br></div><div>loop() -></div><div>  join(forks, pid()),</div><div><br></div><div>  receive</div><div>    _ -> spawn(bomb, loop, []),</div><div>         loop()</div><div>  end.</div><div><br></div><div>main(_) -></div><div>  spawn(bomb, loop, []),</div><div><br></div><div>  case get_members(forks) of</div><div>    [Pid|Pids] -> map(fun(P) -> P ! 1 end, [Pid|Pids]);</div><div>    _ -> error</div><div>  end,</div><div>  main(1).</div><div><br></div><div>main() -> main(0).</div></div><div>```<br></div><div>exposes some internal guts to the browser ;) Please check if it's harmless. Good resource. Thank you.</div><div>--V</div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Feb 11, 2015 at 3:24 PM, Сергей Прохоров <span dir="ltr"><<a href="mailto:seriy.pr@gmail.com" target="_blank">seriy.pr@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>I'm glad to announce a service, which allow to run arbitrary Erlang code from your browser. For now it is there:</div><div><br></div><div><a href="http://tryerl.seriyps.ru/" target="_blank">http://tryerl.seriyps.ru/</a></div><div><br></div><div>How it works</div><div>Each request is handled by Cowboy web server, which launches new Erlang VM instance per request inside lightweight linux container, based on <a href="https://github.com/thestinger/playpen" target="_blank">https://github.com/thestinger/playpen</a>. There are restrictions on networking, memory and execution time, but nothing else.</div><div><br></div><div>What does it have</div><div>As you already heard, there is erlang code evaluation, but also compilation to several intermediate formats, like core erlang, macros expanding, beam and erlang assemblers and so on. And all this can be launched under any erlang release version (for now it's only the latter 8, but I can add more by demand).</div><div>Of course, there is 'pastebin' functionality, so you can save and share snippet with somebody else.</div><div><br></div><div>Possible use-cases:</div><div>* Explore code compatibility with all Erlang releases</div><div>* Share runnable erlang snippet with somebody</div><div>* Try to launch some dangerous code</div><div>* Quickly explore how your code is compiled to erlang asm instructions</div><div>* Maybe, for some online studying / webinars. Students are don't even need to install erlang on their computers</div><div>* In blog posts / articles / documentation - to make code snippets more interactive</div><div><br></div><div>Idea was borrowed from <a href="https://play.rust-lang.org/" target="_blank">https://play.rust-lang.org/</a>.</div><div><br></div><div>P.S.: it will be great, if you suggest some funny / interesting code snippets for «Examples» section.</div></div>
<br>_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
<br></blockquote></div><br></div></div>