网络

-- 上网太多了,这个周末我要完全不用网络 == 我赌你不会超过一个小时 -- (关机)。。。。 -- (走动)。。。。 -- 目前未知,还不错 -- oh,shit == 哈

January 17, 2010 · notsobad

php代码格式化工具

对于一些缩进不好的代码,可以利用这些工具来进行缩进美化下。 http://www.codeassembly.com/examples/beautifier.php http://www.beautifyphp.com/ 水木上有人传了sina微博泄漏代码,是个文本,全部都在一行里,没法看 我用sed处理了下, cat att.php\?s.261.77749.629.txt | iconv -f gb2312 -t utf8 | sed -e 's/;/;\n/g' -e 's#//#\n//#g' -e 's#\*/#\*/\n#g' -e 's/\}/\}\n/g' 然后再用http://www.codeassembly.com/examples/beautifier.php 格式化了下,基本能看了

January 15, 2010 · notsobad

利用nmap来解析ip段

nmap支持很多中ip段的格式 ~$ nmap -n -sL 10.16.1-2.3-4 | awk '/Host/{print $2}' 10.16.1.3 10.16.1.4 10.16.2.3 10.16.2.4 ~$ nmap -n -sL 10.16.1-10.1 | awk '/Host/{print $2}' 10.16.1.1 10.16.2.1 10.16.3.1 10.16.4.1 10.16.5.1 10.16.6.1 10.16.7.1 10.16.8.1 10.16.9.1 10.16.10.1 -sL 列出扫描目标,不向目标发送数据,但是会做dns反向解析,可以加-n,去掉dns查询。 参考: -sL (List Scan) . The list scan is a degenerate form of host discovery that simply lists each host of the network(s) specified, without sending any packets to the target hosts. By default, Nmap still does reverse-DNS resolution on the hosts to learn their names. It is often surprising how much useful information simple hostnames give out. For example, fw.chi is the name of one company´s Chicago firewall. Nmap also reports the total number of IP addresses at the end. The list scan is a good sanity check to ensure that you have proper IP addresses for your targets. If the hosts sport domain names you do not recognize, it is worth investigating further to prevent scanning the wrong company´s network. Since the idea is to simply print a list of target hosts, options for higher level functionality such as port scanning, OS detection, or ping scanning cannot be combined with this. If you wish to disable ping scanning while still performing such higher level functionality, read up on the -PN option. ...

January 15, 2010 · notsobad

shell获取本机ip

获取本机ip ifconfig eth0 | sed -n 's/^\s*inet addr://p' | awk '{ print $1 }' 但是ifconfig的输出,有可能有中文。 ~$ ifconfig eth0 eth0 Link encap:以太网 硬件地址 ****** inet 地址:****** 广播:**** 掩码:***** inet6 地址: fe80::21a:a0ff:feab:1961/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 跃点数:1 接收数据包:38100 错误:0 丢弃:0 过载:0 帧数:0 发送数据包:34026 错误:0 丢弃:0 过载:0 载波:0 碰撞:0 发送队列长度:1000 接收字节:20977069 (20.9 MB) 发送字节:6029574 (6.0 MB) 中断:16 改一下才能通用: ...

January 15, 2010 · notsobad

GFuckingW

能用的网站一个一个被封,上网时感觉就像是做实验的小白鼠,时不时被电一下,电的多了,现在看着那些“连接被重置”的网站,都已经麻木了。 看不到,就当它不存在吧,gov把自己的头埋在沙子里,叫着“我看不到,我看不到……” 你看不到,它还在那里。 堵的久了,总有一天,洪水会冲破堤坝的, 冲垮这个Great Fucking Wall的,清算躲在gfw后的那群shit 今天,google说要退出中国。

January 13, 2010 · notsobad

清除kernel image和grub菜单

参考这里 ubuntu下,清除掉多余的kernel image和grub菜单。 保留最新的一两个就行了,多余的都去掉。 ~$ ls /boot/vml* /boot/vmlinuz-2.6.31-14-generic /boot/vmlinuz-2.6.31-15-generic /boot/vmlinuz-2.6.31-16-generic /boot/vmlinuz-2.6.31-17-generic ~$ sudo apt-get remove linux-image-2.6.31-14-generic ~$ sudo update-grub

January 13, 2010 · notsobad

利用reST来写文档

利用reST来写文档,然后用rst2html,rst2pdf来编译成html和pdf。 关于reST,我以后会再详细介绍一下。 509 ~/script/notsobad/reST/php_standard>tree . |-- Makefile |-- main.rst |-- main.style |-- php-standard.html `-- php-standard.pdf 0 directories, 5 files 510 ~/script/notsobad/reST/php_standard>cat Makefile all: php-standard.pdf php-standard.html php-standard.pdf: main.rst rst2pdf main.rst -o php-standard.pdf; php-standard.html: main.rst rst2html -ts -l zh_cn main.rst > php-standard.html clean: rm php-standard.* 511 ~/script/notsobad/reST/php_standard>make make: 没有什么可以做的为 'all' 512 ~/script/notsobad/reST/php_standard>rm php-standard.* 513 ~/script/notsobad/reST/php_standard>make rst2pdf main.rst -o php-standard.pdf; rst2html -ts -l zh_cn main.rst > php-standard.html

January 13, 2010 · notsobad

svn忽略文件

svn里面经常会有一些不必要的文件,比如.tmp,.swp等,这是因为添加的时候没注意 正确的应该是设置忽略文件,svn增加一个目录,先不增加里面的文件。 svn add php_standard/ --depth empty 然后设置忽略文件 ~$ svn propset svn:ignore "*.pdf" php_standard/ 设置属性 “svn:ignore” 于 “php_standard” ~$ ~$ svn propget svn:ignore *.pdf 或者忽略整个目录的内容 ...

January 12, 2010 · notsobad

围城

via 鸿渐道:“我发现拍马屁跟恋爱一样,不容许有第三都冷眼旁观。咱们以后恭维人起 来,得小心旁边没有其他的人。” 辛楣道:“像咱们这种旅行,最试验得出一个人的品性。旅行是最劳顿,最麻烦,叫人 本相毕现的时候。经过长期苦旅行而彼此不讨厌的人,才可以结交作朋友——且慢,你听我 说——结婚以后的蜜月旅行是次序颠倒的,庆该先同旅行一个月,一个月舟车仆仆以后,双 方还没有彼此看破,彼此厌恶,还没有吵嘴翻脸,还要维持原来的婚约,这种夫妇保证不会 离婚。” “你这话为什么不跟曹元朗夫妇去讲?” “我这句话是专为你讲的,sonny。孙小姐经过这次旅行并不使你讨厌罢?”辛楣 说着,回头望望孙小姐的轿子,转过脸来,呵呵大笑。 “别胡闹。我问你,你经过这次旅行,对我的感想怎么样?觉得我讨厌不讨厌?” “你不讨厌,可是全无用处。” 鸿渐想不到辛楣会这样干脆的回答,气得只好苦笑。兴致扫尽,静默地走了几步,向辛 楣一挥手说:“我坐轿子去了。”上了轿子,闷闷不乐,不懂为什么说话坦白算是美德。 ...

January 11, 2010 · notsobad

随机显示一条脚本技巧

从http://www.shell-fu.org/lister.php?random 会随机的显示一条脚本技巧. 把下面的内容放到bashrc中,运行shellfu即可,enjoy! shellfu(){ curl -s "http://www.shell-fu.org/lister.php?random" | sed -e 's/ /\n<\/div>\n/g' | sed -n -e "/ /,/<\/div>/p" | lynx -stdin -dump -nolist; } 运行效果: 518 ~>shellfu The commmands below show the ten largest files/dirs in the working directory. Both commands give similar results, though handle things slightly differently. The 'du' option is good if you also need sizes of subdirectories, but the 'ls' option gives more detail. ls -laSh | head -10 du -s * | sort -nr | head -10 I find both to be useful in situations where I need to make more free space. 518 ~>shellfu Mail somebody about space running low in some path (ksh, bash): PATHS="/export/home /home" AWK=/usr/bin/awk DU="/usr/bin/du -ks" GREP=/usr/bin/grep DF="/usr/bin/df -k" TR=/usr/bin/tr SED=/usr/bin/sed CAT=/usr/bin/cat MAILFILE=/tmp/mailviews$$ MAILER=/bin/mailx mailto="[email protected]" for path in $PATHS do DISK_AVAIL=`$DF $path | $GREP -v "Filesystem" | $AWK '{print $5}'|$SED 's/%//g'` if [ $DISK_AVAIL -gt 90 ];then echo "Please clean up your stuff\n\n" > $MAILFILE $CAT $MAILFILE | $MAILER -s "Clean up stuff" $mailto fi done

January 11, 2010 · notsobad