Skip to content

Commit 3417fc9

Browse files
committed
screenshot
1 parent 7668e32 commit 3417fc9

File tree

4 files changed

+20
-5
lines changed

4 files changed

+20
-5
lines changed

README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
## Arbitrary Code Execution Demo
22

3+
![screenshot](screenshot.png "screenshot")
4+
35
Have you ever wondered what happens behind the scenes when you hit "Run" on a code snippet in online development environments like [Go Playground](https://go.dev/play/) or [Repl.it](https://replit.com/)?
46

57
This demonstration provides a basic implementation using approximately 100 lines of code.
@@ -31,7 +33,7 @@ curl \
3133
-s \
3234
-X POST \
3335
-H "content-type:application/json" \
34-
-d '{"language":"python3","code":"print(\"hello world\")"}' \
36+
-d '{"language":"python","code":"print(\"hello world\")"}' \
3537
http://localhost:8000/execute
3638
```
3739

config.distributed.toml

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[coordinator.api]
2+
endpoints.health = true
3+
endpoints.jobs = false
4+
endpoints.tasks = false
5+
endpoints.nodes = false
6+
endpoints.queues = false
7+
endpoints.stats = false
8+
9+
[broker]
10+
type = "rabbitmq"
11+
12+
[broker.rabbitmq]
13+
url = "amqp://guest:guest@localhost:5672"

handler/handler.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,11 @@ func buildTask(er ExecRequest) (input.Task, error) {
7373
switch strings.TrimSpace(er.Language) {
7474
case "":
7575
return input.Task{}, errors.Errorf("require: language")
76-
case "python3":
76+
case "python":
7777
image = "python:3"
7878
filename = "script.py"
7979
run = "python script.py > $TORK_OUTPUT"
80-
case "golang":
80+
case "go":
8181
image = "golang:1.19"
8282
filename = "main.go"
8383
run = "go run main.go > $TORK_OUTPUT"
@@ -95,8 +95,8 @@ func buildTask(er ExecRequest) (input.Task, error) {
9595
Run: run,
9696
Timeout: "5s",
9797
Limits: &input.Limits{
98-
CPUs: ".5",
99-
Memory: "6m",
98+
CPUs: "1",
99+
Memory: "20m",
100100
},
101101
Files: map[string]string{
102102
filename: er.Code,

screenshot.png

129 KB
Loading

0 commit comments

Comments
 (0)