November 30, 2004

bloglines firefox toolkit

bloglines.com -> Help -> FireFox Toolkit
在右下脚加了一个的图标
还可以在context menu上加一个bloglines toolkit的菜单项
方便多了
要是能放到firefox sidebar上就更方便了

Posted by hufey at 12:42 PM | Comments (2)

November 28, 2004

搞定iptables

家里的两台电脑,都是双系统。
XP自带的防火墙和NAT功能很不错
Linux的就要自己设了
惭愧的是一直也不会设
每次google出iptables的设置就头大了
今天正好刚装完FC3在yum update
另外一台笔记本上不了网
硬着头皮再google一次
好些文章照做了都不管用
终于翻了google几十页之后找到问题所在

把下文中加蓝部分放到我的/etc/sysconfig/iptables里才终于对了


修改/etc/sysconfig/iptables(把原有的内容都删除),修改完如下

# Firewall configuration written by lokkit
# Manual customization of this file is not recommended.
# Note: ifup-post will punch the current nameservers through the
# firewall; such entries will *not* be listed here.
*mangle
:PREROUTING ACCEPT [0:0]
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]

*nat
:PREROUTING ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
[0:0]-A POSTROUTING -o ppp0 -j MASQUERADE
COMMIT

*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
COMMIT

Posted by hufey at 03:30 PM | Comments (0)

一周之内第三次装FC3

第一次装完了键盘鼠标都不对
第二次装发现了鼠标和我的WATCOM手写板冲突。
大概是因为没有重分区的缘故吧,把我原来的分区都在fstab
里写了一遍 usr1, home1, var1,最稀齐的居然还有一个 /1
哈哈
看着不爽,试图改fstab,结果之后就起不来了
嗯,其实我也不知道到底跟改fstab有没有关系,总之。。
只好重装
现在是在第三次的fedora core3下

Posted by hufey at 12:32 PM | Comments (0)

November 23, 2004

抽取一个文件里的以CONFIG开头大写的词

这个代码是为了抽取一堆source code中的CONFIG_词
肯定还有很多情况不能很好处理



#!/bin/sh

grep "CONFIG_" $PATHOFPATCH/$PATCH | sed 's/[+#|\|\|\&|(|)|\$|=|:|\"|;]//g'| sed 's/,0//g' | sed 's/\/\*.*//g' | sed 's/[abcdefghijklmnopqrstuvwxyz-]//g'|sed 's/_\.//g' | sed 's/\.//g'|awk '{print $1"\n"$2"\n"$3"\n"$4"\n"}' | grep "CONFIG_"




35F2的perl版
#!/usr/bin/perl -w


while (<>) {

while (m/(CONFIG_[A-Z|_|0-9]*)[\s|\)]/g) {

print "$1\n";

}

}


疑问:为什么sed删除所有小写字母不能用sed 's/[a-z]//g' ?
而必须用 sed 's/[abcdefghijklmnopqrstuvwxyz]//g' 这么难看的写法?

Posted by hufey at 05:32 PM | Comments (2)

November 21, 2004

Fedora Core 3

终于装上了Fedora Core3
升级Core2
现在Alt+TAB不好使
不知如何解决涅

Posted by hufey at 05:43 PM | Comments (0)

November 16, 2004

shell编程中expr的问题


LOOP=0
LOOP=`expr $LOOP+1`
这个时候LOOP结果是多少?

LOOP=0
LOOP=`expr $LOOP + 1`
这个时候LOOP结果是多少?


第一个结果是“0+1”
第二个结果是“1”

Posted by hufey at 03:35 PM | Comments (0)

养个MM做宠物


香港搞的,3G手机上的Virtual Girlfriend

Posted by hufey at 11:53 AM | Comments (0)

November 14, 2004

世界上第一架直升飞机


于法国时尚百年展

Posted by hufey at 03:04 PM | Comments (0)

November 12, 2004

esmtp fetchmail mutt configuration files

俺们这有个VPN,这个可以理解,因为不能让任何人在任何地方
都能访问到公司内部的资源。
可是有个麻烦就是回家之后连公司的mail都收不到了
现在都globalization/internationalization了
经常要跟世界各地的人联系,
如果赶上周末,再加上时差的问题,会在礼拜一收到
很多的mail,加上公司的mail不一定都是公事等等其他原因,
迫切需要一个在家能收mail的方案。

俺鼓捣了个把小时,终于成功了。那就是用fetchmail收下来
再转到一个普通的帐户上去。当然了,熟的话几下子就设好了,
俺不是不熟么。。。。。。
这样单位机器不关就可以收下mail给家里发回去了

######################################
####.esmtprc
######################################
hostname=paowang.com:25
username="hufey"
password="*******************"
starttls=enabled

######################################
#### .fetchmailrc
######################################
defaults
mda "/usr/bin/esmtp -f %F %T"
poll pop3.mailserver proto POP3 iudl
user "username" there with password "***************" is "hufey @ paowang.com" keep

######################################
#### .muttrc
######################################
set pop_host="pop://hufey:**************@paowang.com"
set sendmail="/usr/bin/esmtp -v -X ~/.esmtplog"
my_hdr From: hufey
my_hdr Reply-To: hufey

Posted by hufey at 05:29 PM | Comments (0)

November 11, 2004

vsftp writable anonymous root问题的解决

500 OOPS: vsftpd: refusing to run with writable anonymous root
很多人问这个问题
google中文没人回答
google英文说的都含糊
其实只要把anon_root目录本身的 w权限去掉就可以了
比如 在配置文件中设定了 anon_root=/var/ftp
那么 /var/ftp就是这样:
dr-xr-xr-x 4 root root 4096 Nov 11 09:52 /var/ftp/
/var/ftp里就是这样:
drwxrwxrwx 3 ftp ftp 4096 Nov 11 11:15 incoming
dr-xr-xr-x 2 ftp ftp 4096 Jul 6 14:24 pub

cat /etc/vsftpd/vsftpd.conf

# Example config file /etc/vsftpd.conf
#
# The default compiled in settings are very paranoid. This sample file
# loosens things up a bit, to make the ftp daemon more usable.
#
# Allow anonymous FTP?
anonymous_enable=YES
#
# Uncomment this to allow local users to log in.
local_enable=YES
#
# Uncomment this to enable any form of FTP write command.
write_enable=YES
#
# Default umask for local users is 077. You may wish to change this to 022,
# if your users expect that (022 is used by most other ftpd's)
local_umask=022
#
# Uncomment this to allow the anonymous FTP user to upload files. This only
# has an effect if the above global write enable is activated. Also, you will
# obviously need to create a directory writable by the FTP user.
anon_upload_enable=YES
#
# Uncomment this if you want the anonymous FTP user to be able to create
# new directories.
anon_mkdir_write_enable=YES
anon_root=/var/ftp
#
# Activate directory messages - messages given to remote users when they
# go into a certain directory.
dirmessage_enable=YES
#
# Activate logging of uploads/downloads.
xferlog_enable=YES
#
# Make sure PORT transfer connections originate from port 20 (ftp-data).
connect_from_port_20=YES
#
# If you want, you can arrange for uploaded anonymous files to be owned by
# a different user. Note! Using "root" for uploaded files is not
# recommended!
chown_uploads=YES
#chown_username=whoever
#
# You may override where the log file goes if you like. The default is shown
# below.
#xferlog_file=/var/log/vsftpd.log
#
# If you want, you can have your log file in standard ftpd xferlog format
xferlog_std_format=YES
#
# You may change the default value for timing out an idle session.
#idle_session_timeout=600
#
# You may change the default value for timing out a data connection.
#data_connection_timeout=120
#
# It is recommended that you define on your system a unique user which the
# ftp server can use as a totally isolated and unprivileged user.
#nopriv_user=ftpsecure
#
# Enable this and the server will recognise asynchronous ABOR requests. Not
# recommended for security (the code is non-trivial). Not enabling it,
# however, may confuse older FTP clients.
#async_abor_enable=YES
#
# By default the server will pretend to allow ASCII mode but in fact ignore
# the request. Turn on the below options to have the server actually do ASCII
# mangling on files when in ASCII mode.
# Beware that turning on ascii_download_enable enables malicious remote parties
# to consume your I/O resources, by issuing the command "SIZE /big/file" in
# ASCII mode.
# These ASCII options are split into upload and download because you may wish
# to enable ASCII uploads (to prevent uploaded scripts etc. from breaking),
# without the DoS risk of SIZE and ASCII downloads. ASCII mangling should be
# on the client anyway..
#ascii_upload_enable=YES
#ascii_download_enable=YES
#
# You may fully customise the login banner string:
ftpd_banner=Welcome to MontaVista Beijing R&D Center FTP service.
#
# You may specify a file of disallowed anonymous e-mail addresses. Apparently
# useful for combatting certain DoS attacks.
# deny_email_enable=YES
# (default follows)
# banned_email_file=/etc/vsftpd.banned_emails
#
# You may specify an explicit list of local users to chroot() to their home
# directory. If chroot_local_user is YES, then this list becomes a list of
# users to NOT chroot().
#chroot_list_enable=YES
# (default follows)
#chroot_list_file=/etc/vsftpd.chroot_list
#
# You may activate the "-R" option to the builtin ls. This is disabled by
# default to avoid remote users being able to cause excessive I/O on large
# sites. However, some broken FTP clients such as "ncftp" and "mirror" assume
# the presence of the "-R" option, so there is a strong case for enabling it.
#ls_recurse_enable=YES

pam_service_name=vsftpd
userlist_enable=YES
#enable for standalone mode
listen=YES
tcp_wrappers=YES

Posted by hufey at 11:11 AM | Comments (1)

November 08, 2004

mykill.sh

记得以前买过一本杂志
有一段代码是杀掉所有指定名字的进程
很感兴趣,因为像evolution这样的程序经常不会自己退出去
再起来之前必须手工杀掉,而且他有好几个进程,所以
必须一个一个手工杀掉
不过那本杂志忘了丢哪去了,只好自己琢磨着写了一个

#!/bin/sh
 
for you in `ps ax|grep $1|grep "^[ |0-9]"|grep -v "grep"|grep -v "$0"|awk '{print $1}'`
do
        kill -9 $you
done
Posted by hufey at 05:24 PM | Comments (0)

November 07, 2004

俺工作的地方3

Posted by hufey at 05:47 PM | Comments (0)

November 06, 2004

Palm 手表


Posted by hufey at 09:36 PM | Comments (0)

November 04, 2004

写了一个Hello World的gaim plugin版

折腾了好几天。


开始想写一个给gaim用的机器人,发现gaim.sf.net
上有个perl写的plugin例子。照着抄了一个发现基本不知他在不在跑。其实根本没跑。
因为:gaim安装时会给perl加Gaim module,否则use Gaim如何能生效呢?
可我的perl早就升到了5.8.5,目录位置早就不对了。找到一些用C写的例子,
不过代码太多了,嗯,我越来越发现自己岁数大了,什么也不原意深究了。
结果鼓捣perl鼓捣了两天。
Gaim的官方网站上根本没有用C写plugin的例子。
后来下载了一个SmartEar的plugin,才几十K,终于有兴趣往下看了......
一编译发现需要头文件,于是下载gaim-devel的rpm装。
还不对,
只好下载gaim的源代码,装了之后竟然启动就会segment fault,而root下就没问题。
想了想把自己用户目录下的 .gaim改个名。果然就启动好了。
其实,gaim.sf.net给的perl例子已经不能运行在最新的1.0.2下了。抓狂
偶尔在看版本信息的时候发现了gaim的irc在 freenode。
于是irc,/join #gaim。又问里面的人,终于有一个大概是gaim的开发者告诉了我
How to write a plugin for gaim by C language
还好,照葫芦画瓢搞出了第一个plugin。

接下来就是完善它,再搞搞NLP。。。。。。

Posted by hufey at 04:38 PM | Comments (2)

November 01, 2004

FBUI

这个咚咚有意思。


Numbers for Comparison









Item FBUI X-Windows
Core software size 26 kilobytes 1710 kilobytes

Library software size 17 kilobytes (optional) 1370 kilobytes (that's just Xlib; required)
Window manager program size 30 kilobytes (fbwm, static link) 145 kilobytes (twm, dynamic link)
Terminal emulator program size 38 kilobytes (fbterm, static link) 247 kilobytes (xterm, dynamic link)

Analog clock program size 23 kilobytes (fbclock, static link) 29 kilobyte (xclock, dynamic link)

Posted by hufey at 03:05 PM | Comments (0)