跳过检证安装Media Player 11

Posted by 曹宇伟 on 七月 31st, 2008

安装过WinRAR的系统,右键点wmp11-windowsxp-x86-zh-cn,有一个“释放到wmp11-windowsxp-x86-zh-cn”的选项,先将Media Player 11解压开来,然后在释放出来的目录里,依次执行以下面四个程序:
1 wmfdist11.exe

2 wmdbexport.exe

3 umdf.exe

4 wmp11.exe

就可以跳过验证,安装使用Media Player 11了。

免费、详尽的DNS检查工具/网站

Posted by 曹宇伟 on 七月 29th, 2008

http://www.checkdns.net

缓存DNS查询,解决DNS查询慢的问题

Posted by 曹宇伟 on 七月 27th, 2008

pdnsd, written by Thomas Moestl, is a proxy DNS server with permanent caching (the cache contents are written to hard disk on exit) that is designed to cope with unreachable or down DNS servers (for example in dial-in networking).
The official pdnsd homepage by the original author can be found at http://home.t-online.de/home/Moestl/, but unfortunately pdnsd is no longer being maintained by him. As far as I know I am presently the only one actively working on the code, so if you want the latest features and fixes, this is the place to get them.

主页:http://www.phys.uu.nl/~rombouts/pdnsd.html

配置起来非常简单:

1. 将example配置文件复制一份

2. 将:

server {
label= “myisp”;
ip = 58.215.76.163

IP换成自己的ISP提供的DNS地址,多个用”,”隔开

3. 最重要的一步,许多DNS不接受”ping”测试,所以要将:

uptest=if/ping 改成

uptest=query

4.  将/etc/resolv.con里的nemeserver改成127.0.0.1

PS:

pdnsd.conf是可以控制pdnsd的返回结果的,就是说,可以通过配置pdnsd来达到自定义解析结果的日的。

另外,我们使用pdnsd的根本原因是因为ISP的DNS不稳定,解析慢。pdnsd可以直接从根服务器查询开始,更不必依赖于ISP的DNS。但是需要说明的是,使用了CDN服务的站点,可以会取到不精确的地址,而导致访问速度不佳。

RouterOS配置备份与恢复

Posted by 曹宇伟 on 七月 27th, 2008

WinBox:

Files->Backup/Restore

终端:

system backup save/load name=ROS-conf-20080727.backup

export/import file=ROS-conf-20080727.conf

健康常识

Posted by 曹宇伟 on 七月 23rd, 2008

夜猫子型的同学注意了!
沉重的话题:
一个毕业后进微软的同志,上月死了,睡一觉就起不来了,医生说是猝死,推测是过劳,只不过25岁的黄金年龄。

晚上9-11点为免疫系统(淋巴)排毒时间,此段时间应安静或听音乐
晚间11-凌晨1点,肝的排毒,需在熟睡中进行。

凌晨1-3点,胆的排毒,亦同。
凌晨3-5点,肺的排毒。此即为何咳嗽的人在这段时间咳得最剧烈,

因排毒动作已走到肺;不应用止咳药,以免抑制废积物的排除。
凌晨5-7点,大肠的排毒,应上厕所排便。

凌晨7-9点,小肠大量吸收营养的时段,应吃早餐。
疗病者最好早吃,在6点半前,养生者在7点半前,

不吃早餐者应改变习惯,即使拖到9、10点吃都比不吃好。
半夜至凌晨4点为脊椎造血时段,必须熟睡,不宜熬夜。

为了大家健康,以后不要熬夜了!

info coreutils date

Posted by 曹宇伟 on 七月 22nd, 2008

info coreutils date

date –date=”-1 minute” +%H:%M

交换机集链,CPU负载变大

Posted by 曹宇伟 on 七月 22nd, 2008

交换机集链,CPU负载变大。

NFO文件名常识

Posted by 曹宇伟 on 七月 21st, 2008
NFO文件名常识:

Incl.Keygen—>包含有注册器
keygen
only—>只含注册器
WinALL—>适用于所有版本Windows操作系统(一般是指95 98 ME 2000 XP
2003)
Trainer—>密技
Cracked—>破解版本(对原文件进行了修改)
MAC
OSX—>Macintosh平台上的软件
NUKED—>发布的内容违犯规则或存在问题因而被取消,别的小组可重新发布。
Ebook—>电子书
Repack
/Proper—>重新打包/正确的(对上一个不成功的破解的修正)
Plug
in—>插件
regged—>已經注册了的軟件
retail—>零售版
READ.NFO—>一般表示有某种特别说明
DIRFIX
nfo—>说明文件修正,一般只有一个nfo文件
BiLiNGUAL—>双语版本
MutilLiNGUAL—>多语言版本
PHP.NULL—>PHP完整脚本程序
ASP.NULL—>ASP完整脚本程序
Incl.Patch—>带有破解补丁
WORKING—>先前已有组织释放,但是不能完整工作,当前的释放是完整工作的。
Licensed—>带有许可文件
FiXED—>重新修正版
Unlocker—>解锁补丁
Cheats—>作弊修改器
ALL.ACCESS.CHEAT—>通关秘籍

电影文件名常识:

PROPER—>
完美版
DUPE—>与别的组织Release有重复
UNRATE—>未删节(好)
R-RATE—>有删节(不好)
WS
—>宽银幕版本的影片
FS—>4:3
全荧幕版本的影片(有些影片DVD中同时有WS和FS两种版本,Rip出来就要有两种Release)
Bad IVTC
—>画面有不可去处的拉丝(不好的版本)
Bad Aspt —>画面比例不正常(不好的版本)
LIMITED
—>指在美国有限上映的片子,很多外国片都这样
WITH
EXTRAS—>带花絮
INTERLACED—>隔行(可看见横的扫瞄线)
NUKED—>
画质太差,被FTP的管理员废掉
SUBBED —>内嵌硬字幕(画面内不能消去)
UNSUBBED
—>重新发布没有内嵌硬字幕的版本
CAM—> 摄影机拍影院银幕,带有影院音响(夹带观众笑声,不好)
Telesync,
TS—>摄像机拍影院银幕,从影院放映机直接接线输出
Telecine, TC—> 胶版,直接转电影拷贝,转电影拷贝
DVD
SCREENER —>用于观摩或展示的DVD
SCREENER, SCR
—>用于观摩或展示录影带
WORKPRINT,WP—>工作录影带(导演剪接版,与发行版不同 )
Director Cut
—>导演剪接版
TDX—>
传统DivX制作规则,不符合规则就不会被接受或被NUKE
INTERNAL—>不太符合TDX标准的作品,一些是自己做着玩,还有一些是那组织认为依照TDX无法做到满意的质量,但不依照TDX做又会被NUKE,所以只好INTERNAL,有些比较值得收藏。
STV—>指没有也不会有美国影院公映这部片,或者是在影院放映前已经在电视上放过
OST—>
原声大碟

PDA文件名常识

PPC2002 – –> 该软件所适用的操作系统,Pocket PC2002
WM2003
—> 该软件所适用的操作系统,Windows Mobile 2003等同于Pocket PC2003
ALL.PPC—>
适用于所有的Pocket PC系统,包括Pocket PC2000/Pocket PC2002/Pocket PC2003(Windows Mobile
2003)
ARM、MIPS、SH3分别代表该软件只适用于基于ARM、MIPS、SH3处理器的Pocket PC
PalmOS—>
该软件是为PalmOS系统开发的,
其中PalmOS5 是代表该软件只适用于PalmOS 5.0系统及以上
CLIE为Sony
Clie设备专用版
Treo 180/270/600分别为Handspring
Treo机型专用版
HIRES为专为拥有高分辨率屏幕(320*320)的机型设计
SymbianOS 6/6.1/7
是代表该软件只适用于SymbianOS 6.0/6.1/7.0系统
UIQ 是代表该软件适用于symbian7.0系统UIQ界面的机型,如Sony
Ericsson的P800/P900和Motorola A920等
JAVA
该软件为Java软件,需要支持Java的机型才能正常使用
S60.Java 专为Nokia S60系列机型设计的Java软件(Nokia7650,
Nokia3650, Nokia3310等)
S40.Java 专为Nokia
S40列机型设计的Java软件(Nokia6100,Nokia6610,Nokia6108,Nokia7210,Nokia7250等)
其中如特指明N3650、N6600等则又为该机型所优化
Smartphone
代表该软件适用于Windows Mobile Smartphone系统

攻击的假象

Posted by 曹宇伟 on 七月 17th, 2008

当发现系统被SYN Flood攻击的时候,现象是系统上有大量的SYN_RECV状态的网络连接。
可是当系统成为一个“黑洞”的时候——就是数据包只能进不能出——当系统带宽被用完的时候,系统上也会出现大量的SYN_RECV状态的连接,而且此时,系统会积累很多SYN_RECV状的连接,现在跟受攻击一模一样……

1. 增大SYN最大半连接
net.ipv4.tcp_max_syn_backlog
2. 减小超时值
net.ipv4.tcp_synack_retries
3. 启用cookie
/proc/sys/net/ipv4/tcp_syncookes

科学绘图软件gnuplot

Posted by 曹宇伟 on 七月 15th, 2008

Gnuplot 是一种免费的绘图工具,可以移植到各种主流平台。它可以下列两种模式之一进行操作:当需要调整和修饰图表使其正常显示时,通过在 gnuplot
提示符中发出命令,可以在交互模式下操作该工具。或者,gnuplot 可以从文件中读取命令,以批处理模式生成图表。
在shell中敲打”gnuplot”,
进入到gnuplot编辑环境里
初级基础命令:
1. set terminal postscript
设置终端
2. set
xlabel ‘x-date’
x坐标轴的名字为”x-date”
3. set title
“demo”
该图的名字为”demo”
4. set key top left
set key
box
设置图例的位置和形状
5. set output ‘/test/aa.ps’
设置图片保存到的文件目录
6. set xdata
time
set timefmt “%H:%M:%S”
set format x
“%H:%M:%S”
设置x坐标轴数据的格式
7.plot ["17:39:31":"17:50:48"]
‘/var/log/dns.log’ using 1:2 title “test” with lines linetype 1
画图,
x坐标起点是”17:39:31″, 终点是”17:50:48″, 源文件为’/var/log/dns.log’ ,
使用该文件的第一列和第二列数据作图,画直线图

8. 例子:
set xlabel
‘x-time’
set ylabel ‘y-%’
set mxtics 1
set title “cpu data
analysis”
set key top left
set key box
set term post eps color solid
enh
set output ‘/export/home/nancy/cpu.eps’
set xdata time
set timefmt
“%H:%M:%S”
set format x “%H:%M:%S”
plot
["17:39:31":"17:50:48"] ‘/export/home/nancy/cpu’ using 1:2 title “usr” with
line
s linecolor rgb “yellow”, ‘/export/home/nancy/cpu’ using 1:3 title “sys”
with line linecolor r
gb “red” , ‘/export/home/nancy/cpu’ using 1:4 title “w”
with line linecolor rgb “blue”, ‘/expo
rt/home/nancy/cpu’ using 1:5 title
“idle” with line linecolor rgb “green”

9.
写成脚本直接运行
把8中的命令写到*.plt文件里, 可以gnuplot>load ‘a.plt’,
若只想生成ps或eps文件, 则可以直接在shell下运行gnuplot a.plt

10.
ps和eps
ps:生成pft文件
eps:可以直接插入到word/execel 文件中.

11. 目前还有个小问题没有解决—已解决,更新例子(8)
当我在一个图中画多条线时,
如何使用不同的颜色来加以区分

12. 有用的文章
http://www.ibm.com/developerworks/cn/linux/l-gnuplot/index.html
http://cycloid.blog.163.com/blog/static/8847862006823102056295/

http://dsec.pku.edu.cn/dsectest/dsec_cn/gnuplot/ (gnuplot
中文手册)

http://cycloid.blog.163.com/blog/static/8847862006823102056295/

http://people.ofset.org/~ckhung/b/ma/gnuplot.php

http://dsec.pku.edu.cn/dsectest/dsec_cn/gnuplot/

http://www.cnblogs.com/morebetter/archive/2008/02/29/1086485.html

http://www.ibm.com/developerworks/cn/linux/l-gnuplot/index.html

Hardware Monitoring Tools

Posted by 曹宇伟 on 七月 14th, 2008

Name : lm_sensors Relocations: (not relocatable)
Version : 2.10.0 Vendor: CentOS
Release : 3.1 Build Date: Sat 06 Jan 2007 01:39:45 PM CST
Install Date: Thu 22 May 2008 04:23:25 PM CST Build Host: builder1.centos.org
Group : Applications/System Source RPM: lm_sensors-2.10.0-3.1.src.rpm
Size : 1752222 License: GPL
Signature : DSA/SHA1, Wed 04 Apr 2007 08:24:48 AM CST, Key ID a8a447dce8562897
URL : http://secure.netroedge.com/~lm78/
Summary : Hardware monitoring tools.
Description :
The lm_sensors package includes a collection of modules for general SMBus
access and hardware monitoring. NOTE: this requires special support which
is not in standard 2.2-vintage kernels.

rpm -qc lm_sensors
/etc/rc.d/init.d/lm_sensors
/etc/sensors.conf
/etc/sysconfig/lm_sensors

rpm -ql lm_sensors | grep bin
/usr/bin/ddcmon
/usr/bin/decode-dimms.pl
/usr/bin/decode-edid.pl
/usr/bin/decode-vaio.pl
/usr/bin/decode-xeon.pl
/usr/bin/sensors
/usr/sbin/fancontrol
/usr/sbin/fancontrol.pl
/usr/sbin/i2cdetect
/usr/sbin/i2cdump
/usr/sbin/i2cget
/usr/sbin/i2cset
/usr/sbin/isadump
/usr/sbin/isaset
/usr/sbin/pwmconfig
/usr/sbin/sensors-detect

shell中的判断

Posted by 曹宇伟 on 七月 11th, 2008

[ -f $file ]
像这们的句子,应该写成
[ -f "${file}" ] 这样可以
第1:避免变量file里包含特殊符号的情况。(当然这样也不是万能的)
第2:万一还有一个变量f,那么$file就会出现异常。

2010-02-01
apachectl 脚本中判断变量不为空:
$ULIMIT_MAX_FILES=”ulimit -S -n `ulimit -H -n`”
if [ "x$ULIMIT_MAX_FILES" != "x" ] ; then
    $ULIMIT_MAX_FILES
fi

BASH中字符串的处理

Posted by 曹宇伟 on 七月 10th, 2008

$x=abcd

[得到长度]

方法1:
$expr length $x
4

方法2:
$echo ${#x}
4

方法3:
$expr “$x” : “.*”    #expr的手册信息
4           #STRING : REGEXP anchored pattern match of REGEXP in STRIN

[查找子串]

$expr index $x “b”
2
$expr index $x “a”
1

[得到子字符串]

方法1:
#expr startpos length
$expr substr “$x” 1 3
abc
$expr substr “$x” 1 5
abcd
$expr substr “$x” 2 5
bcd

方法2:
#${x:pos:lenght}
$echo ${x:1}
bcd
$echo ${x:2}
cd
$echo ${x:0}
abcd
$echo ${x:0:1}
a

[匹配正则表达式]

[打印匹配长度]
$expr match $x “.”
1
$expr match $x “abc”
3
$expr match $x “bc”
0

[字符串的掐头去尾]

$x=aabbaarealwwvvww
$echo “${x%w*w}”
aabbaarealwwvv
$echo “${x%%w*w}”
aabbaareal
$echo “${x##a*a}”
lwwvvww
$echo “${x#a*a}”
bbaarealwwvvww

其中 , # 表示掐头, 因为键盘上 # 在 $ 的左面。
其中 , % 表示%, 因为键盘上 % 在 $ 的右面。
单个的表示最小匹配,双个表示最大匹配。
也就是说,当匹配的有多种方案的时候,选择匹配的最大长度还是最小长度。

[字符串的替换]

$x=abcdabcd
$echo ${x/a/b} # 只替换一个
bbcdabcd
$echo ${x//a/b} # 替换所有
bbcdbbcd

SHELL程序的不同执行方式

Posted by 曹宇伟 on 七月 10th, 2008

在当前shell环境运行:继承并影响当前环境。
. a.sh
source a.sh
实际上,”.”号与source的效果是一样的。
在当前shell运行时,需要注意,shell程序会影响、改变当前shell的环境。假如a.sh中有exit指令,那么用户将退出shell登录。

启动新的shell执行:只继承export输入的变量,并切不影响父进程的环境。exit指令只是退出新启动的shell。
bash a.sh
bash <a.sh
chmod+x a.sh
./a.sh

在( ) 中运行:executed in a subshell environment

也是在新的进程中运行。但是继承关系有点复杂,实验如下:

####START####
$su -
#chmod +x a.sh
#cat a.sh
echo $a
exit
#a=FreeBSD
#(./a.sh)

#(source a.sh)
FreeBSD
#(. a.sh)
FreeBSD
####END####

a.sh中的exit均没有影响到当前shell,但是却继承了当前shell的变量,但是改变a的操作却不能影响当前shell下a的值。

另外:
exec ./a.sh
关于exec:
exec: exec [-cl] [-a name] file [redirection ...]
Exec FILE, replacing this shell with the specified program.
If FILE is not specified, the redirections take effect in this
shell. If the first argument is `-l’, then place a dash in the
zeroth arg passed to FILE, as login does. If the `-c’ option
is supplied, FILE is executed with a null environment. The `-a’
option means to make set argv[0] of the executed process to NAME.
If the file cannot be executed and the shell is not interactive,
then the shell exits, unless the shell option `execfail’ is set.

man bash

Compound Commands
A compound command is one of the following:

(list) list  is  executed in a subshell environment (see COMMAND EXECUTION ENVIRONMENT below).  Variable assignments and builtin commands that affect the shell’s environment do not remain in effect after the command completes.  The return status is the exit status  of list.

{ list; }
list  is simply executed in the current shell environment.  list must be terminated with a newline or semicolon.  This is known as a group command.  The return status is the exit status of list.  Note that unlike the metacharacters ( and ), { and } are reserved words and must occur where a reserved word is permitted to be recognized.  Since they do not cause a word break, they must be sep-arated from list by whitespace.
Command Substitution
Command substitution allows the output of a command to replace the command name.  There are two forms:

$(command)
or
‘command‘

Bash performs the expansion by executing command and replacing the command substitution with the standard output of the command, with any trailing  newlines  deleted.  Embedded newlines are not deleted, but they may be removed during word splitting.  The command substitution $(cat file) can be replaced by the equivalent but faster $(< file).

When the old-style backquote form of substitution is used, backslash retains its literal meaning except when followed by $, ‘, or \.  The first backquote not preceded by a backslash terminates the command substitution.  When using the $(command) form, all characters between the parentheses make up the command; none are treated specially.

Command substitutions may be nested.  To nest when using the backquoted form, escape the inner backquotes with backslashes.

If the substitution appears within double quotes, word splitting and pathname expansion are not performed on the results.

COMMAND EXECUTION ENVIRONMENT
The shell has an execution environment, which consists of the following:

·      open files inherited by the shell at invocation, as modified by redirections supplied to the exec builtin

·      the current working directory as set by cd, pushd, or popd, or inherited by the shell at invocation

·      the file creation mode mask as set by umask or inherited from the shell’s parent

·      current traps set by trap

·      shell parameters that are set by variable assignment or with set or inherited from the shell’s parent in the environment

·      shell functions defined during execution or inherited from the shell’s parent in the environment

·      options enabled at invocation (either by default or with command-line arguments) or by set

·      options enabled by shopt

·      shell aliases defined with alias

·      various process IDs, including those of background jobs, the value of $$, and the value of $PPID

When a simple command other than a builtin or shell function is to be executed, it is invoked in a separate  execution  environment  that consists of the following.  Unless otherwise noted, the values are inherited from the shell.

·      the shell’s open files, plus any modifications and additions specified by redirections to the command

·      the current working directory

·      the file creation mode mask

·      shell variables and functions marked for export, along with variables exported for the command, passed in the environment

·      traps caught by the shell are reset to the values inherited from the shell’s parent, and traps ignored by the shell are ignored

A command invoked in this separate environment cannot affect the shell’s execution environment.

Command substitution, commands grouped with parentheses, and asynchronous commands are invoked in a subshell environment that is a duplicate of the shell environment, except that traps caught by the shell are reset to the values that the shell inherited from its parent  at invocation.   Builtin  commands  that are invoked as part of a pipeline are also executed in a subshell environment.  Changes made to the subshell environment cannot affect the shell’s execution environment.

If a command is followed by a & and job control is not active, the default standard input for the command is the  empty  file  /dev/null. Otherwise, the invoked command inherits the file descriptors of the calling shell as modified by redirections.

BASH多进程并行处理的方法实现

Posted by 曹宇伟 on 七月 10th, 2008

#!/bin/bash

SEND_THREAD_NUM=13
tmp_fifofile=”/tmp/$$.fifo” # 脚本运行的当前进程ID号作为文件名
mkfifo “$tmp_fifofile” # 新建一个随机fifo管道文件
exec 6<>”$tmp_fifofile” # 定义文件描述符6指向这个fifo管道文件
rm $tmp_fifofile
for ((i=0;i<$SEND_THREAD_NUM;i++));do
echo # for循环 往 fifo管道文件中写入13个空行
done >&6

for i in `seq 100`;do # 100 次 for 循环 开始
read -u6 # 从文件描述符6中读取行(实际指向fifo管道)

{
echo $i # 打印 i
sleep 3 # 暂停3秒
echo >&6 # 再次往fifo管道文件中写入一个空行。
} &

# {} 这部分语句被放入后台作为一个子进程执行,所以不必每次等待3秒后执行
#下一个,这部分的echo $i几乎是同时完成的,当fifo中13个空行读完后 for循环
# 继续等待 read 中读取fifo数据,当后台的13个子进程等待3秒后,按次序
# 排队往fifo输入空行,这样fifo中又有了数据,for语句继续执行

pid=$! #打印最后一个进入后台的子进程id
echo $pid

done
wait
exec 6>&- #删除文件描述符6

exit 0

查看系统当前处于连接状态(tcpCurrEstab)的连接数的方法

Posted by 曹宇伟 on 七月 10th, 2008

cat /proc/net/tcp |awk ‘{print $4}’ |grep -c 01

当然也可以:
netstat -nat |grep -c ESTABLISHED

或者:
netstat -s -t | grep connections\ established

经过time测试,netstat -s -t | grep connections\ established 这种方法是效率最高的。

Apache–访问日志中不记录对图片的请求

Posted by 曹宇伟 on 七月 9th, 2008

Apache–访问日志中不记录对图片的请求

本示例将避免对图片的请求出现在访问日志中。 你可以随便改改就将它用于避免特定目录或特定主机的请求被记入日志。

SetEnvIf Request_URI \.gif image-request
SetEnvIf Request_URI \.jpg image-request
SetEnvIf Request_URI \.png image-request
CustomLog logs/access_log common env=!image-request

yum终于有了yum-fastestmirror模块

Posted by 曹宇伟 on 七月 4th, 2008

相信不少人在使用yum install/update 的时候会不耐烦的按Ctrl+c。Debian有netselect-apt来帮助用户定位速度最快的mirror,现在yum也有这个功能了。
  
  升级你的yum,立刻!
  #yum -y update yum

PS: 然而貌似程序始终是程序,还不够完善。

在history命令中显示时间

Posted by 曹宇伟 on 七月 1st, 2008

FreeBSD 6.1上的csh,默认就是开启了这个功能的。
Linux上的BASH默认没有开启这个功能,开启办法是:设置环境变量HISTTIMEFORMAT,设备方法参照strftime的格式(man 3 strftime查看详细信息)。不过这个功能只有在BASH3.0以上的版本中才能使用。原文是这么写的:

New HISTTIMEFORMAT variable; value is a format string to pass to strftime(3). If set and not null, the `history’ builtin prints out timestamp information according to the specified format when displaying history entries. If set, bash tells the history library to write out timestamp information when the history file is written.

比如,在~/.bash_profile里添加如下一行:
export HISTTIMEFORMAT=”%F %T ”
然后再使用history的时候,就会显示时间信息了。

对缓存的新认识

Posted by 曹宇伟 on 七月 1st, 2008

这个是FaceBook的应用构架,没什么好说的。


Copyright © 2007 花开的地方. All rights reserved.