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
# -*- coding: utf8 -*- | |
import time | |
import json | |
import random | |
import platform | |
from datetime import datetime | |
import requests | |
from selenium import webdriver |
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
# coding: utf-8 | |
from sqlalchemy.sql import compiler | |
from MySQLdb.converters import conversions, escape | |
def compile_query(query): | |
dialect = query.session.bind.dialect | |
statement = query.statement | |
comp = compiler.SQLCompiler(dialect, statement) |
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 pyparsing import * | |
# By default, PyParsing treats \n as whitespace and ignores it | |
# In our grammer, \n is significant, so tell PyParsing not to ignore it | |
ParserElement.setDefaultWhitespaceChars(" \t") | |
def parse(input_string): | |
def convert_prop_to_dict(tokens): | |
"""Convert a list of field property tokens to a dict""" | |
prop_dict = {} |
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
Traceback (most recent call last): | |
File "/usr/local/lib/python2.7/dist-packages/tornado/web.py", line 1042, in _execute | |
getattr(self, self.request.method.lower())(*args, **kwargs) | |
File "/usr/local/lib/python2.7/dist-packages/tornado/web.py", line 1809, in wrapper | |
return method(self, *args, **kwargs) | |
File "/www/v2ex/galaxy/handlers/web/place.py", line 38, in get | |
self.finalize('place/denied.html') | |
File "/www/v2ex/galaxy/handlers/web/__init__.py", line 49, in finalize | |
template = self.env.get_template(t) | |
File "/usr/local/lib/python2.7/dist-packages/jinja2/environment.py", line 719, in get_template |
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 urllib2 | |
import time | |
def main(): | |
opener = urllib2.build_opener() | |
while 1: | |
request = urllib2.Request('http://xinhuanet.com/') | |
page = opener.open(request) | |
print page.code | |
print 'sleeping...' |
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
hi |