自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

清风飘过

技术是生产力

  • 博客(84)
  • 资源 (3)
  • 收藏
  • 关注

转载 extundelete恢复Linux被删除文件

http://www.xifenfei.com/今天群中有个朋友的客户闲着没事rm掉了数据文件,然后讨论到使用extundelete进行了恢复,抢救了部分未被覆盖的数据文件。该软件官方地址:http://extundelete.sourceforge.net/安装extundelete[root@xifenfei tmp]# bunzip2 extundelete-0.2.0.

2012-08-31 23:14:00 3482 1

原创 aix确定VG类型方法

确定VG类型方法  AIX5.2增加了Big VG类型,AIX5.3以后,VG有了3种类型,普通VG,Big VG和Scalable VG。$ lsvg xxx_vgVOLUME GROUP:      xxx_vg                  VG IDENTIFIER:  00c5bf9c00004c0000000112da58dbf3VG STATE:

2012-08-31 23:01:09 1910

原创 python re.search模块实验

re.search函数会在字符串内查找模式匹配,只到找到第一个匹配然后返回,如果字符串没有匹配,则返回None。1. group:返回匹配到的一个或者多个子组。如果是一个参数,那么结果就是一个字符串,如果是多个参数,那么结果就是一个参数一个item的元组。group1的默认值为0(将返回所有的匹配值).如果groupN参数为0,相对应的返回值就是全部匹配的字符串,如果group1的值是[1

2012-08-31 19:01:32 4892

原创 aix下查看top 10 内存使用

ps gv |head -1;ps gv|sort +6b -nr |head查看SIZE项,单位1KB  zxrms140B:/tmp># ps  gv  |head  -1;ps   gv|sort  +6b  -nr  |head     PID    TTY STAT  TIME PGIN  SIZE   RSS   LIM  TSIZ   TRS %

2012-08-31 16:00:28 2485

原创 If you want to paste code into IPython, try the %paste and %cpaste magic functions.

ipython 拷贝时报错,不知如何解决,留作记录。

2012-08-31 12:41:41 2023

原创 re.split测试

Definition: re.split(pattern, string, maxsplit=0, flags=0)如下将字符串按空格分开,maxsplit是分离的次数,maxsplit=1分离一次,默认为0,不限制次数In [67]: textOut[67]: 'HTTP/1.1 301 Moved Permanently'In [68]: re.split(r"\s+"

2012-08-31 11:47:03 3883 1

原创 python ssh模块paramiko

paramiko模块下载http://www.lag.net/paramiko/PyCrypto模块下载 https://www.dlitz.net/software/pycrypto/在SLES11 SP1+python2.6/3.2下安装pycrypto2.6模块报错:“error: command 'gcc' failed with exit status 1

2012-08-30 21:08:36 901

原创 python正则表达式测试代码

import reimport sysif len(sys.argv) < 3: print("lack of argument\nusage: python reg.py passwd.txt travel+ed") sys.exit()#print("sys argument: ",sys.argv[2])#keyword=re.compile(r''

2012-08-29 18:52:29 556

原创 linux 正则表达式

经常使用的正则表达式举例^                                 行首$                                 行尾^ [ t h e ]                      以t h e开头行[ S s ] i g n a [ l L ]              匹配单词s i g n a l、s i g n a L、S

2012-08-29 16:45:51 676

转载 UTF-8 GBK UTF16 GB2312 之间的区别和关系

http://visionsky.blog.51cto.com/733317/895928UTF-8:Unicode TransformationFormat-8bit,允许含BOM,但通常不含BOM。是用以解决国际上字符的一种多字节编码,它对英文使用8位(即一个字节),中文使用24为(三个字节)来编码。UTF-8包含全世界所有国家需要用到的字符,是国际编码,通用性强。UTF-8编码的

2012-08-29 13:06:51 2562

转载 用Supervisord管理Python进程

转自:http://feilong.me/2011/03/monitor-processes-with-supervisord软件下载地址:http://pypi.python.org/pypi/supervisor/3.0a12#downloads软件文档:http://supervisord.org/installing.htmlSupervisord是用Python实现的一款

2012-08-29 00:45:47 1070

转载 linux 下使用supervisor管理源码启动的openerp

http://my.oschina.net/wangbuke/blog/67431 从源码启动openerp,简单的做法是添加启动脚本到/etc/init.d/rc.local等,让openerp 随系统启动而运行。此类方法只在系统启动时运行,但万一程序在运行中崩溃,您可能要等到用户发现不能使用了,才去重启服务器。下面请出今天的主角: supervisor   (http://supervis

2012-08-29 00:44:56 1021

转载 Pyinotify文件系统监控

http://www.cnblogs.com/oubo/archive/2011/11/01/2394612.htmlPyinotify is a Python module for monitoring filesystems changes. Pyinotify relies on a Linux Kernel feature (merged in kernel 2.6.13) cal

2012-08-29 00:28:07 1134

转载 Python读取pcap文件

http://blog.sina.com.cn/s/blog_4b5039210100gnlu.html  想试一试读取pcap文件的内容,并且分析出pcap文件头,每一包数据的pcap头,每一包的数据内容(暂时不包括数据包的协议解析),关于pcap文件的格式,可以参看:http://blog.sina.com.cn/s/blog_4b5039210100fzrt.html    搞了

2012-08-28 20:06:50 8794 2

转载 python3 获取网页内容保存到文件

http://hi.baidu.com/hibaid2083/item/b94ce23e22ca3e09ceb9feebimport http.client #导入包conn = http.client.HTTPConnection("mlive.info") #连接到地址conn.request("GET", "/index.html") #发送GET请求r1 = c

2012-08-28 16:42:14 3889

原创 python分析ip地理位置-python3版本

原帖为python2.6写的http://liang3391.blog.51cto.com/178205/544754看到一网友用python2.6写的一个脚本,处于好奇将其改写为python3,并做了小小的改动,在python3.2.3+win7及python3.2.2+SLES11 SP1下测试通过 #!/usr/bin/env pythonimport sysim

2012-08-28 16:21:07 1766

原创 Python的Pexpect详解

http://www.ibm.com/developerworks/cn/linux/l-cn-pexpect1/http://www.ibm.com/developerworks/cn/linux/l-cn-pexpect2/index.htmlpython pexpect多机远程管理范例http://yemaosheng.com/?p=973python

2012-08-28 00:00:40 3524

转载 httplib python3

3还改动了不少模块啊In Python 3, several related HTTP modules have been combined into a single package, http.import httplibimport http.clientimport Cookieimport http.cookiesimport cookielibimpor

2012-08-27 18:13:51 3889

转载 Python连接oracle的几种方式

http://www.tracylling.com/2011/09/28/python%E8%BF%9E%E6%8E%A5oracle%E7%9A%84%E5%87%A0%E7%A7%8D%E6%96%B9%E5%BC%8F/1. 基本连接–使用Oracle tns aliasconnection=cx_Oracle.connect("tp/tp@ocn_test")

2012-08-27 11:59:00 10248

转载 用python3抓取中文网页

http://www.oschina.net/code/snippet_241930_9550#! /usr/bin/python3.2import sysimport urllib.requestreq = urllib.request.Request('http://www.baidu.com')response = urllib.request.urlopen(req)

2012-08-26 21:58:55 751

转载 python时间转为时间戳

http://www.afen.cn/blog/?p=122找了半天没找着,终于在英文站点上找到,还有感谢群里的石头和球迷>>> s = datetime.datetime(2009,1,1)>>> time.mktime(s.timetuple())1230739200.0别外付一个python对时间的一些函数,很好用的我们先导入必须用到的一个module

2012-08-25 20:51:26 541

转载 Windows下的Console Emulator

对于一个UNIX下用惯了各种终端和各种shell的人来说,在Windows世界里最大的痛苦是那个蹩脚的cmd。虽然有Cygwin和Msys 的mintty/rxvt,但它们还是更适合跑bash和它们自己的term类程序,不适合跑Windows的console程序(比如路径的斜线/反斜 线问题,比如ANSI颜色问题。。。)下面,我们分两方面来找找替代品,这次介绍console emula

2012-08-25 20:28:09 3468

转载 Python操作Mysql

平时的主要编程语言是Java,开发时也主要用Mysql,经常为了测试,调试的目的需要操作数据库,比如备份,插入测试数据,修改测试数据,有些时候不能简单的用SQL就能完成任务,或都很好的完成任务,用Java写又有点太麻烦了,就想到了Python。Python语法简洁,不用编译,可以经较好的完成任务。今天看了下Python对Mysql的操作,做一下记录。 首先,

2012-08-25 12:25:46 413

转载 在python中使用cx_Oracle模块出现“DLL Load failed”的处理方法

当在python中使用cx_Oracle模块时,会出现“DLL Load failed”的错误,网上有很多讲这个问题的处理方法的,但是都不够详细,经过摸索,把详细的解决方法写在这里。网上的一般方法是建议把   oci.dll   放入到python的site-package文件夹下,但是具体oci.dll是哪个版本的,没有具体说明,这里我要说的是:oci.dll的版本一定要和cx_Orac

2012-08-25 00:31:29 2733

转载 Python 用hashlib求中文字符串的MD5值

http://blog.csdn.net/haungrui/article/details/6959340使用过hashlib库的朋友想必都遇到过以下的错误吧:“Unicode-objects must be encoded before hashing”,意思是在进行md5哈希运算前,需要对数据进行编码。而且在不同版本的Python下还有所不同,唉Python还需努力啊,接口和消息都很不稳定

2012-08-24 18:52:02 885

转载 python的import路径问题

http://hi.baidu.com/python23/blog/item/fe7112df15a24112632798ca.html 其实都知道 python的PATH包括:* 当前目录* 环境变量PYTHONPATH* WINDOWS的注册表* python安装目录下的lib和lib/site-packages* 程序运行过程中sys.path中添加的大多数时

2012-08-24 17:20:11 1703

转载 python模块之hashlib

http://hi.baidu.com/python23/home   hashlib是个专门提供hash算法的库,现在里面包括md5, sha1, sha224, sha256, sha384, sha512,使用非常简单、方便。    md5经常用来做用户密码的存储。而sha1则经常用作数字签名。下面看看代码吧:#-*- encoding:gb2312 -*-impor

2012-08-24 17:18:53 572

原创 aix下备份记录查询

#listvgbackup -B 将卷组备份日志打印到 stdout。 该标志会概略地显示过去的 256 个备份。日志的格式为 alog,保存在/var/adm/ras/vgbackuplog。日志的每一行都显示一个以分号隔开的列表,包含文件或设备名、用于创建备份的命令、日期、收缩大小、备份的总大小以及推荐的维护或技术级别(如果有的话)。

2012-08-24 10:42:49 757

转载 AIX系统谨慎使用reboot命令

在客户一次停机维护中,发现了这个问题。环境是ORACLE 10G RAC for AIX6,使用了HACMP管理共享磁盘。在停机维护时间段内需要重启主机,当关闭了数据库和CLUSTER后,节点1使用reboot命令重启操作系统,等了很长时间,系统仍然没有启动的迹象,不得以到机房中检查,发现服务器处于关机状态。手工启动服务器后,发现HACMP启动报错,原因是/etc/

2012-08-22 18:31:48 5528

转载 python调用Shell脚本:os.system(cmd)或os.popen(cmd)

python调用Shell脚本,有两种方法:os.system(cmd)或os.popen(cmd),前者返回值是脚本的退出状态码,后者的返回值是脚本执行过程中的输出内容。实际使用时视需求情况而选择。现假定有一个shell脚本test.sh:#!/bin/bash1. echo "hello world!"2. exit 3os.system(cmd):该方法在调用完she

2012-08-22 17:27:01 732

转载 python 如何调用带参数的shell脚本

举例:shell的脚本:t.sh内容:echo "this is a test shell with arguments"echo "arg1 = $1; arg2 = $2;"执行脚本./t.sh zhao结果如下:[noncode@gnode108 knockdown_workflow]$ ./t.sh zhao1 zhao2th

2012-08-22 17:18:57 11953

转载 Python脚本转可执行程序 cx_Freeze

cx_Freeze 是一组脚本和模块用来将 Python 脚本封装成可执行程序,类似 py2exe 和 py2app 。不同的是,cx_Freeze 是跨平台的,要求 Python 2.3 或更新版本。 官方网站:http://www.open-open.com/lib/view/home/1325859234734

2012-08-22 16:15:14 1012

转载 用Python编写脚本进行软件自动安装配置

测试机器:10.10.33.119;os:redhat linux4测试路径:/home/sonky 【脚本1】:使用exec*()系列函数,在python里面,os.exec*()系列命令会完全代替python解释器,如果执行os.exec*()函数,则python解释器和脚本将在os.exec*()执行之后终止。如果如果想继续执行,必须使用os.fork()函数

2012-08-22 16:13:43 6596

转载 强大的Python Shell:IPython

http://www.keakon.net/2009/12/07/%E5%BC%BA%E5%A4%A7%E7%9A%84PythonShell%EF%BC%9AIPython以前一直使用Python自带的交互式Shell,感觉也还够用,至少比Ruby好;不过今天用了下IPython,发现它实在太强了,支持彩色高亮显示、代码补完、魔术函数、宏、编辑和保存文件、调用操作系统的Shell命令等功能。

2012-08-22 15:34:56 2836

转载 拿ipython当shell用

http://guyingbo.iteye.com/blog/111141  ipython 不光可以执行 shell 命令,还可以把 shell 和 python 脚本混用。我当前目录下有 1.Wma 到 80.Wma 需要重命名为小写的 1.wma 到 80.wma,可以这么做:files = !lsfor f in files: !mv $f $f.lower

2012-08-22 15:21:07 1026

转载 python核心编程--笔记

解释器options:1.1 –d   提供调试输出1.2 –O   生成优化的字节码(生成.pyo文件)1.3 –S   不导入site模块以在启动时查找python路径1.4 –v   冗余输出(导入语句详细追踪)1.5 –m mod 将一个模块以脚本形式运行1.6 –Q opt 除法选项(参阅文档)1.7 –c cmd 运行以命令行字符串心事提交的python脚本

2012-08-22 13:07:47 3595

转载 python与shell的完美结合

有时候在python中使用一些shell的功能,其实是非常有必要的。以前自己只知道os.path/stat/glob/shutil等模块,今天发现还有一个模块:commands,用起来非常方面。举例如下:$ python>>> import commands>>> s=commands.getoutput("ps -ef").split('\n')>>> for i in s:

2012-08-22 12:33:28 2584

原创 ipython0.12.1+python3.2.2在linux/aix下的安装

软件:ipython-0.12.1.tar.gzPython-3.2.2.tar.bz2distribute-0.6.26.tar.gzzlib-1.2.7.tar.bz21.  安装zlib-1.2.7.tar.bz22.  安装Python-3.2.2.tar.bz2   a. tar  -zxvf  Python-3.2.2.tar.bz2    b. .

2012-08-21 17:48:42 1554

转载 Python 2.6 和 Python 3 的主要区别有哪些?

>  1. print不再是语句,而是函数,比如原来是 print 'abc' 现在是 print('abc')但是 python2.6+ 可以使用 from __future__ import print_function 来实现相同功能>  2. 在Python 3中,没有旧式类,只有新式类,也就是说不用再像这样 class Foobar(object): pass 显式地子类化obj

2012-08-20 21:52:10 1720

转载 利用pypthon得到IP和MAC地址

转自 http://world77.blog.51cto.com/414605/573091最近在学python,现在假设需要知道这台机器的ip和MAC地址,这个需求用shell和perl很简单就能得到,我这里使用python来实现这个功能,功能比较简单,老鸟可以闪过,下面贴出过程代码login as: rootroot@172.28.19.98's password:

2012-08-20 21:37:50 544

网络工程师考前冲刺100题

作 者:朱小平 著 出版社:中国水利水电出版社 ISBN:9787517007067出版时间:2013-03-01页数:301包装:平装开本:16开字数:

2014-04-04

Introduction to Python Programming and Developing GUI Applications with PyQT

"Introduction to Python Programming and Developing GUI Applications with PyQT 1E" teaches Python programming step-by-step through practical examples that readers can see in action right away. It begins with a solid introduction of Python from scratch, covering loops, control structures, sequences, functions, classes, and exception handling. Thereafter, the book explores file handling and GUI application development in PyQT, the powerful cross-platform GUI layout and forms builder that allows programmers to rapidly design and build widgets and dialogs. The book finishes with an introduction to Django, an easy-to-use platform for developing web applications in Python. This is a great book for newbie programmers interested in learning Python.

2012-09-15

Rapid GUI Programming with Python and Qt

The Insider's Best-Practice Guide to Rapid PyQt 4 GUI Development Whether you're building GUI prototypes or full-fledged cross-platform GUI applications with native look-and-feel, PyQt 4 is your fastest, easiest, most powerful solution. Qt expert Mark Summerfield has written the definitive best-practice guide to PyQt 4 development. With Rapid GUI Programming with Python and Qt you'll learn how to build efficient GUI applications that run on all major operating systems, including Windows, Mac OS X, Linux, and many versions of Unix, using the same source code for all of them. Summerfield systematically introduces every core GUI development technique: from dialogs and windows to data handling; from events to printing; and more. Through the book's realistic examples you'll discover a completely new PyQt 4-based programming approach, as well as coverage of many new topics, from PyQt 4's rich text engine to advanced model/view and graphics/view programming. Every key concept is illuminated with realistic, downloadable examples—all tested on Windows, Mac OS X, and Linux with Python 2.5, Qt 4.2, and PyQt 4.2, and on Windows and Linux with Qt 4.3 and PyQt 4.3.

2012-09-14

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除