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 python | |
# -*- coding: utf-8 -*- | |
# author: Rolando Espinoza La fuente | |
# | |
# Changelog: | |
# 24/07/2011 - updated to work with scrapy 13.0dev | |
# 25/08/2010 - initial version. works with scrapy 0.9 | |
from scrapy.contrib.loader import XPathItemLoader | |
from scrapy.item import Item, Field |
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/bash | |
USERNAME=root | |
PASSWORD=root | |
DBNAME=mydb | |
DATE=`date +%Y-%m-%d` | |
OLDDATE=`date +%Y-%m-%d -d '-20 days'` | |
FTPOLDDATE=`date +%Y-%m-%d -d '-60 days'` |
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 | |
def gensql(table,dicts): | |
with open("%s.table.sql"%table,'w') as buff: | |
for sqlobj in dicts: | |
ks,vs = '','' | |
for k,v in sqlobj.items(): | |
ks += '%s,'%k | |
vs += '\'%s\','%v | |
sql = "insert into %s (%s) values(%s);"%(table,ks[:-1],vs[:-1]) | |
print >> buff,sql |
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 sys | |
import cx_Oracle | |
import csv | |
print '请输入要导出的数据库地址,格式:user/passwd@host:port/sid :'.decode('utf-8') | |
db = len(sys.argv)>=2 and sys.argv[1] or raw_input('Enter db(user/passwd@host:port/sid):') | |
connection = cx_Oracle.Connection(db) |
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 -*- | |
"""The user interface for our app""" | |
import os,sys | |
import gevent | |
# Import Qt modules | |
from PyQt4 import QtCore,QtGui |
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
# -*- Encoding: utf-8 -*- | |
import base64 | |
import binascii | |
import cgi | |
import hashlib | |
import hmac | |
import logging | |
import time | |
import urllib | |
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
SocksiPy - Python SOCKS module. |
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 python | |
import os, sys | |
print "I'm going to fork now - the child will write something to a pipe, and the parent will read it back" | |
r, w = os.pipe() # r,w是文件描述符, 不是文件对象 | |
pid = os.fork() | |
if pid: | |
# 父进程 | |
os.close(w) # 关闭一个文件描述符 | |
r = os.fdopen(r) # 将r转化为文件对象 | |
print "parent: reading" |
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
##################################################################### | |
# COPY FROM http://www.gnome.org/~jdub/bzr/planet/2.0/planet/htmltmpl.py | |
# and inspired from http://www.python.org/pypi/zc.lockfile | |
# LICENSE: BSD | |
# Modified by: Limodou(limodou@gmail.com) | |
##################################################################### | |
__all__ = ['LOCK_EX', 'LOCK_SH', 'LOCK_UN', 'lock_file', 'unlock_file', | |
'LockFile', 'LockError'] |
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 sys | |
import signal | |
import urlparse | |
import gevent | |
from gevent.server import StreamServer | |
from gevent.socket import create_connection, gethostbyname | |
class ProxyServer(StreamServer): | |
def __init__(self, listener, **kwargs): |