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/env python2.6 | |
#-*- coding:utf8 -*- | |
from tornado.ioloop import IOLoop | |
from tornado.web import Application, StaticFileHandler | |
from tornado.options import define, options, parse_command_line | |
from tornado.httpserver import HTTPServer | |
from tornado import template | |
from handler import * | |
import logging | |
import os |
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> | |
<script type="text/javascript" src="http://code.jquery.com/jquery-1.10.1.min.js"></script> | |
<script type="text/javascript"> | |
var qs = function () { | |
// This function is anonymous, is executed immediately and | |
// the return value is assigned to QueryString! | |
var query_string = {}; | |
var query = window.location.search.substring(1); | |
var vars = query.split("&"); |
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/python26 | |
from tornado.httpclient import HTTPRequest, AsyncHTTPClient | |
from tornado.ioloop import IOLoop | |
from tornado.options import parse_command_line | |
from tornado.options import options,define | |
from tornado.escape import utf8 | |
from urllib import quote_plus | |
from collections import deque | |
import simplejson as json | |
import logging |
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
from tornado.httpclient import AsyncHTTPClient | |
class BatchHttpRequest(object): | |
def __init__(self, urllist, callback): | |
self.pendings = len(urllist) | |
self.response = [] | |
self.callback = callback | |
for url in urllist: | |
AsyncHTTPClient().fetch(url, callback=self.complete) |
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 socket | |
import logging | |
HOST = '' # Symbolic name meaning the local host | |
PORT = 9000 # Arbitrary non-privileged port | |
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
s.bind((HOST, PORT)) | |
s.listen(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
def XpathLeef(o, path): | |
if path.startswith("{"): | |
path = path[1:-1] | |
for x in path.split(","): | |
if x not in o: | |
continue | |
yield utf8("%s:%s" % (x, o[x])) | |
elif path in o: | |
yield utf8("%s:%s" % (x, o[path])) |
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
from collections import deque | |
import copy | |
class Selector(object): | |
def __init__(self, fields): | |
self.model = {} | |
self._build(fields) | |
def _build(self, fields): | |
for expr in fields: |
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/env python26 | |
import sys | |
from tornado import ioloop | |
from tornado.options import define,options,parse_command_line | |
from beanstalkt import Client as BeansClient | |
define("bs_host", default="localhost") | |
define("bs_port", default=11300) | |
define("using", default="input") |
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/python26 | |
from tornado.httpclient import HTTPRequest, AsyncHTTPClient | |
from tornado.ioloop import IOLoop | |
from tornado.options import parse_command_line | |
from tornado.options import options,define | |
from tornado.escape import utf8 | |
from beanstalkt import Client as BeansClient | |
from beanstalkt import TimedOut | |
from urllib import quote_plus | |
from urlparse import urlparse |
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/python26 | |
from tornado.ioloop import IOLoop | |
from tornado.options import parse_command_line | |
from tornado.options import options,define | |
from tornado.escape import utf8 | |
from beanstalkt import Client as BeansClient | |
from beanstalkt import TimedOut | |
from urllib import quote_plus | |
from urlparse import urlparse | |
from collections import deque |
OlderNewer