-
Notifications
You must be signed in to change notification settings - Fork 0
/
stack
executable file
·63 lines (54 loc) · 1.31 KB
/
stack
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
function docker-build() {
docker build \
-t js-cli-wrapper \
.
}
function docker-run() {
docker run \
--rm \
--name js-cli-wrapper \
--add-host localhost:host-gateway \
-v /tmp/lilypad/data:/tmp/lilypad/data \
-p 3000:3000 \
js-cli-wrapper
}
function dev() {
npm run dev
}
function run() {
WEB3_PRIVATE_KEY=""
curl \
-X POST \
-H "Content-Type: application/json" \
-d '{"pk": "'"${WEB3_PRIVATE_KEY}"'", "module": "cowsay:v0.0.4", "inputs": "-i Message=moo" }' \
http://localhost:3000
}
function stream() {
WEB3_PRIVATE_KEY=""
curl \
-X POST \
-H "Content-Type: application/json" \
-d '{"pk": "'"${WEB3_PRIVATE_KEY}"'", "module": "cowsay:v0.0.4", "inputs": "-i Message=moo", "opts": { "stream": true } }' \
http://localhost:3000
}
function browser() {
# Wait until the container is ready
until $(curl --output /dev/null --silent --head --fail http://localhost:7860); do
printf '.'
sleep 1
done
if grep -qEi "(Microsoft|WSL)" /proc/version &> /dev/null; then
explorer.exe "$1"
else
case "$(uname)" in
Linux*) xdg-open "$1" ;;
Darwin*) open "$1" ;;
CYGWIN*|MINGW*|MSYS*) explorer.exe "$1" ;;
*) echo "Unsupported OS" ;;
esac
fi
}
eval "$@"