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
import time | |
import vertx | |
server = vertx.create_http_server() | |
@server.request_handler | |
def request_handler(req): | |
if request.uri == '/sleep': | |
time.sleep(60 * 1) |
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
# http://www.python.org/dev/peps/pep-0395/ | |
if sys.version_info >= (3, 3): | |
def qualname(obj): | |
if not hasattr(obj, '__name__') and hasattr(obj, '__class__'): | |
return qualname(obj.__class__) | |
return '.'.join((obj.__module__, | |
getattr(obj, '__qualname__', None) or obj.__name__)) | |
else: | |
def qualname(obj): |
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
$ cd /usr/local/src | |
$ wget http://www.python.org/ftp/python/3.4.0/Python-3.4.0b2.tgz | |
$ tar -xzf Python-3.4.0b2.tgz Python-3.4.0b2 | |
$ cd Python-3.4.0b2 | |
$ ./configure --enable-shared --prefix=/usr/local | |
$ make | |
$ make altinstall | |
$ python3.4 |
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
# -*- coding: utf-8 -*- | |
import os.path | |
import string | |
import sys | |
def print_buf(counter, buf): | |
buf2 = [('%02x' % ord(i)) for i in buf] | |
print '{0}: {1:<39} {2}'.format(('%07x' % (counter * 16)), | |
' '.join([''.join(buf2[i:i + 2]) for i in range(0, len(buf2), 2)]), |
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
import tornado.ioloop | |
import email | |
from bonzo.smtpserver import SMTPServer | |
def receive_message(message): | |
print "New received message: " | |
print "From: " + message['from'] | |
print "Subject: " + message['subject'] |
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
# -*- coding: utf-8 *-* | |
import logging | |
import motor | |
import pymongo | |
from mongolog.handlers import MongoHandler | |
from tornado import ioloop, options, web | |
from tornado.options import options as opts | |
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
<html> | |
<head> | |
<title>TornadoMail Demo</title> | |
</head> | |
<body> | |
<form method="post" action="/"> | |
<input type="text" name="subject"/> | |
<input type="text" name="email"/> | |
<input type="submit" value="Send message"/> | |
</form> |
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
greeting = 'Hello, World' |
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
<html> | |
<body> | |
<p> | |
Current user: <strong>{{ current_user }}</strong> | |
</p> | |
<a href="/logout">Logout</a> | |
</body> | |
</html> |
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
import toro | |
from tornado import ioloop, gen, web | |
q = toro.JoinableQueue() | |
@gen.engine | |
def consumer(): |