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
#!/bin/python2.7 | |
# -`*- coding: utf-8 -*- | |
""" | |
test for Server-Side events in flask | |
inspiration from: | |
http://www.html5rocks.com/en/tutorials/eventsource/basics/ | |
https://github.com/niwibe/sse.git | |
https://github.com/niwibe/django-sse.git |
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
#!/usr/bin/python2.7 | |
# Simple example of using a 'handler' function | |
# -- Chris2048 | |
def parseLine(line): | |
if line==True: | |
raise Exception() | |
return "foo" |
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
# Use this shell function to sanitise variables before using them with sed, | |
# or in another context where escapes might be substituted | |
funtion san { | |
echo "$1" | tr -d '\n' | xxd -plain | sed 's/\(..\)/\\x\1/g' | tr -d '\n'; } | |
# Use it like this | |
# somevar=$(san "$somevar") |
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
(require 'benchmark) | |
(defun my-require (feat) | |
(if (featurep feat) | |
(message "erraneous usage: '%s'" feat) | |
(message "'%s' loaded in %.2fs" feat | |
(benchmark-elapse (load-library (symbol-name feat)))))) |
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
;; The Common Lisp library for Emacs Lisp gives us keyword arguments for defun* | |
(require 'cl) | |
(defvar projects (list) "This keeps track of all available projects.") | |
(defvar project (list) "And here's our current project.") | |
(defvar project-index (list) "This will store the project index of files.") | |
(defvar project-default-file-types '("ASCII.*")) | |
;; A project will have a name, a list of directories, (recursive and non), | |
;; and a list of file-types that we want to index. |
NewerOlder