
python
karlzheng
这个作者很懒,什么都没留下…
展开
-
可以替换掉网页某个文件的代理
用twisted写一个替换掉网站上某个文件的代理,作用参见http://lifesinger.org/blog/?p=40“如何直接调试线上页面的JavaScript和CSS”这篇文章,有了这个就不用fidder了,而且使用更加方便,替换时把要把原来的文件的content-length这个header去掉:from twisted.web import httpfrom t原创 2009-05-21 14:52:00 · 6062 阅读 · 1 评论 -
Python for Bash scripters: A well-kept secret
http://magazine.redhat.com/2008/02/07/python-for-bash-scripters-a-well-kept-secret/Python for Bash scripters: A well-kept secretby Noah GiftHey you, ya you! Do you write Bash scrip转载 2011-12-10 14:06:58 · 6003 阅读 · 0 评论 -
simg2img.py
#!/usr/bin/env python#encoding:utf8#===============================================================================## FILE: simg2img.py# # USAGE: ./simg2img.py system.img #原创 2011-10-18 20:21:29 · 8555 阅读 · 1 评论 -
use python in vim script of ~/.vimrc
function! My_Save_CompareFileName() let str = expand("%:p") let str = s:Escape(str) execute ":!echo '".str."' > /dev/shm/beyond_compare_file_a"endfunctionnmap ba :call My_Save_CompareFileName原创 2011-12-01 22:50:27 · 6012 阅读 · 0 评论 -
imap send email by python
import imaplibimport emaildef extract_body(payload): if isinstance(payload,str): return payload else: return '\n'.join([extract_body(part.get_payload()) for part in payload]原创 2011-11-02 18:57:26 · 7025 阅读 · 1 评论 -
web server:What you get is what I put
#!/usr/bin/env pythonfrom twisted.web import server,resourcefrom twisted.internet import reactorimport twistedimport timeimport mimetypesimport osfrom cStringIO import StringIOclass Root(reso原创 2011-10-21 17:10:07 · 6234 阅读 · 0 评论 -
python中用struct模块处理二进制数据(转)
http://blog.163.com/tieying5566@126/blog/static/6421517120117342958949/python中用struct模块处理二进制数据(转) 有的时候需要用python处理二进制数据,比如,存取文件,socket操作时.这时候,可以使用python的struct模块来完成.可以用 struct来处理c语言中的结转载 2011-10-21 16:59:55 · 5967 阅读 · 0 评论 -
python中用struct模块处理二进制数据(转)
http://blog.163.com/tieying5566@126/blog/static/6421517120117342958949/有的时候需要用python处理二进制数据,比如,存取文件,socket操作时.这时候,可以使用python的struct模转载 2011-10-18 20:19:54 · 5984 阅读 · 0 评论 -
bin2hex.py && hex2bin.py
打印bin文件ASCII十六进制 和 把16进制文本文件转换成bin文件 python代码原创 2010-12-18 22:55:00 · 9274 阅读 · 0 评论 -
用python把图片像素点数据转换成文本
把bmp图片的数据转换成数组放到uboot代码中原创 2010-07-13 11:28:00 · 13592 阅读 · 0 评论 -
在python用socket传送文件
putget_server.py#encoding=utf-8import socketimport commonimport sysimport threadimport threadingclass connection: def __init__(self, s): self.socket = s self.status =原创 2009-05-21 14:27:00 · 9016 阅读 · 1 评论 -
Powerful Python One-Liners
http://wiki.python.org/moin/Powerful%20Python%20One-LinersPowerful Python One-LinersThis is a page that is devoted to short programs that can perform powerful operations. The ability to转载 2012-04-14 21:11:37 · 3863 阅读 · 0 评论