Initial commit
This commit is contained in:
commit
93a4378475
62 changed files with 864 additions and 0 deletions
4
languages/apl/Dockerfile
Normal file
4
languages/apl/Dockerfile
Normal file
|
@ -0,0 +1,4 @@
|
|||
FROM juergensauermann/gnu-apl
|
||||
LABEL author="1Computer1"
|
||||
|
||||
COPY run.sh /var/run/
|
2
languages/apl/run.sh
Normal file
2
languages/apl/run.sh
Normal file
|
@ -0,0 +1,2 @@
|
|||
printf %s "$1" > program.apl
|
||||
apl --OFF -s -f program.apl || true
|
4
languages/bash/Dockerfile
Normal file
4
languages/bash/Dockerfile
Normal file
|
@ -0,0 +1,4 @@
|
|||
FROM bash
|
||||
LABEL author="1Computer1"
|
||||
|
||||
COPY run.sh /var/run/
|
2
languages/bash/run.sh
Normal file
2
languages/bash/run.sh
Normal file
|
@ -0,0 +1,2 @@
|
|||
printf %s "$1" > program.sh
|
||||
bash program.sh || true
|
12
languages/brainfuck/Dockerfile
Normal file
12
languages/brainfuck/Dockerfile
Normal file
|
@ -0,0 +1,12 @@
|
|||
FROM alpine AS build
|
||||
|
||||
RUN apk update && apk add g++
|
||||
COPY bf.cpp .
|
||||
RUN g++ bf.cpp -o bf
|
||||
|
||||
FROM alpine
|
||||
LABEL author="1Computer1"
|
||||
|
||||
RUN apk update && apk add libstdc++
|
||||
COPY --from=build bf /usr/local/bin/
|
||||
COPY run.sh /var/run/
|
119
languages/brainfuck/bf.cpp
Normal file
119
languages/brainfuck/bf.cpp
Normal file
|
@ -0,0 +1,119 @@
|
|||
#include <iostream>
|
||||
#include <vector>
|
||||
#include <string.h>
|
||||
#include <string>
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
std::string ops;
|
||||
if (argc == 1) {
|
||||
std::string line;
|
||||
while (std::getline(std::cin, line)) {
|
||||
ops.append(line);
|
||||
}
|
||||
|
||||
if (ops.empty()) {
|
||||
std::cerr << "No input given";
|
||||
return 1;
|
||||
}
|
||||
} else {
|
||||
ops.assign(argv[1], strlen(argv[1]));
|
||||
}
|
||||
|
||||
int len = ops.length();
|
||||
std::vector<char> tape = { 0 };
|
||||
int oix = 0;
|
||||
int tix = 0;
|
||||
while (oix < len) {
|
||||
switch (ops[oix]) {
|
||||
case '>':
|
||||
tix++;
|
||||
if (tix >= tape.size()) {
|
||||
tape.push_back(0);
|
||||
}
|
||||
|
||||
oix++;
|
||||
break;
|
||||
case '<':
|
||||
tix--;
|
||||
if (tix < 0) {
|
||||
std::cerr << "Out of bounds";
|
||||
return 1;
|
||||
}
|
||||
|
||||
oix++;
|
||||
break;
|
||||
case '+':
|
||||
tape[tix]++;
|
||||
oix++;
|
||||
break;
|
||||
case '-':
|
||||
tape[tix]--;
|
||||
oix++;
|
||||
break;
|
||||
case '.':
|
||||
std::cout << tape[tix];
|
||||
oix++;
|
||||
break;
|
||||
case ',':
|
||||
std::cin >> tape[tix];
|
||||
oix++;
|
||||
break;
|
||||
case '[':
|
||||
if (tape[tix] == 0) {
|
||||
int ls = 0;
|
||||
int rs = 0;
|
||||
for (int i = oix; i < len; i++) {
|
||||
switch (ops[i]) {
|
||||
case '[':
|
||||
ls++;
|
||||
break;
|
||||
case ']':
|
||||
rs++;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (ls == rs) {
|
||||
oix = i + 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
oix++;
|
||||
}
|
||||
|
||||
break;
|
||||
case ']':
|
||||
if (tape[tix] != 0) {
|
||||
int ls = 0;
|
||||
int rs = 0;
|
||||
for (int i = oix; i >= 0; i--) {
|
||||
switch (ops[i]) {
|
||||
case '[':
|
||||
ls++;
|
||||
break;
|
||||
case ']':
|
||||
rs++;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (ls == rs) {
|
||||
oix = i + 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
oix++;
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
oix++;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
1
languages/brainfuck/run.sh
Normal file
1
languages/brainfuck/run.sh
Normal file
|
@ -0,0 +1 @@
|
|||
printf %s "$1" | bf || true
|
7
languages/c/Dockerfile
Normal file
7
languages/c/Dockerfile
Normal file
|
@ -0,0 +1,7 @@
|
|||
FROM alpine
|
||||
LABEL author="1Computer1"
|
||||
|
||||
RUN apk update
|
||||
RUN apk add gcc libc-dev
|
||||
|
||||
COPY run.sh /var/run/
|
2
languages/c/run.sh
Normal file
2
languages/c/run.sh
Normal file
|
@ -0,0 +1,2 @@
|
|||
printf %s "$1" > program.c
|
||||
gcc program.c -o program && ./program || true
|
4
languages/clojure/Dockerfile
Normal file
4
languages/clojure/Dockerfile
Normal file
|
@ -0,0 +1,4 @@
|
|||
FROM clojure:tools-deps-alpine
|
||||
LABEL author="1Computer1"
|
||||
|
||||
COPY run.sh /var/run/
|
2
languages/clojure/run.sh
Normal file
2
languages/clojure/run.sh
Normal file
|
@ -0,0 +1,2 @@
|
|||
printf %s "$1" > program.clj
|
||||
clojure program.clj || true
|
7
languages/cpp/Dockerfile
Normal file
7
languages/cpp/Dockerfile
Normal file
|
@ -0,0 +1,7 @@
|
|||
FROM alpine
|
||||
LABEL author="1Computer1"
|
||||
|
||||
RUN apk update
|
||||
RUN apk add g++
|
||||
|
||||
COPY run.sh /var/run/
|
2
languages/cpp/run.sh
Normal file
2
languages/cpp/run.sh
Normal file
|
@ -0,0 +1,2 @@
|
|||
printf %s "$1" > program.cpp
|
||||
g++ program.cpp -o program && ./program || true
|
4
languages/csharp/Dockerfile
Normal file
4
languages/csharp/Dockerfile
Normal file
|
@ -0,0 +1,4 @@
|
|||
FROM mono
|
||||
LABEL author="1Computer1"
|
||||
|
||||
COPY run.sh /var/run/
|
2
languages/csharp/run.sh
Normal file
2
languages/csharp/run.sh
Normal file
|
@ -0,0 +1,2 @@
|
|||
printf %s "$1" > program.cs
|
||||
csc program.cs >/dev/null && mono program.exe || true
|
4
languages/elixir/Dockerfile
Normal file
4
languages/elixir/Dockerfile
Normal file
|
@ -0,0 +1,4 @@
|
|||
FROM elixir:alpine
|
||||
LABEL author="1Computer1"
|
||||
|
||||
COPY run.sh /var/run/
|
2
languages/elixir/run.sh
Normal file
2
languages/elixir/run.sh
Normal file
|
@ -0,0 +1,2 @@
|
|||
printf %s "$1" > program.exs
|
||||
elixir program.exs || true
|
4
languages/fsharp/Dockerfile
Normal file
4
languages/fsharp/Dockerfile
Normal file
|
@ -0,0 +1,4 @@
|
|||
FROM fsharp
|
||||
LABEL author="1Computer1"
|
||||
|
||||
COPY run.sh /var/run/
|
2
languages/fsharp/run.sh
Normal file
2
languages/fsharp/run.sh
Normal file
|
@ -0,0 +1,2 @@
|
|||
printf %s "$1" > program.fs
|
||||
fsharpc --optimize- program.fs >/dev/null && mono program.exe || true
|
4
languages/go/Dockerfile
Normal file
4
languages/go/Dockerfile
Normal file
|
@ -0,0 +1,4 @@
|
|||
FROM golang:alpine
|
||||
LABEL author="1Computer1"
|
||||
|
||||
COPY run.sh /var/run/
|
3
languages/go/run.sh
Normal file
3
languages/go/run.sh
Normal file
|
@ -0,0 +1,3 @@
|
|||
export GOCACHE=/tmp/"$CODEDIR"/cache
|
||||
printf %s "$1" > program.go
|
||||
go run program.go || true
|
15
languages/haskell/Dockerfile
Normal file
15
languages/haskell/Dockerfile
Normal file
|
@ -0,0 +1,15 @@
|
|||
FROM debian:stretch
|
||||
LABEL author="1Computer1"
|
||||
ENV LANG C.UTF-8
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get install -y --no-install-recommends gnupg dirmngr && \
|
||||
echo 'deb http://downloads.haskell.org/debian stretch main' > /etc/apt/sources.list.d/ghc.list && \
|
||||
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys BA3CBA3FFE22B574 && \
|
||||
apt-get update && \
|
||||
apt-get install -y --no-install-recommends ghc-8.6.5
|
||||
|
||||
ENV PATH /opt/ghc/8.6.5/bin:$PATH
|
||||
|
||||
COPY .ghci $HOME/
|
||||
COPY run.sh /var/run/
|
2
languages/haskell/run.sh
Normal file
2
languages/haskell/run.sh
Normal file
|
@ -0,0 +1,2 @@
|
|||
printf %s "$1" > program.hs
|
||||
ghc -e main program.hs || true
|
4
languages/java/Dockerfile
Normal file
4
languages/java/Dockerfile
Normal file
|
@ -0,0 +1,4 @@
|
|||
FROM openjdk:13-alpine
|
||||
LABEL author="1Computer1"
|
||||
|
||||
COPY run.sh /var/run/
|
2
languages/java/run.sh
Normal file
2
languages/java/run.sh
Normal file
|
@ -0,0 +1,2 @@
|
|||
printf %s "$1" > Main.java
|
||||
javac Main.java && java Main || true
|
4
languages/javascript/Dockerfile
Normal file
4
languages/javascript/Dockerfile
Normal file
|
@ -0,0 +1,4 @@
|
|||
FROM node:alpine
|
||||
LABEL author="1Computer1"
|
||||
|
||||
COPY run.sh /var/run/
|
1
languages/javascript/run.sh
Normal file
1
languages/javascript/run.sh
Normal file
|
@ -0,0 +1 @@
|
|||
printf %s "$1" | node -p || true
|
4
languages/julia/Dockerfile
Normal file
4
languages/julia/Dockerfile
Normal file
|
@ -0,0 +1,4 @@
|
|||
FROM julia
|
||||
LABEL author="1Computer1"
|
||||
|
||||
COPY run.sh /var/run/
|
1
languages/julia/run.sh
Normal file
1
languages/julia/run.sh
Normal file
|
@ -0,0 +1 @@
|
|||
printf %s "$1" | julia
|
6
languages/lua/Dockerfile
Normal file
6
languages/lua/Dockerfile
Normal file
|
@ -0,0 +1,6 @@
|
|||
FROM alpine
|
||||
|
||||
RUN apk update
|
||||
RUN apk add lua5.3
|
||||
|
||||
COPY run.sh /var/run/
|
2
languages/lua/run.sh
Normal file
2
languages/lua/run.sh
Normal file
|
@ -0,0 +1,2 @@
|
|||
printf %s "$1" > program.lua
|
||||
lua5.3 program.lua || true
|
4
languages/ocaml/Dockerfile
Normal file
4
languages/ocaml/Dockerfile
Normal file
|
@ -0,0 +1,4 @@
|
|||
FROM frolvlad/alpine-ocaml
|
||||
LABEL author="1Computer1"
|
||||
|
||||
COPY run.sh /var/run/
|
2
languages/ocaml/run.sh
Normal file
2
languages/ocaml/run.sh
Normal file
|
@ -0,0 +1,2 @@
|
|||
printf %s "$1" > program.ml
|
||||
ocamlopt -cclib --static -o program program.ml && ./program || true
|
4
languages/pascal/Dockerfile
Normal file
4
languages/pascal/Dockerfile
Normal file
|
@ -0,0 +1,4 @@
|
|||
FROM frolvlad/alpine-fpc
|
||||
LABEL author="1Computer1"
|
||||
|
||||
COPY run.sh /var/run/
|
10
languages/pascal/run.sh
Normal file
10
languages/pascal/run.sh
Normal file
|
@ -0,0 +1,10 @@
|
|||
printf %s "$1" > program.pas
|
||||
|
||||
# fpc does not use stderr, ld however does, capture both
|
||||
res="$(fpc program.pas 2>&1)"
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
./program || true
|
||||
else
|
||||
printf %s "$res"
|
||||
fi
|
4
languages/perl/Dockerfile
Normal file
4
languages/perl/Dockerfile
Normal file
|
@ -0,0 +1,4 @@
|
|||
FROM perl:slim
|
||||
LABEL author="1Computer1"
|
||||
|
||||
COPY run.sh /var/run/
|
2
languages/perl/run.sh
Normal file
2
languages/perl/run.sh
Normal file
|
@ -0,0 +1,2 @@
|
|||
printf %s "$1" > program.pl
|
||||
perl program.pl || true
|
4
languages/php/Dockerfile
Normal file
4
languages/php/Dockerfile
Normal file
|
@ -0,0 +1,4 @@
|
|||
FROM php:alpine
|
||||
LABEL author="1Computer1"
|
||||
|
||||
COPY run.sh /var/run/
|
2
languages/php/run.sh
Normal file
2
languages/php/run.sh
Normal file
|
@ -0,0 +1,2 @@
|
|||
printf %s "$1" > program.php
|
||||
php program.php || true
|
4
languages/prolog/Dockerfile
Normal file
4
languages/prolog/Dockerfile
Normal file
|
@ -0,0 +1,4 @@
|
|||
FROM swipl
|
||||
LABEL author="1Computer1"
|
||||
|
||||
COPY run.sh /var/run/
|
2
languages/prolog/run.sh
Normal file
2
languages/prolog/run.sh
Normal file
|
@ -0,0 +1,2 @@
|
|||
printf %s "$1" > program.pl
|
||||
swipl --quiet program.pl || true
|
4
languages/python/Dockerfile
Normal file
4
languages/python/Dockerfile
Normal file
|
@ -0,0 +1,4 @@
|
|||
FROM python:3-alpine
|
||||
LABEL author="1Computer1"
|
||||
|
||||
COPY run.sh /var/run/
|
2
languages/python/run.sh
Normal file
2
languages/python/run.sh
Normal file
|
@ -0,0 +1,2 @@
|
|||
printf %s "$1" > program.py
|
||||
python program.py || true
|
4
languages/racket/Dockerfile
Normal file
4
languages/racket/Dockerfile
Normal file
|
@ -0,0 +1,4 @@
|
|||
FROM jackfirth/racket
|
||||
LABEL author="1Computer1"
|
||||
|
||||
COPY run.sh /var/run/
|
2
languages/racket/run.sh
Normal file
2
languages/racket/run.sh
Normal file
|
@ -0,0 +1,2 @@
|
|||
printf %s "$1" > program.rkt
|
||||
racket program.rkt || true
|
4
languages/ruby/Dockerfile
Normal file
4
languages/ruby/Dockerfile
Normal file
|
@ -0,0 +1,4 @@
|
|||
FROM ruby:alpine
|
||||
LABEL author="1Computer1"
|
||||
|
||||
COPY run.sh /var/run/
|
2
languages/ruby/run.sh
Normal file
2
languages/ruby/run.sh
Normal file
|
@ -0,0 +1,2 @@
|
|||
printf %s "$1" > program.rb
|
||||
ruby program.rb || true
|
4
languages/rust/Dockerfile
Normal file
4
languages/rust/Dockerfile
Normal file
|
@ -0,0 +1,4 @@
|
|||
FROM rust:slim
|
||||
LABEL author="1Computer1"
|
||||
|
||||
COPY run.sh /var/run/
|
2
languages/rust/run.sh
Normal file
2
languages/rust/run.sh
Normal file
|
@ -0,0 +1,2 @@
|
|||
printf %s "$1" > program.rs
|
||||
rustc -C opt-level=0 --color never program.rs && ./program || true
|
Loading…
Add table
Add a link
Reference in a new issue