diff --git a/lib/linguist/languages.yml b/lib/linguist/languages.yml index 47616921..a6f0054b 100644 --- a/lib/linguist/languages.yml +++ b/lib/linguist/languages.yml @@ -1841,6 +1841,7 @@ Python: color: "#3581ba" extensions: - .py + - .cgi - .gyp - .lmi - .pyde @@ -2150,6 +2151,7 @@ Shell: - .sh - .bash - .bats + - .cgi - .tmux - .zsh interpreters: diff --git a/samples/Python/action.cgi b/samples/Python/action.cgi new file mode 100644 index 00000000..80630783 --- /dev/null +++ b/samples/Python/action.cgi @@ -0,0 +1,82 @@ +#!/usr/bin/python + +from model import Feed +import session +import datetime +import sys + +argv = session.argv() + +feed = Feed.get(guid=argv[1]) +action = argv[2] + +if action == 'done': + when = feed.notify_interval * feed.notify_unit +elif action == 'snooze': + if len(argv) > 3: + when = int(argv[3]) + else: + when = 3600 +else: + print '''Status: 400 Bad request +Content-type: text/html + +Unknown action %s''' % action + sys.exit(1) + +feed.notify_next = datetime.datetime.utcnow() + datetime.timedelta(seconds=when) +feed.save() + +response = '''Content-type: text/html + +
Alarm "{name}" has been reset. You won't be notified for another {duration}.
+ +Actions:
+ +$(killall ems)" + + + +echo "
$(date $month$day$hour$minute$year.$second)" + +echo "
$(/sbin/hwclock -w>/dev/null & /sbin/reboot)" + +echo "
$(/sbin/reboot)" + + + + + + +echo "" \ No newline at end of file