diff --git a/api/main.go b/api/main.go index d42fe81..95a2806 100644 --- a/api/main.go +++ b/api/main.go @@ -70,6 +70,7 @@ func Execute(res http.ResponseWriter, req *http.Request) { "c", "cpp", "c++", "csharp", "cs", "c#", + "elixir", "exs", "go", "java", "julia", "jl", @@ -139,6 +140,8 @@ func launch(request Inbound, res http.ResponseWriter) { execlang = "cpp" case "cs", "c#": execlang = "csharp" + case "elixir", "exs": + execlang = "elixir" case "asm": execlang = "nasm" case "js", "javascript": diff --git a/lxc/execute b/lxc/execute index 8d51760..0997041 100755 --- a/lxc/execute +++ b/lxc/execute @@ -57,6 +57,9 @@ case "$lang" in "csharp" | "cs" | "c#") bin=csharp ;; +"elixir" | "exs") + bin=elixir + ;; "go") bin=go ;; diff --git a/lxc/executors/elixir b/lxc/executors/elixir new file mode 100644 index 0000000..bee79a4 --- /dev/null +++ b/lxc/executors/elixir @@ -0,0 +1,2 @@ +cd /tmp/$2 +runuser runner$1 -c "cd /tmp/$2 ; cat args.args ; xargs -d '\n' timeout -s KILL 3 elixir code.code" diff --git a/lxc/versions b/lxc/versions index 024097e..4c79b79 100755 --- a/lxc/versions +++ b/lxc/versions @@ -27,6 +27,9 @@ echo '---' echo 'kotlin' lxc-attach --clear-env -n piston -- /bin/bash -l -c "kotlinc -version" echo '---' +echo "elixir" +lxc-attach --clear-env -n piston -- /bin/bash -l -c "elixir --version" +echo "---" echo 'nasm' lxc-attach --clear-env -n piston -- /bin/bash -l -c "nasm -version" echo '---' diff --git a/readme.md b/readme.md index b5b1219..887a48e 100644 --- a/readme.md +++ b/readme.md @@ -19,6 +19,9 @@ systemctl start libvirtd # ubuntu server 18.04: apt install lxc lxc-templates debootstrap libvirt0 +# arch: +sudo pacman -S lxc libvirt unzip + # everything else: # not documented, please open pull requests with commands for debian/arch/macos @@ -145,8 +148,8 @@ tar -xzf julia-1.4.1-linux-x86_64.tar.gz echo 'export PATH=$PATH:/opt/julia/julia-1.4.1/bin' >> /opt/.profile source /opt/.profile -#install kotlin -#final binary: /opt/kotlinc/bin/kotlinc +# install kotlin +# final binary: /opt/kotlinc/bin/kotlinc cd /opt wget https://github.com/JetBrains/kotlin/releases/download/v1.3.72/kotlin-compiler-1.3.72.zip unzip kotlin-compiler-1.3.72.zip @@ -154,6 +157,23 @@ rm kotlin-compiler-1.3.72.zip echo 'export PATH=$PATH:/opt/kotlinc/bin' >> /opt/.profile source /opt/.profile +# install elixir and erlang +# final binary: /opt/elixir/bin/elixir --version +# erlang +cd /opt && mkdir erlang && cd erlang +wget http://erlang.org/download/otp_src_23.0.tar.gz +gunzip -c otp_src_23.0.tar.gz | tar xf - +cd otp_src_23.0 && ./configure +make +echo 'export PATH=$PATH:/opt/erlang/otp_src_23.0/bin' >> /opt/.profile +source /opt/.profile +# elixir +cd /opt && mkdir elixir && cd elixir +wget https://github.com/elixir-lang/elixir/releases/download/v1.10.3/Precompiled.zip +mkdir elixir-1.10.3 && unzip Precompiled.zip -d elixir-1.10.3/ +echo 'export PATH=$PATH:/opt/elixir/elixir-1.10.3/bin' >> /opt/.profile +source /opt/.profile + # create runnable users and apply limits for i in {1..150}; do useradd -M runner$i diff --git a/tests/test.exs b/tests/test.exs new file mode 100644 index 0000000..4c8d8b0 --- /dev/null +++ b/tests/test.exs @@ -0,0 +1 @@ +IO.puts("good") diff --git a/tests/test_all_lxc b/tests/test_all_lxc index ea9e5b3..51f8e72 100755 --- a/tests/test_all_lxc +++ b/tests/test_all_lxc @@ -8,6 +8,8 @@ echo 'testing cpp' ../lxc/execute cpp test.cpp echo 'testing cs' ../lxc/execute cs test.cs +echo 'testing elixir' +../lxc/exexute exs test.exs echo 'testing go' ../lxc/execute go test.go echo 'testing java'