Merge pull request #50 from Vrganj/master

Add stdin, run executors as runner
This commit is contained in:
Brian Seymour 2021-01-21 13:58:23 -06:00 committed by GitHub
commit a066aec854
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
39 changed files with 468 additions and 302 deletions

View File

@ -1,48 +0,0 @@
const { writeFile } = require('fs/promises');
const { spawn } = require('child_process');
async function execute(res, language, body) {
const stamp = new Date().getTime();
const sourceFile = `/tmp/${stamp}.code`;
await writeFile(sourceFile, body.source);
const process = spawn(__dirname + '/../../lxc/execute', [
language.name,
sourceFile,
body.args?.join('\n') ?? '',
]);
const result = {
ran: true,
language: language.name,
stderr: '',
stdout: '',
output: '',
};
if (language.version)
result.version = language.version;
process.stderr.on('data', chunk => {
result.stderr += chunk;
result.output += chunk;
});
process.stdout.on('data', chunk => {
result.stdout += chunk;
result.output += chunk;
});
process.on('exit', () => {
result.stderr = result.stderr.trim().substring(0, 65535);
result.stdout = result.stdout.trim().substring(0, 65535);
result.output = result.output.trim().substring(0, 65535);
res.json(result);
});
}
module.exports = {
execute,
};

View File

@ -1,5 +1,5 @@
const express = require('express');
const { execute } = require('./execute');
const { execute } = require('../../shared/execute');
const { languages } = require('./languages');
const { checkSchema, validationResult } = require('express-validator');
@ -20,7 +20,7 @@ app.post(
errorMessage: 'Supplied language is not a string',
},
custom: {
options: value => languages.find(language => language.aliases.includes(value?.toLowerCase())),
options: value => value && languages.find(language => language.aliases.includes(value.toLowerCase())),
errorMessage: 'Supplied language is not supported by Piston',
},
},
@ -39,9 +39,16 @@ app.post(
isArray: {
errorMessage: 'Supplied args is not an array',
},
},
stdin: {
in: 'body',
optional: true,
isString: {
errorMessage: 'Supplied stdin is not a string',
},
}
}),
(req, res) => {
async (req, res) => {
const errors = validationResult(req).array();
if (errors.length === 0) {
@ -49,7 +56,16 @@ app.post(
language.aliases.includes(req.body.language.toLowerCase())
);
execute(res, language, req.body);
const { stdout, stderr, output, ran } = await execute(language, req.body.source, req.body.stdin, req.body.args);
res.status(200).json({
ran,
language: language.name,
version: language.version,
stdout,
stderr,
output,
});
} else {
res.status(400).json({
message: errors[0].msg,

View File

@ -1,119 +1,5 @@
const { spawn } = require('child_process');
const languages = [
{
name: 'nasm',
aliases: ['asm', 'nasm'],
},
{
name: 'nasm64',
aliases: ['asm64', 'nasm64'],
},
{
name: 'awk',
aliases: ['awk'],
},
{
name: 'bash',
aliases: ['bash'],
},
{
name: 'brainfuck',
aliases: ['bf', 'brainfuck'],
},
{
name: 'c',
aliases: ['c'],
},
{
name: 'csharp',
aliases: ['c#', 'cs', 'csharp'],
},
{
name: 'cpp',
aliases: ['c++', 'cpp'],
},
{
name: 'deno',
aliases: ['deno', 'denojs', 'denots'],
},
{
name: 'ruby',
aliases: ['duby', 'rb', 'ruby'],
},
{
name: 'emacs',
aliases: ['el', 'elisp', 'emacs'],
},
{
name: 'elixir',
aliases: ['elixir'],
},
{
name: 'haskell',
aliases: ['haskell', 'hs'],
},
{
name: 'go',
aliases: ['go'],
},
{
name: 'java',
aliases: ['java'],
},
{
name: 'node',
aliases: ['javascript', 'js', 'node'],
},
{
name: 'jelly',
aliases: ['jelly'],
},
{
name: 'julia',
aliases: ['jl', 'julia'],
},
{
name: 'kotlin',
aliases: ['kotlin'],
},
{
name: 'lua',
aliases: ['lua'],
},
{
name: 'paradoc',
aliases: ['paradoc'],
},
{
name: 'perl',
aliases: ['perl'],
},
{
name: 'php',
aliases: ['php', 'php3', 'php4', 'php5'],
},
{
name: 'python3',
aliases: ['py', 'py3', 'python', 'python3'],
},
{
name: 'python2',
aliases: ['python2'],
},
{
name: 'rust',
aliases: ['rs', 'rust'],
},
{
name: 'swift',
aliases: ['swift'],
},
{
name: 'typescript',
aliases: ['ts', 'typescript'],
},
];
const languages = require('../../shared/languages.json');
{
const process = spawn(__dirname + '/../../lxc/versions');

32
cli/execute Executable file
View File

@ -0,0 +1,32 @@
#!/usr/bin/env node
const { execute } = require('../shared/execute');
const { readFileSync } = require('fs');
const languages = require('../shared/languages.json');
const [languageName, sourceFile, ...args] = process.argv.slice(2);
(async () => {
if (!languageName) {
console.error('Provide a language name');
return;
}
if (!sourceFile) {
console.error('Provide a source file');
return;
}
const source = readFileSync(sourceFile).toString();
const language = languages.find(language => language.aliases.includes(languageName.toLowerCase()));
if (!language) {
console.error(`${languageName} is not supported by Piston`);
return;
}
const { output } = await execute(language, source, '', args);
console.log(output);
})();

View File

@ -14,13 +14,15 @@ epoch=$(date +%s%N)
basepath="/var/lib/lxc/piston/rootfs"
filepath="/tmp/$epoch/code.code"
argpath="/tmp/$epoch/args.args"
stdinpath="/tmp/$epoch/stdin.stdin"
arg=$(basename $argpath)
# write arg file
mkdir -p $basepath/tmp/$epoch
chmod 777 $basepath/tmp/$epoch
cat $2 > $basepath$filepath
echo "${@:3}" > $basepath$argpath
echo $3 > $basepath$stdinpath
echo "${@:4}" > $basepath$argpath
# process incrementor
exec 200>$dir/lockfile
@ -39,17 +41,21 @@ exec 200>&-
# runner
timeout -s KILL 20 \
lxc-attach --clear-env -n piston -- \
/bin/bash -l -c "bash /exec/$lang $newinc $epoch"
/bin/bash -l -c "runuser runner$newinc /exec/$lang $newinc $epoch"
# process janitor
lxc-attach --clear-env -n piston -- \
/bin/bash -l -c "\
for i in {1..100}; do pkill -u runner$newinc --signal SIGKILL; done ;\
find /tmp -user runner$newinc -exec /bin/rm -rf {} \; ;\
find /var/tmp -user runner$newinc -exec /bin/rm -rf {} \; ;\
find /var/lock -user runner$newinc -exec /bin/rm -rf {} \; ;\
find /dev/shm -user runner$newinc -exec /bin/rm -rf {} \; ;\
find /run/lock -user runner$newinc -exec /bin/rm -rf {} \; ;\
" > /dev/null 2>&1 &
/bin/bash -l -c "
for i in {1..100}
do
pkill -u runner$newinc --signal SIGKILL
done
find /tmp -user runner$newinc -delete
find /var/tmp -user runner$newinc -delete
find /var/lock -user runner$newinc -delete
find /dev/shm -user runner$newinc -delete
find /run/lock -user runner$newinc -delete
" > /dev/null 2>&1 &
rm -rf $basepath/tmp/$epoch

View File

@ -1,4 +1,6 @@
#!/bin/bash
cd /tmp/$2
timeout -s KILL 2 sed "/___code___/Q" code.code > code.stdin
timeout -s KILL 2 sed "1,/___code___/d" code.code > code.awk
runuser runner$1 -c "cd /tmp/$2 ; timeout -s KILL 3 awk -f code.awk < code.stdin"
timeout -s KILL 3 awk -f code.awk < code.stdin

View File

@ -1,2 +1,4 @@
#!/bin/bash
cd /tmp/$2
runuser runner$1 -c "cd /tmp/$2 ; cat args.args | xargs -d '\n' timeout -s KILL 3 bash code.code"
xargs -a args.args -d '\n' timeout -s KILL 3 bash code.code < stdin.stdin

View File

@ -1,2 +1,4 @@
#!/bin/bash
cd /tmp/$2
runuser runner$1 -c "cd /tmp/$2 ; cat args.args | xargs -d '\n' timeout -s KILL 3 brainfuck code.code"
timeout -s KILL 3 xargs -a args.args -d '\n' brainfuck code.code < stdin.stdin

View File

@ -1,4 +1,5 @@
runuser runner$1 -c "\
cd /tmp/$2 ; \
gcc -std=c11 -o binary -x c code.code ; \
cat args.args | xargs -d '\n' timeout -s KILL 3 ./binary"
#!/usr/bin/bash
cd /tmp/$2
gcc -std=c11 -o binary -x c code.code
timeout -s KILL 3 xargs -a args.args ./binary < stdin.stdin

View File

@ -1,4 +1,5 @@
runuser runner$1 -c "\
cd /tmp/$2 ; \
g++ -std=c++17 -o binary -x c++ code.code ; \
cat args.args | xargs -d '\n' timeout -s KILL 3 ./binary"
#!/bin/bash
cd /tmp/$2
g++ -std=c++17 -o binary -x c++ code.code
timeout -s KILL 3 xargs -a args.args -d '\n' ./binary < stdin.stdin

View File

@ -1,4 +1,5 @@
runuser runner$1 -c "\
cd /tmp/$2 ; \
mcs $(echo code.code | sed 's/\///') -nowarn:0219 -out:binary ; \
cat args.args | xargs -d '\n' timeout -s KILL 3 mono binary"
#!/bin/bash
cd /tmp/$2
mcs $(echo code.code | sed 's/\///') -nowarn:0219 -out:binary
timeout -s KILL 3 xargs -a args.args -d '\n' mono binary < stdin.stdin

View File

@ -1,7 +1,4 @@
cd /tmp/$2
#!/bin/bash
if [[ -z $(grep '[^[:space:]]' args.args) ]]; then
runuser runner$1 -c "cd /tmp/$2 ; timeout -s KILL 3 deno run code.code"
else
runuser runner$1 -c "cd /tmp/$2 ; cat args.args | xargs -d '\n' timeout -s KILL 3 deno run code.code"
fi
cd /tmp/$2
timeout -s KILL 3 xargs -a args.args -d '\n' deno run code.code < stdin.stdin

View File

@ -1,7 +1,4 @@
cd /tmp/$2
#!/bin/bash
if [[ -z $(grep '[^[:space:]]' args.args) ]]; then
runuser runner$1 -c "cd /tmp/$2 ; timeout -s KILL 3 elixir code.code"
else
runuser runner$1 -c "cd /tmp/$2 ; cat args.args ; xargs -d '\n' timeout -s KILL 3 elixir code.code"
fi
cd /tmp/$2
timeout -s KILL 3 xargs -a args.args -d '\n' elixir code.code < stdin.stdin

View File

@ -1,7 +1,4 @@
cd /tmp/$2
#!/bin/bash
if [[ -z $(grep '[^[:space:]]' args.args) ]]; then
runuser runner$1 -c "cd /tmp/$2 ; timeout -s KILL 3 emacs -Q --script code.code"
else
runuser runner$1 -c "cd /tmp/$2 ; cat args.args | xargs -d '\n' timeout -s KILL 3 emacs -Q --script code.code"
fi
cd /tmp/$2
timeout -s KILL 3 xargs -a args.args -d '\n' emacs -Q --script code.code < stdin.stdin

View File

@ -1,6 +1,6 @@
#!/bin/bash
cd /tmp/$2
cp code.code interim.go
file="interim.go"
go build $file
file=${file%%.*}
runuser runner$1 -c "cd /tmp/$2 ; cat args.args | xargs -d '\n' timeout -s KILL 3 ./$file"
go build interim.go
timeout -s KILL 3 xargs -a args.args -d '\n' ./interim < stdin.stdin

View File

@ -1,7 +1,6 @@
cd /tmp/$2
mv code.code code.hs
#!/bin/bash
runuser runner$1 -c "\
cd /tmp/$2 ; \
ghc -dynamic -o binary code.hs > /dev/null 2>&1 ; \
cat args.args | xargs -d '\n' timeout -s KILL 3 ./binary"
cd /tmp/$2
cp code.code code.hs
ghc -dynamic -o binary code.hs > /dev/null 2>&1
timeout -s KILL 3 xargs -a args.args -d '\n' ./binary < stdin.stdin

View File

@ -1,9 +1,7 @@
cd /tmp/$2
cp code.code interim.java
name=$(grep -Po "(?<=\n|\A)\s*(public\s+)?(class|interface)\s+\K([^\/\\\\\n\s{]+)" interim.java)
mv interim.java $name.java
#!/bin/bash
runuser runner$1 -c "\
cd /tmp/$2 ; \
javac $name.java ; \
cat args.args | xargs -d '\n' timeout -s KILL 3 java $name"
cd /tmp/$2
name=$(grep -Po "(?<=\n|\A)\s*(public\s+)?(class|interface)\s+\K([^\/\\\\\n\s{]+)" code.code)
cp code.code $name.java
javac $name.java
timeout -s KILL 3 xargs -a args.args -d '\n' java $name < stdin.stdin

View File

@ -1,2 +1,4 @@
#!/bin/bash
cd /tmp/$2
runuser runner$1 -c "cd /tmp/$2 ; cat args.args | xargs -d '\n' timeout -s KILL 3 jelly fu code.code"
timeout -s KILL 3 xargs -a args.args -d '\n' jelly fu code.code < stdin.stdin

View File

@ -1,2 +1,4 @@
#!/bin/bash
cd /tmp/$2
runuser runner$1 -c "cd /tmp/$2 ; cat args.args | xargs -d '\n' timeout -s KILL 3 julia code.code"
timeout -s KILL 3 xargs -a args.args -d '\n' julia code.code < stdin.stdin

View File

@ -1,6 +1,6 @@
#!/bin/bash
cd /tmp/$2
cp code.code code.kt
runuser runner$1 -c "\
cd /tmp/$2 ; \
kotlinc code.kt -include-runtime -d code.jar ; \
cat args.args | xargs -d '\n' timeout -s KILL 3 java -jar code.jar"
kotlinc code.kt -include-runtime -d code.jar
timeout -s KILL 3 xargs -a args.args -d '\n' java -jar code.jar < stdin.stdin

View File

@ -1,2 +1,4 @@
#!/bin/bash
cd /tmp/$2
runuser runner$1 -c "cd /tmp/$2 ; cat args.args | xargs -d '\n' timeout -s KILL 3 lua code.code"
timeout -s KILL 3 xargs -a args.args -d '\n' lua code.code < stdin.stdin

View File

@ -1,5 +1,6 @@
runuser runner$1 -c "\
cd /tmp/$2 ; \
nasm -f elf32 -o binary.o code.code ; \
ld -m elf_i386 binary.o -o binary ; \
cat args.args | xargs -d '\n' timeout -s KILL 3 ./binary"
#!/bin/bash
cd /tmp/$2
nasm -f elf32 -o binary.o code.code
ld -m elf_i386 binary.o -o binary
timeout -s KILL 3 xargs -a args.args -d '\n' ./binary < stdin.stdin

View File

@ -1,5 +1,6 @@
runuser runner$1 -c "\
cd /tmp/$2 ; \
nasm -f elf64 -o binary.o code.code ; \
ld -m elf_x86_64 binary.o -o binary ; \
cat args.args | xargs -d '\n' timeout -s KILL 3 ./binary"
#!/bin/bash
cd /tmp/$2
nasm -f elf64 -o binary.o code.code
ld -m elf_x86_64 binary.o -o binary
timeout -s KILL 3 xargs -a args.args -d '\n' ./binary < stdin.stdin

View File

@ -1,7 +1,4 @@
cd /tmp/$2
#!/bin/bash
if [[ -z $(grep '[^[:space:]]' args.args) ]]; then
runuser runner$1 -c "cd /tmp/$2 ; timeout -s KILL 3 node code.code"
else
runuser runner$1 -c "cd /tmp/$2 ; cat args.args | xargs -d '\n' timeout -s KILL 3 node code.code"
fi
cd /tmp/$2
timeout -s KILL 3 xargs -a args.args -d '\n' node code.code < stdin.stdin

View File

@ -1,2 +1,4 @@
#!/bin/bash
cd /tmp/$2
runuser runner$1 -c "cd /tmp/$2 ; timeout -s KILL 3 python3 -m paradoc code.code <<< args.args"
timeout -s KILL 3 python3 -m paradoc code.code < args.args

View File

@ -1,2 +1,4 @@
#!/bin/bash
cd /tmp/$2
runuser runner$1 -c "cd /tmp/$2 ; cat args.args | xargs -d '\n' timeout -s KILL 3 perl code.code"
timeout -s KILL 3 xargs -a args.args -d '\n' perl code.code < stdin.stdin

View File

@ -1,2 +1,4 @@
#!/bin/bash
cd /tmp/$2
runuser runner$1 -c "cd /tmp/$2 ; cat args.args | xargs -d '\n' timeout -s KILL 3 php code.code"
timeout -s KILL 3 xargs -a args.args -d '\n' php code.code < stdin.stdin

View File

@ -1,2 +1,4 @@
#!/bin/bash
cd /tmp/$2
runuser runner$1 -c "cd /tmp/$2 ; cat args.args | xargs -d '\n' timeout -s KILL 3 python code.code"
timeout -s KILL 3 xargs -a args.args -d '\n' python code.code < stdin.stdin

View File

@ -1,2 +1,4 @@
#!/bin/bash
cd /tmp/$2
runuser runner$1 -c "cd /tmp/$2 ; cat args.args | xargs -d '\n' timeout -s KILL 3 python3.8 code.code"
timeout -s KILL 3 xargs -a args.args -d '\n' python3.8 code.code < stdin.stdin

View File

@ -1,2 +1,4 @@
#!/bin/bash
cd /tmp/$2
runuser runner$1 -c "cd /tmp/$2 ; cat args.args | xargs -d '\n' timeout -s KILL 3 ruby code.code"
timeout -s KILL 3 xargs -a args.args -d '\n' ruby code.code < stdin.stdin

View File

@ -1,5 +1,5 @@
#!/bin/bash
cd /tmp/$2
rustc -o binary code.code
runuser runner$1 -c "\
cd /tmp/$2 ; \
cat args.args | xargs -d '\n' timeout -s KILL 3 ./binary"
timeout -s KILL 3 xargs -a args.args -d '\n' ./binary < stdin.stdin

View File

@ -1,2 +1,4 @@
#!/bin/bash
cd /tmp/$2
runuser runner$1 -c "cd /tmp/$2 ; cat args.args | xargs -d '\n' timeout -s KILL 3 swift code.code"
timeout -s KILL 3 xargs -a args.args -d '\n' swift code.code < stdin.stdin

View File

@ -1,7 +1,8 @@
runuser runner$1 -c "\
cd /tmp/$2 ; \
mv code.code interim.ts ; \
tsc interim.ts ; \
rm -f interim.ts ; \
mv interim.js code.code ; \
cat args.args | xargs -d '\n' timeout -s KILL 3 node code.code"
#!/bin/bash
cd /tmp/$2
mv code.code interim.ts
tsc interim.ts
rm -f interim.ts
mv interim.js code.code
timeout -s KILL 3 xargs -a args.args -d '\n' node code.code < stdin.stdin

View File

@ -3,7 +3,7 @@
mkdir -p /var/lib/lxc/piston/rootfs/exec
rm -f /var/lib/lxc/piston/rootfs/exec/*
cp -f executors/* /var/lib/lxc/piston/rootfs/exec
chmod 700 /var/lib/lxc/piston/rootfs/exec/*
chmod 555 /var/lib/lxc/piston/rootfs/exec/*
chown -R root:root /var/lib/lxc/piston/rootfs/exec
lxc-start -n piston -d

View File

@ -2,54 +2,54 @@
cd tests
echo 'testing awk'
../execute awk test.awk
../../cli/execute awk test.awk
echo 'testing c'
../execute c test.c
../../cli/execute c test.c
echo 'testing cpp'
../execute cpp test.cpp
../../cli/execute cpp test.cpp
echo 'testing cs'
../execute cs test.cs
../../cli/execute cs test.cs
echo 'testing deno'
../execute deno testdeno.ts
../../cli/execute deno testdeno.ts
echo 'testing elisp'
../execute elisp test.el
../../cli/execute elisp test.el
echo 'testing elixir'
../execute exs test.exs
../../cli/execute exs test.exs
echo 'testing go'
../execute go test.go
../../cli/execute go test.go
echo 'testing haskell'
../execute haskell test.hs
../../cli/execute haskell test.hs
echo 'testing java'
../execute java test.java
../../cli/execute java test.java
echo 'testing jelly'
../execute jelly test.jelly
../../cli/execute jelly test.jelly
echo 'testing jl'
../execute jl test.jl
../../cli/execute jl test.jl
echo 'testing js'
../execute js test.js
../../cli/execute js test.js
echo 'testing kotlin'
../execute kotlin test.kt
../../cli/execute kotlin test.kt
echo 'testing asm 32 bit'
../execute asm test.nasm
../../cli/execute asm test.nasm
echo 'testing asm 64 bit'
../execute asm64 test64.nasm
../../cli/execute asm64 test64.nasm
echo 'testing php'
../execute php test.php
../../cli/execute php test.php
echo 'testing perl'
../execute perl test.pl
../../cli/execute perl test.pl
echo 'testing ruby'
../execute ruby test.rb
../../cli/execute ruby test.rb
echo 'testing rust'
../execute rust test.rs
../../cli/execute rust test.rs
echo 'testing bash'
../execute bash test.sh
../../cli/execute bash test.sh
echo 'testing swift'
../execute swift test.swift
../../cli/execute swift test.swift
echo 'testing typescript'
../execute typescript test.ts
../../cli/execute typescript test.ts
echo 'testing python2'
../execute python2 test2.py
../../cli/execute python2 test2.py
echo 'testing python3'
../execute python3 test3.py
../../cli/execute python3 test3.py
echo 'testing paradoc'
../execute python3 test_paradoc.py
../../cli/execute python3 test_paradoc.py

View File

@ -148,6 +148,8 @@ cd piston/lxc
- See `var/install.txt` for how to create a new LXC container and install all of the required
software.
#### CLI Usage
- `cli/execute [language] [file path] [args]`
<br>
# Usage
@ -185,14 +187,17 @@ Content-Type: application/json
[
{
"name": "awk",
"aliases": ["awk"],
"version": "1.3.3"
},
{
"name": "bash",
"aliases": ["bash"],
"version": "4.4.20"
},
{
"name": "c",
"aliases": ["c"],
"version": "7.5.0"
}
]
@ -236,8 +241,7 @@ HTTP/1.1 400 Bad Request
Content-Type: application/json
{
"code": "unsupported_language",
"message": "whatever is not supported by Piston"
"message": "Provided language is not supported by Piston"
}
```

49
shared/execute.js Normal file
View File

@ -0,0 +1,49 @@
const { writeFileSync } = require('fs');
const { spawn } = require('child_process');
function execute(language, source, stdin = '', args = []) {
return new Promise(resolve => {
const stamp = new Date().getTime();
const sourceFile = `/tmp/${stamp}.code`;
writeFileSync(sourceFile, source);
const process = spawn(__dirname + '/../lxc/execute', [
language.name,
sourceFile,
stdin,
args.join('\n'),
]);
let stdout = '';
let stderr = '';
let output = '';
process.stderr.on('data', chunk => {
stderr += chunk;
output += chunk;
});
process.stdout.on('data', chunk => {
stdout += chunk;
output += chunk;
});
process.on('exit', code => {
stderr = stderr.trim().substring(0, 65535);
stdout = stdout.trim().substring(0, 65535);
output = output.trim().substring(0, 65535);
resolve({
stdout,
stderr,
output,
ran: code === 0,
});
});
});
}
module.exports = {
execute,
};

202
shared/languages.json Normal file
View File

@ -0,0 +1,202 @@
[
{
"name": "nasm",
"aliases": [
"asm",
"nasm"
]
},
{
"name": "nasm64",
"aliases": [
"asm64",
"nasm64"
]
},
{
"name": "awk",
"aliases": [
"awk"
]
},
{
"name": "bash",
"aliases": [
"bash"
]
},
{
"name": "brainfuck",
"aliases": [
"bf",
"brainfuck"
]
},
{
"name": "c",
"aliases": [
"c"
]
},
{
"name": "csharp",
"aliases": [
"c#",
"cs",
"csharp"
]
},
{
"name": "cpp",
"aliases": [
"c++",
"cpp",
"cc",
"cxx"
]
},
{
"name": "deno",
"aliases": [
"deno",
"denojs",
"denots"
]
},
{
"name": "ruby",
"aliases": [
"duby",
"rb",
"ruby"
]
},
{
"name": "emacs",
"aliases": [
"el",
"elisp",
"emacs"
]
},
{
"name": "elixir",
"aliases": [
"elixir",
"exs"
]
},
{
"name": "haskell",
"aliases": [
"haskell",
"hs"
]
},
{
"name": "go",
"aliases": [
"go",
"golang"
]
},
{
"name": "java",
"aliases": [
"java"
]
},
{
"name": "node",
"aliases": [
"javascript",
"js",
"node",
"node.js"
]
},
{
"name": "jelly",
"aliases": [
"jelly"
]
},
{
"name": "julia",
"aliases": [
"jl",
"julia"
]
},
{
"name": "kotlin",
"aliases": [
"kotlin",
"kt"
]
},
{
"name": "lua",
"aliases": [
"lua"
]
},
{
"name": "paradoc",
"aliases": [
"paradoc"
]
},
{
"name": "perl",
"aliases": [
"perl",
"pl"
]
},
{
"name": "php",
"aliases": [
"php",
"php3",
"php4",
"php5"
]
},
{
"name": "python3",
"aliases": [
"py",
"py3",
"python",
"python3"
]
},
{
"name": "python2",
"aliases": [
"python2",
"py2"
]
},
{
"name": "rust",
"aliases": [
"rs",
"rust"
]
},
{
"name": "swift",
"aliases": [
"swift"
]
},
{
"name": "typescript",
"aliases": [
"ts",
"typescript"
]
}
]

View File

@ -96,11 +96,13 @@ make
make install
# install rust
# final binary: /opt/.cargo/bin/rustc
# get version: /opt/.cargo/bin/rustc --version
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
echo 'export PATH=$PATH:/opt/.cargo/bin' >> /opt/.profile
source /opt/.profile
# final binary: /usr/local/bin/rustc
# get version: /usr/local/bin/rustc --version
cd /opt && mkdir rust && cd rust
wget https://static.rust-lang.org/dist/rust-1.49.0-x86_64-unknown-linux-gnu.tar.gz
tar -xzf rust-1.49.0-x86_64-unknown-linux-gnu.tar.gz
cd rust-1.49.0-x86_64-unknown-linux-gnu
./install.sh
# install swift
# final binary: /opt/swift/swift-5.1.5-RELEASE-ubuntu18.04/usr/bin/swift