PoC code in poc directory.

This commit is contained in:
Roberto Abdelkader Martínez Pérez
2019-04-26 07:49:35 +02:00
parent 3017755ea1
commit 969a2522c4
9 changed files with 0 additions and 0 deletions
-30
View File
@@ -1,30 +0,0 @@
#!/bin/bash
touch input
touch output
tail -F input | tr '[:lower:]' '[:upper:]' > output &
kroute add -X POST --entrypoint /home/nil/Project/kapow/kapow2/examples/topdf '/convert/{from}/pdf'
kroute add -X POST --entrypoint /bin/zsh '/convert/{from}/{to}' - <<-'EOF'
pandoc --from=$(request /match/from) --to=$(request /match/to) --output=>(response /body) =(request /body)
EOF
kroute add -X GET '/formats/input' - <<-EOF
pandoc --list-input-formats | response /body
EOF
kroute add '/formats/output' - <<-EOF
pandoc --list-output-formats | grep -v pdf | response /body
EOF
kroute add '/tail' - <<-EOF
tail -f /tmp/mispelotas | response /stream
EOF
kroute add -X POST '/tr' --command '
request /body >> input
tail -n1 output | response /body
'
-12
View File
@@ -1,12 +0,0 @@
#!/usr/bin/zsh
tmpfile=$(mktemp --suffix=.pdf)
pandoc --from=$(request /match/from) --to=pdf --output=${tmpfile} -t latex =(request /body)
if [ $? -eq 0 ]; then
cat ${tmpfile} | response /body
echo "application/pdf" | response /header/Content-Type
echo 200 | response /status
else
echo 500 | response /status
fi
rm -f ${tmpfile}