Created
February 19, 2018 16:45
-
-
Save RichardBronosky/dd10a07de95a888b63964fe5b548b672 to your computer and use it in GitHub Desktop.
A Python cgi demo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo -e "\n\n Usage: after running this script, visit http://localhost:8000/cgi-bin/hello \n\n" | |
mkdir /tmp/cgi-bin/ | |
cat > /tmp/cgi-bin/hello <<EOF | |
#!/bin/bash | |
echo -e "Content-Type: text/plain\n\n"; date; echo; env | |
EOF | |
chmod +x /tmp/cgi-bin/hello | |
(cd /tmp; python3 -m http.server --cgi 8000) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This can be used to blink an LED on an RPi if you put https://gist.github.com/RichardBronosky/b037de3e8763887b034298057200bd02 in your /tmp/cgi-bin folder and https://gist.github.com/RichardBronosky/7f5832b2e0bac20db386bef4a7962a99 in
/home/pi/
(or edit the path ofDAEMON=
on line 8 of the daemon example)The LED pins are defined in
DAEMON_ARGS=
on line 9 of the daemon example. The meaning of that argument is explained in the pi_gpio_hack example