06 2013 档案
摘要:import calendar, SimpleXMLRPCServerclass Calendar: def getMonth(self, year, month): return calendar.month(year, month) def getYear(self, year): return calendar.calendar(year)calendar_object = Calendar()server = SimpleXMLRPCServer.SimpleXMLRPCServer(('localhost', 8888))server.regi...
阅读全文
摘要:from twisted.internet import reactorimport timedef printTime(): print "Current time is",time.strftime("%H:%M:%S")def stopReactor(): print "Stopping reactor" print "Current time is",time.strftime("%H:%M:%S") reactor.stop()reactor.callLater(1, printTim
阅读全文
摘要:#coding=utf8import ConfigParserconfig = ConfigParser.ConfigParser()config.readfp(open(raw_input("input file name:"), "rb"))print config.get("global", "ip") config.ini[global]ip = 192.168.1.100 ;ip地址port = 3306password = 123456
阅读全文
摘要:查看threading 有如下表达式_start_new_thread = thread.start_new_thread_allocate_lock = thread.allocate_lock_get_ident = thread.get_identThreadError = thread.errordel thread为什么要del thread,删除这个变量的目的是为什么?脚本运行完后应该会自动将变量清除。这样显式清除有什么特殊目的?如果不显式del会有什么后果?原来是目的是为了避免threading.thread的用法吧,为什么呢???因为有人喜欢dir(threading)然后看到
阅读全文
摘要:thread 对外提供的常用方法有:start_new_thread:创建新线程e.g. 看下面的示例更容易理解thread的线程机制:import timeimport threadfrom time import ctimedef timer(i, interval): while True: print "id:%s, time:%s \n"%(i, ctime()) time.sleep(interval)def test(): for i in range(5): thread.start_new_thread(timer, (i...
阅读全文
摘要:netstat -ant |grep "xxx.xxx.xxx.82" |wc -l
阅读全文
摘要:首先要有localesapt-get install locales接着用dpkg-reconfigure locales 进行配置
阅读全文
摘要:scp localeFile root@192.168.221.133:/usr/src/
阅读全文
摘要:1、新建用户insert into mysql.user(Host,User,Password)values("localhost","leon",password("123456"));2、为某用户授权访问某数据库grant all privileges on test.* to leon@localhost identified by '123456'; #所有权限grant select on test.* to leon@localhost identified by '123456'; #所有
阅读全文
摘要:1、查看表索引 show index from tb_name;2、增加索引 alter table tb_name add index index_name(column_name);3、删除索引 drop index index_name on tb_name;4、增加主键约束alter table tb_name add primary key PK_cid(cid);5、增加唯一约束ALTER TABLE `table_name` ADD UNIQUE (`column`)
阅读全文
摘要:1、创建数据库 create database if not exists db_name;2、指定字符集 create database if not exists db_name character set utf83、创建表、删除表 创建:create table tb_name (id int(4) not null primary key auto_increment, name char(20) not null); 删除:drop table tb_name;4、增加字段 alter table tb_name add column age tinyint(2);5、修改...
阅读全文
摘要:1、显示数据库 show databases;2、显示表 show tables;3、显示表结构 desc table_name;4、选择当前数据库 select database();5、查看表详细信息 show create table tb_name;
阅读全文
摘要:一、ssh1、先安装ssh apt-get install ssh2、可修改ssh链接端口vi /opt/debian/etc/ssh/sshd_config3、加载ssh 服务/etc/init.d/ssh start二、网络配置1、网络配置文件/etc/network/interfaces2、示例:auto lo eth0iface lo inet loopbackiface eth0 inet staticaddress 192.168.2.2netmask 255.255.255.0broadcast 192.168.2.255gateway 192.168.2.13、重启网络/et.
阅读全文
摘要:awk 'BEGIN {print "Hello"}' 不操作文件直接处理数据流要调用shell则可以用管道命令如,打印日期awk 'BEGIN {"date"|getline d; print d}'打印登陆的用户:awk 'BEGIN {while("who"|getline d) print d}'文件执行awkvi新建文件show.awk#!/bin/awkBEGIN{while("who"|getline d) print d}命令行运行 awk -f sh
阅读全文
摘要:awk用法:awk'pattern{action}'awk内置变量ARGC 命令行参数个数ARGV 命令行参数排列ENVIRON 支持队列中系统环境变量的使用FILENAME awk浏览的文件名FNR 浏览文件的记录数FS 设置输入域分隔符,等价于命令行 -F选项NF 浏览记录的域的个数NR 已读的记录数OFS 输出域分隔符ORS 输出记录分...
阅读全文