06 2013 档案
nagios
摘要:http://www.linuxidc.com/Linux/2012-11/74573p2.htm 阅读全文
posted @ 2013-06-28 17:12 语辰 阅读(138) 评论(0) 推荐(0)
yum install perl-ExtUtils-MakeMaker
摘要:Can'tlocateExtUtils/MakeMaker.pmin@INC(@INCcontains:/usr/local/lib/perl5/usr/local/share/perl5/usr/lib/perl5/vendor_perl/usr/share/perl5/vendor_perl/usr/lib/perl5/usr/share/perl5.)atMakefile.PLline2.BEGINfailed--compilationabortedatMakefile.PLline2.解决办法:yum install perl-ExtUtils-MakeMaker 阅读全文
posted @ 2013-06-28 11:21 语辰 阅读(2986) 评论(0) 推荐(1)
CentOS中无法使用setup命令 -bash:setup: command not found
摘要:安装的时候最小话安装的,想用setup配置网络的时候发现,提示-bash:setup: command not found解决办法:从光盘上拷贝setuptool包,然后安装。 阅读全文
posted @ 2013-06-28 10:21 语辰 阅读(316) 评论(0) 推荐(0)
0627
摘要:http://freeze.blog.51cto.com/1846439/386828http://blog.csdn.net/ludi7125/article/details/7873726 阅读全文
posted @ 2013-06-27 17:58 语辰 阅读(131) 评论(0) 推荐(0)
安装mysql时 make 时 提示 redeclaration of C++ built-in type ‘bool’ 错误
摘要:安装mysql时 make 时 提示 redeclaration of C++ built-in type ‘bool’ 错误由于gcc-c++是在./configure后进行编译的重新./configure ,在make && make install 阅读全文
posted @ 2013-06-27 17:02 语辰 阅读(764) 评论(0) 推荐(0)
../depcomp: line 571: exec: g++: not found
摘要:yum -y install gcc-c++ 阅读全文
posted @ 2013-06-27 16:56 语辰 阅读(370) 评论(0) 推荐(0)
checking for gcc... no
摘要:./configure 后显示checking for gcc... nochecking for cc... nochecking for cl.exe... noconfigure.sh:error:no acceptable C compiler found in $PATHSee 'config.log' for more details.解决办法:yum -y install gcc 阅读全文
posted @ 2013-06-27 16:54 语辰 阅读(8085) 评论(0) 推荐(0)
No curses/termcap library found
摘要:./configure后,:checking for termcap functions library... configure: error: No curses/termcap library found原因:缺少ncurses安装包解决办法:yum -y install ncurses-devel 阅读全文
posted @ 2013-06-27 16:53 语辰 阅读(247) 评论(0) 推荐(0)
for
摘要:>>> import os>>> for a in ('c','b'):... os.path.join('m',a)...'m/c''m/b' 阅读全文
posted @ 2013-06-26 10:43 语辰 阅读(144) 评论(0) 推荐(0)
shutil.rmtree
摘要:>>> help(shutil.rmtree)Help on function rmtree in module shutil:rmtree(path, ignore_errors=False, onerror=None) Recursively delete a directory tree. If ignore_errors is set, errors are ignored; otherwise, if onerror is set, it is called to handle the error with arguments (func, path, exc_in 阅读全文
posted @ 2013-06-26 09:57 语辰 阅读(1247) 评论(0) 推荐(0)
python中的get函数
摘要:>>> a={1:'a',2:'b'}>>> print a.get(1)a>>> print a.get(3)None 阅读全文
posted @ 2013-06-25 11:30 语辰 阅读(1248) 评论(0) 推荐(0)
什么意思
摘要:request="$(perl -MURI::Escape -e 'print uri_escape($ARGV[0]);' "$request")" 阅读全文
posted @ 2013-06-25 10:36 语辰 阅读(198) 评论(0) 推荐(0)
grep的几个参数
摘要:-a 在二进制问就爱你中,以文本方式进行搜索-c 计算找到搜索字符串的次数-i 忽略大小写-n 输出行号-v 反向选择,即没有显示搜索字符串内容的那一行grep -n '\.$' filename 查找结尾为小数点的行. 绝对匹配,一对一,比如g..d =>good* 表示重复0个或多个前面的RE字符,o*表示拥有空字符或者一个o以上的字符grep -n 'o\{2\}' filename #两个o的字符grep -n 'o\{2,5\}' #2个到5个ogrep -n 'go+d' filename o+表示一个或者一个以 阅读全文
posted @ 2013-06-24 17:30 语辰 阅读(929) 评论(0) 推荐(0)
fsck和badlocks
摘要:fsck可以检查好几种不同的文件系统,fsck只是一个中和程序而已,个别的文件系统检查程序都在/sbin中,可以使用ls -l /sbin/fsck*-A 按照/etc/fstab的内容,将所有的设备都扫描一次(通常启动过程就会执行此命令)-a 自动修复检查到的有问题的区-r 一定要让用户决定是否需要修复-y 与-a类似-C 可以在检测的过程中,使用一个长条图来显示当前的进度-f 强制检查例子:fsck -C -t ext3 /dev/hdb5########################################badlocks #检查硬盘或者软盘是否有坏轨的命令-s 在屏幕上列出. 阅读全文
posted @ 2013-06-24 17:15 语辰 阅读(324) 评论(0) 推荐(0)
磁盘格式化mke2fs
摘要:-b 设置每个块的大小,当前支持1024,2048,40963种字节-i 给一个inode多少容量-c 检查磁盘错误,仅执行一次-c时候,会进行快速读取测试;-c -c会测试读写,会很慢-L 后面可以接卷标,这个卷标是有用的-j 本来是mke2fs是ext2,加上-j后,会主动加入日志而成为ext3 阅读全文
posted @ 2013-06-24 17:06 语辰 阅读(197) 评论(0) 推荐(0)
为添加的新硬盘进行分区
摘要:fdisk /dev/hda 阅读全文
posted @ 2013-06-24 16:58 语辰 阅读(186) 评论(0) 推荐(0)
链接文件
摘要:ln [-sf] 原文件 目标文件如果ln不加任何参数就进行链接,那么就是硬链接,-s是符号链接-f 如果目标文件存在,就主动将目标文件直接删除后在建立 阅读全文
posted @ 2013-06-24 16:56 语辰 阅读(147) 评论(0) 推荐(0)
df
摘要:参数:-a 列出所有的文件系统,包括系统特有的/proc等文件系统-k 以kb为单位显示各文件系统-m 以m为单位显示各文件系统-h-H 以m=1000k取代m=1024k的计算方式-T 连同该分区的文件系统名称一起列出-i 不用硬盘容量,而以inode的数量来显示 阅读全文
posted @ 2013-06-24 16:42 语辰 阅读(214) 评论(0) 推荐(0)
查看启用的文件系统有
摘要:cat /proc/filesystems 阅读全文
posted @ 2013-06-24 16:37 语辰 阅读(130) 评论(0) 推荐(0)
查看linux支持的文件系统有哪些
摘要:ls -l /lib/modules/`uname -a`/kernel/fs 阅读全文
posted @ 2013-06-24 16:35 语辰 阅读(725) 评论(0) 推荐(0)
find
摘要:find /etc -newer /etc/passwd 在/etc下面的文件,如果文件日期比/etc/passwd新就列出来find / -nouser 查看系统中不属于任何人的文件,找得到的话也不用太紧张,源码编译软件时会产生的 阅读全文
posted @ 2013-06-24 16:28 语辰 阅读(140) 评论(0) 推荐(0)
whereis参数
摘要:-b 只找二进制文件-m 只找在帮助文件manual路径下的文件-s 只找原文件-u 没有帮助文件的文件whereis passwd 阅读全文
posted @ 2013-06-24 15:59 语辰 阅读(168) 评论(0) 推荐(0)
setuid
摘要:-r-s--x--x #s就是setuid,仅可用在二进制文件,对目录设置无效 阅读全文
posted @ 2013-06-24 15:56 语辰 阅读(169) 评论(0) 推荐(0)
lsattr
摘要:-a 将隐藏文件的属性也显示出来-R 连同子目录的数据也一并列出来chattr +aij 文件名 阅读全文
posted @ 2013-06-24 15:50 语辰 阅读(164) 评论(0) 推荐(0)
设置umask
摘要:umask 002例子:umask为003,建立的文件与目录权限是什么?umask为003,所有去掉的属性为-------wx,因此文件 -rw-rw-r--目录 drwxrwxr-- 阅读全文
posted @ 2013-06-24 15:48 语辰 阅读(203) 评论(0) 推荐(0)
touch
摘要:-a 仅修改access time-c 仅修改时间,而不建立文件-d 后面可以接日期-m 修改mtime-t 接时间例如:touch -d "2 days ago " test 阅读全文
posted @ 2013-06-24 15:45 语辰 阅读(147) 评论(0) 推荐(0)
od
摘要:od -t :参数参数a 使用默认的字符输出c 使用ascii输出d 使用十进制f 使用浮点数值输出o 使用八进制x 使用十六进制 阅读全文
posted @ 2013-06-24 15:42 语辰 阅读(266) 评论(0) 推荐(0)
vi 搜索
摘要:/ 向下搜索? 向上搜索n 重复前一个搜索N 反向重复前一个搜索 阅读全文
posted @ 2013-06-24 15:39 语辰 阅读(153) 评论(0) 推荐(0)
nl
摘要:-b -b -a 表示不论是否为空行,也同样列出行号 -b -t 如果用空行,空行不要列出行号 -n 列出行号表示方法,主要有3中-n -n ln 行号显示在屏幕的最左方显示-n rn 行号显示在屏幕的最右方显示,且不加0-n rz 显示在字段的最右方显示,且加0 阅读全文
posted @ 2013-06-24 15:38 语辰 阅读(459) 评论(0) 推荐(0)
cat 参数
摘要:-A 相当于-vET的整合参数-E 将结尾的换行符$显示出来-n 显示行号-T 将tab键以^T显示出来-v 列出一些看不出来的特殊字符 阅读全文
posted @ 2013-06-24 15:34 语辰 阅读(432) 评论(0) 推荐(0)
rm和mv和dirname和查看文件的命令
摘要:rm-f-i-r############################mv-f-i-u 比较新旧###########################basename 获取文件名dirname 获取目录名###########################tac 从最后一行开始显示nl 显示的时候,输出行号od 以二进制的方式读取文件内容 阅读全文
posted @ 2013-06-24 15:25 语辰 阅读(184) 评论(0) 推荐(0)
cp参数详解
摘要:-a 相当于pdr的意思-d 若原文件为连接文件,则复制链接文件属性,而非文件本身-f 强制复制,有重复时,不询问用户,而直接强制复制-i 目标文件存在的话,先询问-p 与文件的属性一起复制-r 递归持续复制-s 复制成符号链接文件-u 若目标文件比原文件旧,更新目标文件 阅读全文
posted @ 2013-06-24 15:20 语辰 阅读(1281) 评论(0) 推荐(0)
ls参数
摘要:-a 全部文件-A 与a差不多,但是不包括.和..开头的两个目录-d 仅列出目录-f 直接列出结果,不进行排序-h 列出文件大小-i 列出inode的位置,而非列出文件属性-l 列出长数据串,包含文件的属性-r 将结果反向输出-R 与子目录内容一起列出来-S 按文件大小排序-t 按时间排序--color=never 不要按照文件属性用不同的颜色显示--color=always 显示颜色--color=auto 让系统自行按照设置来判断是否使用颜色--full-time 以完整的时间模式输出--time={atime,ctime} 输出访问时间或改变权限属性时间 阅读全文
posted @ 2013-06-24 15:13 语辰 阅读(207) 评论(0) 推荐(0)
在PATH路径中添加新的路径
摘要:PATH="$PATH":/root 阅读全文
posted @ 2013-06-24 15:04 语辰 阅读(352) 评论(0) 推荐(0)
目录相关的操作
摘要:. 此层目录..上一层目录- 前一个工作目录~ 当前用户身份所在的家目录~account 表示account用户的家目录pwd -P 显示出实际路径,而非使用链接的路径mkdir -m 755 test #强制设置属性,建立目录的时候rmdir -p #若上层为空目录,一定删除上层空目录 阅读全文
posted @ 2013-06-24 14:57 语辰 阅读(122) 评论(0) 推荐(0)
chmod
摘要:chmod u=rwx,go=rx .bashrc对一个目录,即便你有read的权限,但是没有x权限,也无法进入目录。即便我是一个普通用户,用户root的文件在我是属主的目录下,我也一样可以删除。 阅读全文
posted @ 2013-06-24 14:50 语辰 阅读(140) 评论(0) 推荐(0)
属性类型
摘要:d 目录- 文件l 表示链接文件b 表示设备文件中可供存储的接口设备c 表示设备文件中的串行端口设备,如键盘,鼠标 阅读全文
posted @ 2013-06-24 14:44 语辰 阅读(152) 评论(0) 推荐(0)
ls -al
摘要:-rw-r--r-- 1 root root 5967 jun 24 12:23 test属性 连接 拥有者 用户组 文件大小 修改日期 文件名 阅读全文
posted @ 2013-06-24 14:42 语辰 阅读(180) 评论(0) 推荐(0)
tar.gz
摘要:tar.gz,或者.tgz的文件一般是在UNIX下用tar和gunzip压缩的文件。可能的文件名还有.tar.gz等。gunzip是一种比pkzip压缩比高的压缩程序,一般 UNIX下都有。tar是一个多文件目录打包器,一般也是在unix下。在UNIX下展开.tar.gz文件用tar zxvf filename.tar.gz就可以了或者用gunzip -d filename.tar.gz得到filename.tar 然后用tar xvf filename.tar解包,两步完成。在PC环境下解tgz,可以用winzip 6.2以上版本,可以直接打开extract。 建议在win95或者NT下使用 阅读全文
posted @ 2013-06-24 11:50 语辰 阅读(602) 评论(0) 推荐(0)
201306第三周笔记
摘要:enable#进入特权模式?#查看可执行的命令conf t 全局配置模式hostname R1 #为路由器命令,此例名字为R1no ip domain-lookup#取消域名解析ipclassless#支持无编号ip的地址ip subnet-zero#支持零子网interface serial 1/2#配置串行第一个模块的第二个接口ip address 172.16.79.25 255.255.255.0#配置ip地址no shutdown #激活接口exitendsshow interfaceshow ip interface briefcolor fdservice network re. 阅读全文
posted @ 2013-06-24 09:21 语辰 阅读(143) 评论(0) 推荐(0)
http://www.kernelchina.org/node/1055
摘要:http://www.kernelchina.org/node/1055 阅读全文
posted @ 2013-06-23 14:22 语辰 阅读(159) 评论(0) 推荐(0)
egrep
摘要:egrep '(成绩|准考证)' 阅读全文
posted @ 2013-06-23 11:26 语辰 阅读(147) 评论(0) 推荐(0)
更改shell
摘要:chsh -s /usr/local/bin/bash #更改自己的shell为bash 阅读全文
posted @ 2013-06-23 11:25 语辰 阅读(166) 评论(0) 推荐(0)
mount_cd9660:/dev/acd0: Input/output error
摘要:mount -t cd9660 /dev/acd0 /cdromg_vfs_done():acd0[READ(offset32768, length=204]error =5mount_cd9660:/dev/acd0:Input/output error修改/etc/fstab表,noauto去掉,ro改成rw,或许不改也是可以的。 阅读全文
posted @ 2013-06-21 18:36 语辰 阅读(344) 评论(0) 推荐(0)
fstab及时生效的办法
摘要:mount -a 阅读全文
posted @ 2013-06-21 18:34 语辰 阅读(2070) 评论(0) 推荐(0)
linux_base-f10-10_7 linuxulator is not (kld)loaded
摘要:# cd linux_base-f10/# make install clean===> linux_base-f10-10_7 linuxulator is not (kld)loaded.*** Error code 1解决办法:kldload linux 再重新执行makeinstall clean命令即可。 阅读全文
posted @ 2013-06-21 18:32 语辰 阅读(494) 评论(0) 推荐(0)
python-mysql软件下载地址
摘要:http://sourceforge.net/projects/mysql-python/?source=dlp 阅读全文
posted @ 2013-06-21 18:07 语辰 阅读(173) 评论(0) 推荐(0)
freebsd安装ports
摘要:/etc/portsnap.conf 里面更改 SERVERNAME=portsnap.hshh.org portsnap的命令比较少 fetch 获取数据 extract 释放全部ports update 更新ports 第一次使用可以 portsnap fetch extract 以后使用可以 portsnap fetch update 如果写在cron可以用 portsnap cron update***************************************************http://gentoolinux.blogbus.com/logs/40504926. 阅读全文
posted @ 2013-06-21 18:04 语辰 阅读(1401) 评论(0) 推荐(0)
freebsd自动获取ip地址
摘要:最小化安装完成freebsd后,ifconfig查看不到ip地址修改/etc/rc.conf添加ifconfig_网卡名称="DHCP"重启服务器或者sh /etc/rc.conf 阅读全文
posted @ 2013-06-21 16:48 语辰 阅读(503) 评论(0) 推荐(0)
hasattr
摘要:python hasattr():判断一个对象是否含有某种属性>>> help(hasattr) Help on built-in function hasattr in module __builtin__: hasattr(...) hasattr(object, name) -> bool Return whether the object has an attribute with the given name. (This is done by calling getattr(object, name) and catching exceptions.) &g 阅读全文
posted @ 2013-06-21 10:55 语辰 阅读(389) 评论(0) 推荐(0)
crontab命令格式
摘要:* * * * * command分 时 日 月 周 命令 阅读全文
posted @ 2013-06-21 10:15 语辰 阅读(180) 评论(0) 推荐(0)
shell中的-z
摘要:-z 字符串为"null",即是指字符串长度为零。 阅读全文
posted @ 2013-06-21 10:10 语辰 阅读(6491) 评论(0) 推荐(0)
awk累加
摘要:{a+=substr($14,1,1)}END{a=(a=="")?0:a;print a}'对a进行累加,如果最后a=0的话,结果为0,否则为a,最后输出a 阅读全文
posted @ 2013-06-21 10:03 语辰 阅读(368) 评论(0) 推荐(0)
NF!=1
摘要:NF表示列数,不等于1表示列数不为1列 阅读全文
posted @ 2013-06-21 10:00 语辰 阅读(130) 评论(0) 推荐(0)
设置office首字母不变大小的手段
摘要:选项->校对—〉自动更正选项->“自动更正”页,句首字母大写,取消就行了 阅读全文
posted @ 2013-06-20 16:54 语辰 阅读(193) 评论(0) 推荐(0)
This account is currently not available
摘要:摘自:http://ninglianjie.blog.51cto.com/777346/426361安装nagios,启动的时候报[root@bzrWeb1 etc]# service nagios startStarting nagios:This account is currently not available.done.修改/etc/passwd将/sbin/nologin改成/bin/bash 阅读全文
posted @ 2013-06-19 16:14 语辰 阅读(343) 评论(0) 推荐(0)
nagios的安装配置
摘要:主要参考博客:http://www.cnblogs.com/mchina/archive/2013/02/20/2883404.html实验环境:centos6.4 最小化安装系统*****************************************************************1 基础支持套件:gcc glibc glibc-common gd gd-devel xinetd openssl-devel[root@localhost ~]# rpm -q gcc glibc glibc-common gd gd-devel xinetd openssl-deve 阅读全文
posted @ 2013-06-19 15:52 语辰 阅读(2004) 评论(0) 推荐(1)
apache安装报错
摘要:libtool: install: error: cannot install `libaprutil-1.la' to a directory not ending /some_directoryapparently ./config --prefix=/mydir didn't get set correctly the first time. Rerunning a failed apache make can be troublesome. You need to first do a make clean, and then retry with the correc 阅读全文
posted @ 2013-06-19 14:47 语辰 阅读(230) 评论(0) 推荐(0)
.configure
摘要:./configure 配置环境make是编译的意思。就是把源码包编译成二进制可执行文件make install 就是安装的意思 阅读全文
posted @ 2013-06-19 11:50 语辰 阅读(228) 评论(0) 推荐(0)
nagios 日本
摘要:http://d.hatena.ne.jp/think-t/20111217 阅读全文
posted @ 2013-06-19 11:40 语辰 阅读(118) 评论(0) 推荐(0)
最小化安装centos后ifconfig看不到eth0
摘要:最小换安装centos后,ifconfig看不到eth0,只看到一个loifupeth0 阅读全文
posted @ 2013-06-19 11:15 语辰 阅读(163) 评论(0) 推荐(0)
nagios
摘要:http://www.cnblogs.com/mchina/archive/2013/02/20/2883404.html 阅读全文
posted @ 2013-06-19 10:37 语辰 阅读(107) 评论(0) 推荐(0)
python中的uuid4
摘要:Help on function uuid4 in module uuid:uuid4() Generate a random UUID. 阅读全文
posted @ 2013-06-18 15:23 语辰 阅读(1139) 评论(0) 推荐(0)
python中的random
摘要:random.randint(a,b) 用于生成一个指定范围内的整数,a为下限,b为上限,生成的随机整数a<=n<=b;若a=b,则n=a;若a>b,报错import randomrandom.randint(10,20)#输入18random.randint(10,10)#输出10random.randint(20,10) #error*****************************************************random.randrange([start], stop [,step]) 从指定范围内,按指定基数递增的集合中获取一个随机数,基数 阅读全文
posted @ 2013-06-18 14:24 语辰 阅读(310) 评论(0) 推荐(0)
vs2012密钥
摘要:RBCXF-CVBGR-382MK-DFHJ4-C69G8 阅读全文
posted @ 2013-06-17 16:52 语辰 阅读(391) 评论(0) 推荐(0)
getuser
摘要:Help on function getuser in module getpass:getuser() Get the username from the environment or password database. First try various environment variables, then the password database. This works on Windows as long as USERNAME is set. 阅读全文
posted @ 2013-06-17 16:29 语辰 阅读(219) 评论(0) 推荐(0)
python中__file__
摘要:用__file__ 来获得脚本所在的路径,比如文件在/root下cat tee#!/usr/bin/env pythonprint __file__ #得到相对路径tee——————————————————————————————————————import os#!/usr/bin/env pythonprint os.path.realpath(__file__) #得到绝对路径/root/tee 阅读全文
posted @ 2013-06-17 16:01 语辰 阅读(796) 评论(0) 推荐(0)
python中的getcwd
摘要:Help on built-in function getcwd in module posix:getcwd(...) getcwd() -> path Return a string representing the current working directory. 阅读全文
posted @ 2013-06-17 15:45 语辰 阅读(473) 评论(0) 推荐(0)
apache中的allow和deny
摘要:http://www.fwolf.com/blog/post/191 阅读全文
posted @ 2013-06-13 16:59 语辰 阅读(75) 评论(0) 推荐(0)
wsgi
摘要:http://modwsgi.readthedocs.org/en/latest/configuration-directives/WSGIScriptAlias.html 阅读全文
posted @ 2013-06-13 16:52 语辰 阅读(118) 评论(0) 推荐(0)
shell脚本中的$*,$@和$#
摘要:#!/bin/bash my_fun() { echo "$#" } echo 'the number of parameter in "$@" is '$(my_fun "$@") echo 'the number of parameter in "$*" is '$(my_fun "$*")执行:./my.sh p1 "p2 p3" p4后返回:the number of parameter in "$@" is 3th 阅读全文
posted @ 2013-06-13 16:28 语辰 阅读(540) 评论(0) 推荐(0)
splitlines
摘要:>>> a = "hello\nhow are you\ni am fine">>> print ahellohow are youi am fine>>> b = a.splitlines()>>> print b['hello', 'how are you', ' i am fine'] 阅读全文
posted @ 2013-06-13 14:30 语辰 阅读(135) 评论(0) 推荐(0)
win2003的密钥
摘要:FFK3M-T96TB-C4HW9-GQKRJ-HV67M 阅读全文
posted @ 2013-06-10 14:53 语辰 阅读(829) 评论(0) 推荐(0)
防火墙
摘要:iptables提供了全面的协议状态跟踪,数据包的应用层检查,速率限制和一个功能强大的机制以指定过滤策略。iptables策略是由一组有序的规则建立的,它告诉内核应该如何处理某些类别的数据包,每一个iptables规则应用于一个表中的一个链,一个iptables链是一个规则集表示iptables构建块,它描述了其功能的大类,如包过滤或网络地址转换。iptables共有四个表,filter,nat,mangle和raw,过滤规则应用于filter表,nat规则应用于nat表,用于修改分组数据的特定规则应用于mangle表,而独立于netfilter链接跟踪子系统起作用的规则应用于raw表。acc 阅读全文
posted @ 2013-06-09 18:03 语辰 阅读(142) 评论(0) 推荐(0)
url
摘要:http://p0tt1.sniffer.pro/ 阅读全文
posted @ 2013-06-08 16:26 语辰 阅读(90) 评论(0) 推荐(0)
python中if __name__ == '__main__'
摘要:当你看到一个py文件,经常会在代码的最下面看到if __name__ == '__main__'模块是对象,并且所有的模块都一个内置属性__name__,一个模块的__name__的值取决于您如何应用模块,如果import一个模块,那么模块__name__的值通常为模块文件名,不带路径或者文件扩展名,但是,您也可以像一个标准的程序那样直接运行程序,在这种情况下,__name__的值将是一个特别缺省"__main__" 阅读全文
posted @ 2013-06-08 14:55 语辰 阅读(155) 评论(0) 推荐(0)
python中的unlink
摘要:unlink(...) unlink(path) Remove a file (same as remove(path)). 阅读全文
posted @ 2013-06-08 14:04 语辰 阅读(487) 评论(0) 推荐(0)
rename函数
摘要:Help on built-in function rename in module posix:rename(...) rename(old, new) 阅读全文
posted @ 2013-06-08 14:02 语辰 阅读(209) 评论(0) 推荐(0)
python中的os.stat
摘要:Help on built-in function stat in module posix:stat(...) stat(path) -> stat result Perform a stat system call on the given path.>>> import os>>> from app import settings>>> os.stat(settings['d_path'])posix.stat_result(st_mode=16877, st_ino=38177794, st_dev=128L, 阅读全文
posted @ 2013-06-08 11:14 语辰 阅读(335) 评论(0) 推荐(0)
python中的mysql
摘要:import MySQLdbfrom app import settingsconn = MySQLdb.connect(host=settings.DATABASE_HOST, user=settings.DATABASE_USER,passwd=settings.DATABASE_PASSWORD, db=settings.DATABASE_NAME, charset='utf8')d_command ='DELETE FROM news WHERE created_at <= DATE_SUB(NOW(), INTERVAL 7 DAY);'curs 阅读全文
posted @ 2013-06-08 11:09 语辰 阅读(122) 评论(0) 推荐(0)
if
摘要:#!/bin/shhn=`ps axu| grep httpd|wc -l`if [ $hn -gt 1 ];then #gt (great then) = 大于 mn=`ps axu| grep 'mysql'| grep -v 'grep' | wc -l` if [ $mn -lt 1 ];then #lt(less then) = echo "`hostname -s`" echo 'mysql service stop' fifi实例2mn =... 阅读全文
posted @ 2013-06-08 10:53 语辰 阅读(145) 评论(0) 推荐(0)
网址
摘要:http://www.maxmind.com/en/geolocation_landing 阅读全文
posted @ 2013-06-08 10:05 语辰 阅读(107) 评论(0) 推荐(0)
grep中的-q
摘要:-q, --quiet, --silent Quiet; do not write anything to standard output. Exit immediately with zero status if any match is found, even if an error was detected. Also see the -s or --no-messages option. (-q is specified by POSIX.) 阅读全文
posted @ 2013-06-07 11:25 语辰 阅读(407) 评论(0) 推荐(0)
php的date
摘要:将服务器的时间格式化语法:string date(string format, int [timestamp]);返回值:字符串函数种类:时间日期返回值的字符串依配置的格式来决定。若有传入时间戳记值,则将时间戳记格式化返回;若无传入时间戳记值,则将目前服务器的时间格式化返回。要将日期转为其它的语系格式,应使用setlocale()及strftime()二个函数。字符串格式化的选项如下:http://php.freehostingguru.com/function.php-date.php 阅读全文
posted @ 2013-06-07 10:39 语辰 阅读(185) 评论(0) 推荐(0)
python 查看今天日期
摘要:>>> datetime.date.today()datetime.date(2013, 6, 6) 阅读全文
posted @ 2013-06-06 15:22 语辰 阅读(449) 评论(0) 推荐(0)
python中的datetime.timedelta
摘要:当有人问你昨天是几号,是不是很容易就得到答案但当问你100天前是几号,你是不是又能很容易地得出答案?用程序来实现一下吧,datetime的timedeltime就派上用场了import datetime(datetime.datetime.now() - datetime.timedelta(days = 100)).strftime("%Y-%m-%d")>>> import datetime>>> help(datetime.timedelta)>>>>>> datetime.datetime.no 阅读全文
posted @ 2013-06-06 15:18 语辰 阅读(500) 评论(0) 推荐(0)
python中的utime
摘要:utime(...) utime(path, (atime, mtime)) utime(path, None) Set the access and modified time of the file to the given values. If the second form is used, set the access and modified times to the current time. 阅读全文
posted @ 2013-06-06 11:59 语辰 阅读(483) 评论(0) 推荐(0)
cPickle.dump函数
摘要:Help on built-in function dump in module cPickle:dump(...) dump(obj, file, protocol=0) -- Write an object in pickle format to the given file. See the Pickler docstring for the meaning of optional argument proto. 阅读全文
posted @ 2013-06-06 10:36 语辰 阅读(1181) 评论(0) 推荐(0)
mysql -B选项
摘要:o --batch, -B Print results using tab as the column separator, with each row on a new line. With this option, mysql does not use the history file. 阅读全文
posted @ 2013-06-05 16:46 语辰 阅读(409) 评论(0) 推荐(0)
python语句中的-m参数
摘要:-m module-name Searches sys.path for the named module and runs the correspond- ing .py file as a script. 阅读全文
posted @ 2013-06-05 16:41 语辰 阅读(625) 评论(0) 推荐(0)
$?参数
摘要:$0 这个程式的执行名字 $n 这个程式的第n个参数值,n=1..9 $* 这个程式的所有参数 $# 这个程式的参数个数 $$ 这个程式的PID $! 执行上一个背景指令的PID $? 执行上一个指令的返回值 阅读全文
posted @ 2013-06-05 16:37 语辰 阅读(144) 评论(0) 推荐(0)
左补空格和右补空格
摘要:%5d ,左补空格%-5d,右补空格 阅读全文
posted @ 2013-06-05 16:26 语辰 阅读(341) 评论(0) 推荐(0)
python中的setdefault()方法
摘要:setdefault(key[, default])If key is in the dictionary, return its value. If not, insert key with a value of default and return default. default defaults to None.如果键在字典中,返回这个键所对应的值。如果键不在字典中,向字典 中插入这个键,并且以default为这个键的值,并返回 default。default的默认值为None 阅读全文
posted @ 2013-06-05 15:40 语辰 阅读(726) 评论(0) 推荐(0)
python中的os.path.realpath(__file__)
摘要:python中的os.path.realpath(__file__),取的是脚本的完整路径[root@leexl ~]# cat tst.pyimport osRoot = (os.path.realpath(__file__))print Root[root@leexl ~]# python tst.py/root/tst.py 阅读全文
posted @ 2013-06-05 10:21 语辰 阅读(1487) 评论(0) 推荐(0)
第一个c程序
摘要:觉的很郁闷,后来发现是发现把printf敲成了print。 阅读全文
posted @ 2013-06-04 17:32 语辰 阅读(123) 评论(0) 推荐(0)
python中time实例
摘要:>>> time.strftime("%Y%m%d%H%M%S")'20130327133007' 阅读全文
posted @ 2013-06-03 14:55 语辰 阅读(128) 评论(0) 推荐(0)
mysql执行查询的一般过程
摘要:客户端将查询发送到服务器服务器检查查询缓存,如果找到了,就从缓存中返回结果,否则进行下一步服务器解析,预处理和优化查询,生成执行计划查询执行引擎调用存储引擎API执行查询将服务器结果发送回客户端如图:尽管不需要理解mysql客户端服务器协议的内部细节,但是还是需要了解其大致轮廓,这个协议是半双工的。这意味着mysql服务器在某个给定的时间,可以发送或者接收数据,但是不能同时接收和发送。这也意味着没有办法截断消息这种协议让mysql的沟通简单又快捷,但是有限制,其中一个就是无法进行流程控制,一旦一方发送消息,另一方在发送回复之前必须提取完整的消息。客户端用一个数据包将查询发送到服务器,这就是为什 阅读全文
posted @ 2013-06-03 14:51 语辰 阅读(305) 评论(0) 推荐(0)
bsd升级系统
摘要:freebsd-update -r 8.2-RELEASE upgrade 阅读全文
posted @ 2013-06-03 14:45 语辰 阅读(122) 评论(0) 推荐(0)
freebsd帐号操作
摘要:添加用户 pw useradd 用户名删除用户 pw user del 用户名修改用户密码 passwd 用户名更改用户的shell: pw usermod 用户名 -s 新shell名称将用户添加到指定的组: pw groupmod 组名 -m 用户名对账号进行锁定 pw lock 用户名对账号进行解锁 pw unlock 用户名显示用户的属性 pw usershow 用户名 阅读全文
posted @ 2013-06-03 14:44 语辰 阅读(325) 评论(0) 推荐(0)
freebsd安装cmake
摘要:tar zxvf cmake-2.8.5.tar.gzcd cmake-2.8.5./configuremake&&make installrehash 阅读全文
posted @ 2013-06-03 14:42 语辰 阅读(405) 评论(0) 推荐(0)
freebsd让普通用户具有su权限
摘要:新建了用户,su的时候,直接报sorryvi /etc/groupwheel组后面增加希望具有su权限的用户,比如testwheel:*:0:root,test保存文件,再次su就可以了。 阅读全文
posted @ 2013-06-03 14:40 语辰 阅读(393) 评论(0) 推荐(0)
一次小错误
摘要:做测试,估计当时把mv当cp用了,做完实验后,直接把文件删了。然后就连不上测试机了。后来通过登录发现/etc/rc.conf这个文件没有了。于是重新配置ifconfig_rl0="DHCP";然后sh /etc/rc后能获取ip地址了,但是远程还是登录不了。再次修改rc.conf添加sshd_enable="YES",然后/etc/rc.d/sshd restart,可以登录了。 阅读全文
posted @ 2013-06-03 14:39 语辰 阅读(89) 评论(0) 推荐(0)
freebsd中/etc/rc.conf配置文件导致不能启动的问题
摘要:今天修改/etc/rc.conf配置文件,修改的时候不小心弄错了文件,保存重启了。然后系统就启动不起来了,报如下错误:处理步骤:mount -avi /etc/rc.conf修改出错的句子reboot 阅读全文
posted @ 2013-06-03 14:38 语辰 阅读(550) 评论(0) 推荐(0)
freebsd安装mysql
摘要:cd /usr/ports/databases/mysql55-server/mak install cleanvi /etc/rc.conf添加mysql_enable="YES"/usr/local/etc/rc.d/mysql-server start 阅读全文
posted @ 2013-06-03 14:37 语辰 阅读(326) 评论(0) 推荐(0)
ports安装软件
摘要:有的时候,用ports安装软件,会提示这个包已经安装过了,无法继续安装,可用如下命令make install clean FORCE_PKG_REGISTER=yes 阅读全文
posted @ 2013-06-03 14:36 语辰 阅读(152) 评论(0) 推荐(0)
freebsd升级目录树
摘要:第一次使用portsnap fetch extract以后使用只要 portsnap fetch update放在cron里面运行 portsnap cron 阅读全文
posted @ 2013-06-03 14:35 语辰 阅读(131) 评论(0) 推荐(0)
freebsd下配置ip地址
摘要:一,dhcp方式配置ip地址1,vi /etc/rc.confifconfig_rl0(网卡名称)= "DHCP" #网卡名称根据具体情况填写,2,修改过/etc/rc.conf后可以使用3种方式使之生效sh /etc/rc或sh /etc.netstart或重启服务器 阅读全文
posted @ 2013-06-03 14:33 语辰 阅读(248) 评论(0) 推荐(0)
freebsd上安装sudo
摘要:方法一,cd /usr/ports/security/sudomake install clean方法二,pkg_add -r sudo可以使用pkg_info|grep sudo来获取sudo的版本号sudo的配置文件在/usr/local/etc/sudoers里面,sudo的配置文件不应直接编辑,而应该使用visudo来进行修改。下面是配置sudo的方法:qifan ALL=(ALL) ALL #qifan可以使用整个系统的全部权限%admin ALL=(ALL) ALL #指定了admin组的所有用户可以使用全部的权限设置密码在一段时间后自动退出Defaults:qifan times 阅读全文
posted @ 2013-06-03 14:31 语辰 阅读(533) 评论(0) 推荐(0)