This file contains hidden or 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
| import sqlite3, contextlib, logging | |
| # from: http://docs.python.org/library/sqlite3.html#sqlite3.Connection.row_factory | |
| def dict_factory(cursor, row): | |
| d = {} | |
| for idx, col in enumerate(cursor.description): | |
| d[col[0]] = row[idx] | |
| return d | |
| @contextlib.contextmanager |
This file contains hidden or 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
| ;; pattern matching em CL é meio assim gents: | |
| ;; exemplo classics | |
| (defgeneric fact (n)) | |
| (defmethod fact ((n (eql 0))) | |
| 1) | |
| (defmethod fact ((n number)) | |
| (* n (fact (- n 1)))) |
This file contains hidden or 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
| if ((not message and not hamdir and not spamdir) or | |
| (message and (hamdir or spamdir)) or | |
| (not message and ((hamdir and not spamdir) or (spamdir and not hamdir)))) | |
| { | |
| usage(argv[0]); | |
| return 1; | |
| } |
This file contains hidden or 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
| import urllib, sys | |
| from BeautifulSoup import BeautifulSoup | |
| if __name__ == '__main__': | |
| if len(sys.argv) != 2: | |
| print "usage: %s <amazon s3 url>" % sys.argv[0] | |
| sys.exit(1) | |
| base_url = sys.argv[1] | |
| xml = urllib.urlopen(base_url).read() | |
| soup = BeautifulSoup(xml) |
This file contains hidden or 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
| # from: http://www.tornadoweb.org/documentation#running-tornado-in-production | |
| user nginx; | |
| worker_processes 1; | |
| error_log /var/log/nginx/error.log; | |
| pid /var/run/nginx.pid; | |
| events { | |
| worker_connections 1024; | |
| use epoll; |
This file contains hidden or 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
| (defun make-erlang () | |
| (interactive) | |
| (let* ((my-buffer (current-buffer)) | |
| (my-file (file-name-nondirectory buffer-file-name))) | |
| (when (switch-to-buffer "*erlang*") | |
| (goto-char (point-max)) | |
| (insert (concat "make:files([" my-file "], [netload]).")) | |
| (comint-send-input)) | |
| (switch-to-buffer my-buffer))) |
NewerOlder