Skip to content

Instantly share code, notes, and snippets.

@juancarlospaco
Last active April 6, 2018 19:27
Show Gist options
  • Save juancarlospaco/7d3fade1eb063add1dc96c37be1c0ce5 to your computer and use it in GitHub Desktop.
Save juancarlospaco/7d3fade1eb063add1dc96c37be1c0ce5 to your computer and use it in GitHub Desktop.
Quick and Dirty CGI Hacks from Bash
mkdir cgi-bin
echo '#!/usr/bin/env python3' > cgi-bin/test.py
echo 'print("Content-type:text/html\n\n"+__import__("calendar").HTMLCalendar().formatyearpage(2017).decode("utf-8"))' >> cgi-bin/test.py
chmod +x cgi-bin/test.py
python3 -m http.server --cgi &
xdg-open http://127.0.0.1:8000/cgi-bin/test.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment