mirror of
https://github.com/engineer-man/piston.git
synced 2025-09-20 10:50:04 +02:00
Merge branch 'master' into master
This commit is contained in:
commit
99038d3e6d
10 changed files with 61 additions and 4 deletions
|
@ -84,11 +84,13 @@ func Execute(res http.ResponseWriter, req *http.Request) {
|
||||||
"lua",
|
"lua",
|
||||||
"nasm", "asm",
|
"nasm", "asm",
|
||||||
"nasm64", "asm64",
|
"nasm64", "asm64",
|
||||||
|
"nim",
|
||||||
"node", "javascript", "js",
|
"node", "javascript", "js",
|
||||||
"perl", "pl",
|
"perl", "pl",
|
||||||
"php",
|
"php",
|
||||||
"python2",
|
"python2",
|
||||||
"python3", "python",
|
"python3", "python",
|
||||||
|
"paradoc",
|
||||||
"ruby",
|
"ruby",
|
||||||
"rust",
|
"rust",
|
||||||
"swift",
|
"swift",
|
||||||
|
|
|
@ -90,12 +90,18 @@ case "$lang" in
|
||||||
"nasm64" | "asm64")
|
"nasm64" | "asm64")
|
||||||
bin=nasm64
|
bin=nasm64
|
||||||
;;
|
;;
|
||||||
|
"nim")
|
||||||
|
bin=nim
|
||||||
|
;;
|
||||||
"node" | "js" | "javascript")
|
"node" | "js" | "javascript")
|
||||||
bin=node
|
bin=node
|
||||||
;;
|
;;
|
||||||
"deno" | "denojs" | "denots")
|
"deno" | "denojs" | "denots")
|
||||||
bin=deno
|
bin=deno
|
||||||
;;
|
;;
|
||||||
|
"paradoc")
|
||||||
|
bin=paradoc
|
||||||
|
;;
|
||||||
"perl")
|
"perl")
|
||||||
bin=perl
|
bin=perl
|
||||||
;;
|
;;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
cd /tmp/$2
|
cd /tmp/$2
|
||||||
cp code.code interim.java
|
cp code.code interim.java
|
||||||
name=$(cat interim.java | grep -Eo 'public\s+class\s+([A-Za-z0-9]+)' | sed -n 's/ */ /gp' | cut -d' ' -f3)
|
name=$(grep -Po "(?<=\n|\A)\s*(public\s+)?(class|interface)\s+\K([^\n\s{]+)" interim.java)
|
||||||
mv interim.java $name.java
|
mv interim.java $name.java
|
||||||
timeout -s KILL 10 javac $name.java
|
timeout -s KILL 10 javac $name.java
|
||||||
runuser runner$1 -c "cd /tmp/$2 ; cat args.args | xargs -d '\n' timeout -s KILL 3 java $name"
|
runuser runner$1 -c "cd /tmp/$2 ; cat args.args | xargs -d '\n' timeout -s KILL 3 java $name"
|
||||||
|
|
4
lxc/executors/nim
Executable file
4
lxc/executors/nim
Executable file
|
@ -0,0 +1,4 @@
|
||||||
|
cd /tmp/$2
|
||||||
|
timeout -s KILL 10 nim --hints:off c code.code
|
||||||
|
runuser runner$1 -c "cd /tmp/$2 ; cat args.args | xargs -d '\n' timeout -s KILL 3 ./code"
|
||||||
|
|
2
lxc/executors/paradoc
Executable file
2
lxc/executors/paradoc
Executable file
|
@ -0,0 +1,2 @@
|
||||||
|
cd /tmp/$2
|
||||||
|
runuser runner$1 -c "cd /tmp/$2 ; timeout -s KILL 3 python3 -m paradoc code.code <<< args.args"
|
|
@ -31,6 +31,8 @@ echo 'testing asm 32 bit'
|
||||||
../execute asm test.nasm
|
../execute asm test.nasm
|
||||||
echo 'testing asm 64 bit'
|
echo 'testing asm 64 bit'
|
||||||
../execute asm64 test64.nasm
|
../execute asm64 test64.nasm
|
||||||
|
echo 'testing nim'
|
||||||
|
../execute nim test.nim
|
||||||
echo 'testing php'
|
echo 'testing php'
|
||||||
../execute php test.php
|
../execute php test.php
|
||||||
echo 'testing perl'
|
echo 'testing perl'
|
||||||
|
@ -51,3 +53,5 @@ echo 'testing python3'
|
||||||
../execute python3 test3.py
|
../execute python3 test3.py
|
||||||
echo 'testing common lisp'
|
echo 'testing common lisp'
|
||||||
../execute sbcl --script test.cl
|
../execute sbcl --script test.cl
|
||||||
|
echo 'testing paradoc'
|
||||||
|
../execute python3 test_paradoc.py
|
1
lxc/tests/test.nim
Normal file
1
lxc/tests/test.nim
Normal file
|
@ -0,0 +1 @@
|
||||||
|
echo("good")
|
5
lxc/tests/test_paradoc.py
Normal file
5
lxc/tests/test_paradoc.py
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
try:
|
||||||
|
import paradoc
|
||||||
|
print('good')
|
||||||
|
except:
|
||||||
|
pass
|
12
lxc/versions
12
lxc/versions
|
@ -9,6 +9,10 @@ echo 'bash'
|
||||||
lxc-attach --clear-env -n piston -- /bin/bash -l -c "bash --version"
|
lxc-attach --clear-env -n piston -- /bin/bash -l -c "bash --version"
|
||||||
echo '---'
|
echo '---'
|
||||||
|
|
||||||
|
echo 'brainfuck'
|
||||||
|
echo '1.0.0'
|
||||||
|
echo '---'
|
||||||
|
|
||||||
echo 'c'
|
echo 'c'
|
||||||
lxc-attach --clear-env -n piston -- /bin/bash -l -c "gcc -v"
|
lxc-attach --clear-env -n piston -- /bin/bash -l -c "gcc -v"
|
||||||
echo '---'
|
echo '---'
|
||||||
|
@ -65,6 +69,10 @@ echo 'nasm'
|
||||||
lxc-attach --clear-env -n piston -- /bin/bash -l -c "nasm -version"
|
lxc-attach --clear-env -n piston -- /bin/bash -l -c "nasm -version"
|
||||||
echo '---'
|
echo '---'
|
||||||
|
|
||||||
|
echo 'nim'
|
||||||
|
lxc-attach --clear-env -n piston -- /bin/bash -l -c "nim -v | head -n1"
|
||||||
|
echo '---'
|
||||||
|
|
||||||
echo 'node'
|
echo 'node'
|
||||||
lxc-attach --clear-env -n piston -- /bin/bash -l -c "node --version"
|
lxc-attach --clear-env -n piston -- /bin/bash -l -c "node --version"
|
||||||
echo '---'
|
echo '---'
|
||||||
|
@ -85,6 +93,10 @@ echo 'python3'
|
||||||
lxc-attach --clear-env -n piston -- /bin/bash -l -c "python3 -V"
|
lxc-attach --clear-env -n piston -- /bin/bash -l -c "python3 -V"
|
||||||
echo '---'
|
echo '---'
|
||||||
|
|
||||||
|
echo 'paradoc'
|
||||||
|
lxc-attach --clear-env -n piston -- /bin/bash -l -c "python3 -m paradoc --version"
|
||||||
|
echo '---'
|
||||||
|
|
||||||
echo 'ruby'
|
echo 'ruby'
|
||||||
lxc-attach --clear-env -n piston -- /bin/bash -l -c "ruby --version"
|
lxc-attach --clear-env -n piston -- /bin/bash -l -c "ruby --version"
|
||||||
echo '---'
|
echo '---'
|
||||||
|
|
27
readme.md
27
readme.md
|
@ -85,6 +85,14 @@ ln -s python python3.8
|
||||||
echo 'export PATH=$PATH:/opt/python3/Python-3.8.2' >> /opt/.profile
|
echo 'export PATH=$PATH:/opt/python3/Python-3.8.2' >> /opt/.profile
|
||||||
source /opt/.profile
|
source /opt/.profile
|
||||||
|
|
||||||
|
# install paradoc
|
||||||
|
# this is not a binary, it is a python module
|
||||||
|
# therefore it cannot be run directly as it requires python3 to be installed
|
||||||
|
cd /opt && mkdir paradoc && cd paradoc
|
||||||
|
git clone https://github.com/betaveros/paradoc.git
|
||||||
|
echo 'export PYTHONPATH=$PYTHONPATH:/opt/paradoc/paradoc' >> /opt/.profile
|
||||||
|
source /opt/.profile
|
||||||
|
|
||||||
# install node.js
|
# install node.js
|
||||||
# final binary: /opt/nodejs/node-v12.16.1-linux-x64/bin/node
|
# final binary: /opt/nodejs/node-v12.16.1-linux-x64/bin/node
|
||||||
# get version: /opt/nodejs/node-v12.16.1-linux-x64/bin/node -v
|
# get version: /opt/nodejs/node-v12.16.1-linux-x64/bin/node -v
|
||||||
|
@ -179,9 +187,9 @@ source /opt/.profile
|
||||||
# final binary: /opt/kotlinc/bin/kotlinc
|
# final binary: /opt/kotlinc/bin/kotlinc
|
||||||
# get version: /opt/kotlinc/bin/kotlinc -version
|
# get version: /opt/kotlinc/bin/kotlinc -version
|
||||||
cd /opt
|
cd /opt
|
||||||
wget https://github.com/JetBrains/kotlin/releases/download/v1.3.72/kotlin-compiler-1.3.72.zip
|
wget https://github.com/JetBrains/kotlin/releases/download/v1.4.10/kotlin-compiler-1.4.10.zip
|
||||||
unzip kotlin-compiler-1.3.72.zip
|
unzip kotlin-compiler-1.4.10.zip
|
||||||
rm kotlin-compiler-1.3.72.zip
|
rm kotlin-compiler-1.4.10.zip
|
||||||
echo 'export PATH=$PATH:/opt/kotlinc/bin' >> /opt/.profile
|
echo 'export PATH=$PATH:/opt/kotlinc/bin' >> /opt/.profile
|
||||||
source /opt/.profile
|
source /opt/.profile
|
||||||
|
|
||||||
|
@ -246,6 +254,18 @@ source /opt/.profile
|
||||||
# important notice: use sbcl --script to run a clisp file, sbcl enters the REPL
|
# important notice: use sbcl --script to run a clisp file, sbcl enters the REPL
|
||||||
apt install -y sbcl
|
apt install -y sbcl
|
||||||
|
|
||||||
|
# install nim
|
||||||
|
# final binary: /opt/nim/bin/nim
|
||||||
|
# get version: /opt/nim/bin/nim -v
|
||||||
|
cd /opt && mkdir nim && cd nim
|
||||||
|
wget https://nim-lang.org/download/nim-1.4.0-linux_x64.tar.xz
|
||||||
|
unxz nim-1.4.0-linux_x64.tar.xz
|
||||||
|
tar -xf nim-1.4.0-linux_x64.tar
|
||||||
|
cd nim-1.4.0
|
||||||
|
./install.sh /opt
|
||||||
|
echo 'export PATH=$PATH:/opt/nim/bin' >> /opt/.profile
|
||||||
|
source /opt/.profile
|
||||||
|
|
||||||
# create runnable users and apply limits
|
# create runnable users and apply limits
|
||||||
for i in {1..150}; do
|
for i in {1..150}; do
|
||||||
useradd -M runner$i
|
useradd -M runner$i
|
||||||
|
@ -363,6 +383,7 @@ If an invalid language is supplied, a typical response will look like the follow
|
||||||
- php
|
- php
|
||||||
- python2
|
- python2
|
||||||
- python3
|
- python3
|
||||||
|
- paradoc
|
||||||
- ruby
|
- ruby
|
||||||
- rust
|
- rust
|
||||||
- swift
|
- swift
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue