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 -*- | |
import re | |
EMAIL_PATTERN = re.compile(u'[a-z0-9_\-\+\.]+@[a-z0-9_\-\.]+\.[a-z]+', re.I) | |
from lxml.html.clean import Cleaner | |
from lxml.html import defs | |
frozenset = set | |
defs.safe_attrs = frozenset([ |
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 -*- | |
import uuid | |
import base64 | |
import datetime | |
import email | |
import email.Header | |
from email.utils import getaddresses, parsedate_tz, mktime_tz | |
from StringIO import StringIO |
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 -*- | |
'参考smtplib,以tornado的IOStream实现的SMTP客户端' | |
import socket | |
import re | |
import email.utils | |
import tornado.ioloop | |
import tornado.iostream | |
import tornado.gen |
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 -*- | |
import logging | |
import socket | |
import uuid | |
import tornado.ioloop | |
import tornado.iostream | |
import tornado.gen | |
IL = tornado.ioloop.IOLoop.instance() |
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 -*- | |
'获取邮件' | |
import pickle | |
from time import time | |
from uuid import uuid4 | |
import os | |
import sys | |
import re |
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 -*- | |
import sys | |
import ldap | |
ldap.set_option(ldap.OPT_REFERRALS, 0) | |
con = ldap.initialize('ldap://ldap.example.com:389') | |
con.simple_bind_s( '[email protected]', '***' ) |
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 http://stevelosh.com/blog/2012/10/the-homely-mutt/ | |
#sidebar patch: http://www.lunar-linux.org/mutt-sidebar/ | |
set sendmail="python /home/zys/Dropbox/AceSend/sendmail.py" | |
set from="YS.Zou <[email protected]>" | |
set charset="utf-8" | |
set send_charset="utf-8" | |
set weed=yes | |
set text_flowed=yes | |
charset-hook ^gb2312$ gb18030 |
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 -*- | |
import MySQLdb | |
#(1, 2, 3, 'final', 0) | |
print MySQLdb.version_info | |
''' | |
+--------------------+ |
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 -*- | |
import os | |
if os.access('bottle.py.cache', os.F_OK): | |
with open('bottle.py.cache', 'r') as f: | |
code = f.read() | |
else: | |
import urllib2 | |
print 'Loading bottle ...' | |
res = urllib2.urlopen('http://bottlepy.org/bottle.py') |