Skip to content

Instantly share code, notes, and snippets.

View huacnlee's full-sized avatar

Jason Lee huacnlee

View GitHub Profile
# -*- coding: utf-8 -*-
import md5
def md5_encode(str):
u"""
summary:
MD5 encode
author:
Jason Lee <huacnlee@gmail.com>
"""
# -*- coding: utf-8 -*-
# ## ## ## ## ## ## ## ## ##
# upload file library
# ## ## ## ## ## ## ## ## ##
import sys,os
import time
from StringIO import StringIO
from PIL import Image
from tmitter.settings import *
import ImageFilter
# -*- coding: utf-8 -*-
#!/usr/bin/python
import sqlite3,os,traceback
import re
# ####################################
# config
# ####################################
#-*- coding: UTF-8 -*-
import flickr,image,imagecache
import urllib
from PIL import Image
import os
##### configs ######
SEARCH_LIST_FNAME = './searchlist.txt'
PROXY_FNAME = './proxy.txt'
# -*- coding: utf-8 -*-
from settings import *
import os,time,traceback
def write(ex):
"""
summary:
写日志,此功能主要是用于为方便记录运行期的错误,另外也可用做开发时的Ajax调试,为方便得到错误信息
params:
ex 文本 或 traceback对象
import os,sys,urllib2
PROXY_INFO = {
'user' : 'demo' ,
'pass' : '123123' ,
'host' : '192.168.1.104' ,
'port' : 8080
}
def load_url(url):
# -*- coding: utf-8 -*-
#!/usr/bin/python
# This code is original from jsmin by Douglas Crockford, it was translated to
# Python by Baruch Even. The original code had the following copyright and
# license.
#
# /* jsmin.c
# 2007-05-22
#
#
# Ruby scrapi 采集口碑房源数据
# Author: Huacnlee <huacnlee@gmail.com>
# Blog: http://huacnlee.com
#
# Gems install:
# sudo gem install scrapi
#
require 'rubygems'
require 'scrapi'
/**
* 验证是否是一个数值型
* 合法格式: 32位整型值 如1 52 5555 414
*/
String.prototype.isInt32 = function() {
var regex = new RegExp("^[\d]{1,32}$");
return regex.exec(this);
}
/**
/**
* 取得对向的大小和坐标 兼容多种浏览器
* @param {Object} owner
*/
var getPos = function(owner){
if(owner == undefined){
return {top : 0, left:0 , width : 0, height : 0};
}
var e = owner;