Entries Tagged as ''

通过google抓页面并返回掌上设备能看得页面

在网上闲逛

无意发现这么个好东东

说是用这个url

http://www.google.com/gwt/n

输入要抓的url地址

能返回手机、pda等掌上设备能看的html页面

google好东西可真多呀

原文在这里

http://www.2036ad.com/archives/2006/01/httpwwwgoogleco.html

vim里把某个字符替换成换行符

linux下

有个需求

把某个文本文件中在某个字符(";’)后换行

我用命令

%s/;/;\n/g

不行

%s/;/;/\n\r/g

能换

但是有多余字符

%s/;/;\r\n/g也是一样

但多余字符出现的位置不一样了

于是

我用命令

%s/;/;\r/g

搞定

怎样在Linux下封ping(icmp包)

在这个过分自由的internet上

到处都充斥着病毒、蠕虫什么的

而入侵往往是先通过ping来扫描定位“活着的”机器的

如果把机器的ICMP echo requests关掉

不敢说机器会安全很多

但起码会少很多苍蝇骚扰:)

闲话少说

Linux下关掉ping其实很简单

在文件/etc/sysctl.conf中添加两句:

 

net.ipv4.icmp_echo_ignore_broadcasts = 1

net.ipv4.icmp_echo_ignore_all = 1

 

再运行命令

sysctl -p即可生效

或者是重起也能生效

这种方式实现的还不算完美

在windows下ping不会有问题

但如果在linux下ping做了这个操作的机器的话

命令就会挂在那里

直到Ctrl+C结束

但如果是在linux下ping一台不通的机器的话

是会输出"Destination Host Unreachable"之类的什么的

 

freebsd4.11下定制安装包里mfsroot.gz

cp boot.flp /root/
cd
vnconfig -c vn0 boot.flp;mount /dev/vn0 /mnt
cp /mnt/mfsroot.gz .
umount /mnt;vnconfig -u vn0
gzip -d mfsroot.gz
vnconfig -c vn0 mfsroot;mount /dev/vn0 /mnt

然后

/mnt目录下的东西就可以修改了

改完再

umount /mnt;vnconfig -u vn0

我们的应用主要是改mfsroot.gz中stand目录下的东西

这个可以这样做到

cd /usr/src/release;make boot.flp

make boot.flp之前需要根据需要修改一下文件/usr/src/release/i386/boot_crunch.conf

这里面定义的有stand目录下需要哪些程序的定义

而且make boot.flp的时候也许会出点错

一步一步试吧

其实我们不需要真正做出boot.flp来

我们只需要把stand目录下的东西做出来就ok了

所以如果是在这之后出错

我们就不用去管它(我的情况正是如此)

然后就是把编好的stand目录下的东西拷贝到目的目录(这里应该是/mnt/stand/)下去

首先需要把目的目录下inode号一样的文件全部删掉

然后把文件boot_crunch拷过来

cp /R/stage/mfsfd/stand/boot_crunch /mnt/stand

然后

把其他/R/stage/mfsfd/stand/目录下和boot_crunch的inode号一样的程序弄过来

比如说这些程序有dhclient dialog find这几个

那么

cd /mnt/stand
for i in dhclient dialog find; do ln boot_crunch $i; done

再然后

cd
umount /mnt;vnconfig -u vn0
gzip -9 mfsroot
vnconfig -c vn0 boot.flp;mount /dev/vn0 /mnt
cp mfsroot.gz /mnt/
umount /mnt;vnconfig -u vn0
OK

这样我们就得到了定制的boot.flp

how to disable ipv6 in linux(linux下怎样干掉ipv6)

在kernel2.4里

在文件/etc/modules.conf

kernel2.6

在文件/etc/modprobe.conf

添加一句:

alias net-pf-10 off

有的文章里提到还得家一句:alias ipv6 off,其实是不需要的

这里有redhat站点上的一点相应讨论

http://www.redhat.com/archives/fedora-test-list/2004-March/msg00280.html

还有的提到要在/etc/sysconfig/network里设定

NETWORKING_IPV6=no

这是这也不是必要的

因为NETWORKING_IPV6缺省就是no



重起OK了

一个好的学习站点:IBM developerWorks

全称应该是“IBM developerWorks 中国”

简称dw

url是

http://www-128.ibm.com/developerworks/cn/

只不过需要申请一个账号密码

上面的东西比较多

比较全

关键是文章都写的比较实在

适合用来学习

不像我的

实用型的

典型的tips

^_^

用iptables来解决lvs中linux的real server的apr problem

这里是官方文档:ARP problem in VS/TUN and VS/DR

这里我把文档里重要的一段贴出来:

2. The redirect approach

For VS/DR clusters, Horms suggested a very cute redirect approach to get around the arp problem.

I have been able to get around this problem by removing the interface alias on the real servers and setting up a redirect, using ipchains of the form:

ipchains -A input -j REDIRECT <port> -d <virtual-ip-address> <port> -p <protocol>

This has the down side that the real servers essentially have to be Linux boxes to support this feature but it has the up side that the Linux Director can easily be moved to any machine on the LAN as it does not have to have an interface on a network other than the LAN. This has important implications in being able to fail over the Linux Director in a case of failure.

For running multiple virtual services on a single VIP, you can specify multiple redirect commands for different ports, or you don’t supply a port number so the comands could cover all ports in one hit per protocol as follows:

ipchains -A input -j REDIRECT -d <VIP> -p tcp

ipchains -A input -j REDIRECT -d <VIP> -p udp

For VS/TUN clusters, you can simply configure tunl0 up so that the system can decapsulate ipip packets properly, then add the REDIRECT commands for VIPs.

For iptables in kernel 2.4, you can use it as follows:

iptables -t nat -A PREROUTING -p tcp -d <VIP> --dport <vport> -j REDIRECT --to-port <vport>

 

redhat7.3下top时”Floating point exception”的问题

搞不懂为什么

网上有说是top的bug

我也strace -o file top跟了一下

懒得仔细看(也看不太懂:)

后来直接把系统升级了一下

apt-get -y upgrade

再把kernel从2.4.18-4升级到2.4.20-28.7

重起

top

OK了

感觉还是升级kernel有用

RedHat9下rpm当掉的问题

redhat9的机器

rpm有个bug

就是有可能会当掉

表现就是rpm -qa半天也出不来

crontab里的rpm(/etc/cron.daily/rpm)执行也当掉

ps看一堆的rpmq的进程

 

用strace -p看死在这里:

futex(0×405be4bc, FUTEX_WAIT, 0, NULL

得升级到rpm4.2.1才行

由于redhat9已经不再维护了

所以redhat没有发布补丁

 

redhat as3 update 4上安装oracle 9.2.0.6的小收获

看了n多的文档 大多是as3上装9.2.0.1或是9.2.0.4 再或者是as3u2上装9.2.0.4的 也有一两篇是as3u2上装9.2.0.6的 我这里主要是讲经验教训: 1,不需要降低gcc和g++版本为2.96; 2,需要将环境变量LD_ASSUME_KERNEL设为2.4.1,否则会死在刚开始安装的界面上; 3,没有了 :) 上周末刚装的