recode tips

So why bother iconv, dos2unix, unix2dos when we have recode...
#显示所有有效的字符集及其别名
recode -l | less

#转换Windows下的ansi文件到当前的字符集(自动进行回车换行符的转换)
recode windows-1252.. file_to_change.txt

#转换Windows下的ansi文件到当前的字符集
recode utf-8/CRLF.. file_to_change.txt

#转换Latin9(西欧)字符集文件到utf8
recode iso-8859-15..utf8 file_to_change.txt

#Base64编码
recode ../b64 < file.txt > file.b64

#Quoted-printable格式解码
recode /qp.. < file.txt > file.qp

#将文本文件转换成HTML
recode ..HTML < file.txt > file.html

#在字符表中查找某符号(e.g.欧元)
recode -lf windows-1252 | grep euro

#显示字符在latin-9中的字符映射
echo -n 0x80 | recode latin-9/x1..dump

#显示latin-9编码
echo -n 0x20AC | recode ucs-2/x2..latin-9/x

#显示utf-8编码
echo -n 0x20AC | recode ucs-2/x2..utf-8/x

Toying with cal and date

#显示日历
$cal -3

#显示指定月,年的日历
$cal 9 1752

#这个星期五是几号?
$date -d fri

#今年圣诞礼拜几?
$date --date='25 Dec' +%A

#若干秒后的未来时刻时间计算
$date --date '2009-09-27 13:00:00 UTC 360000 seconds'

#显示当前某地区时间时间(可用tzselect寻找时区)
$TZ=':America/Los_Angeles' date

#定时弹对话框
$echo "DISPLAY=$DISPLAY xmessage ALARM!!" | at "NOW + 30 minutes"

Some wget tips

#网页及附件下载
wget -nd -pHEKk [url]

#断点续传
wget -c [url]

#批量下载某类别文件
wget -r -nd -np -l1 -A '*.jpg' [url]

#定时下载
echo 'wget url' | at 01:00

#限制下载速度(32KB/s)
wget --limit-rate=32k [url]

#检查链接有效性
wget -nv --spider --force-html -i bookmarks.html

性浪围脖邀请链接

大家都发,我也来发
http://t.sina.com.cn/invite/att_reqback.php?code=nXxYiHQ

功能少,界面一般,就是用户基础实在太大...连开复老师都转投了...

irc.freenode.net #gentoo-cn log: 2009-09-26

[01:06:49] <someone> 怎么安装被 block的软件包?
[01:09:08] <someone> gentoo-china-overlay: robert.zhangle * r1032 /trunk/dev-python/lockfile/ (Manifest ChangeLog): dev-python/lockfile: Manifest is missing
[09:14:20] <someone> 有人知道有好用的反汇编器嘛 :)
[09:16:10] <someone> ida
[09:18:32] <someone> linux 的?
[09:19:04] <someone> 有linux版的,不过在linux到没用过反汇编,呵呵
[09:19:42] <someone> touparx, 我尝试 RE 一个东西 :P
[09:20:28] <someone> 我只在win下反汇编过
[09:20:39] <someone> 这东西 open source 里用的少。。
[09:20:56] <someone> 用 windows 的人经常干这事,hoho
[09:38:04] <someone> touparx, 你有现成的嘛?
[09:40:10] <someone> 没的
[09:41:29] <someone> 官网只看到的都是 .exe...
[09:43:37] <someone> 以前用ida时,看网页上说有linux版的,现在没了?
[09:44:05] <someone> 搜索是说有。。
[09:44:16] <someone> 难道付钱才能拿。。
[09:46:44] <someone> 又或者是打包在 .exe 中。。。
[10:29:42] <someone> sunmoon1997: gdb
[10:30:21] <someone> r0bertz, 用 gdb RE 比较困难。。
[10:31:12] <someone> 目前也只能用 gdb 了。。
[10:31:36] <someone> RE?
[10:32:10] <someone> oh
[10:32:27] <someone> 推荐一个.gdbinit
[10:32:35] <someone> /bin/sh: paste.sh: command not found
[10:32:38] <someone> ...
[10:33:24] <someone> http://dpaste.com/98411/
[10:33:28] <someone> hoho
[10:33:55] <someone> 在停下来的时候,可以自动打印寄存器信息
[10:33:59] <someone> 堆栈
[10:34:09] <someone> 还有下面几条指令的反汇编
[10:35:19] <someone> 可以试试配合emacs
[10:35:44] <someone> 我2006年的时候玩过,不过那个时候还不太稳定
[10:38:01] <someone> http://www.gentoo-cn.org/~zhangle/talk/debug_c++_using_gdb.html
[10:38:04] <someone> 使用GDB/Emacs debug C++程序
[10:43:42] <someone> 现在的 gdb 比较好调 c++ 程序了,不过没有调试的信息的就麻烦了
[10:49:21] <someone> en
[13:24:19] <someone> emerge net-print/cups errors:http://dpaste.com/98439/
[13:24:21] <someone> dpaste: #98439: emerge net-print/cups
[13:25:01] <someone> ?
[14:07:37] <someone> wenk, 提示信息已经说明了该怎么做,你不会是看不懂英文吧?
[18:57:31] <someone> 有朋友在用freebsd的么
[19:58:27] <someone> GunsNRose: hi
[19:59:05] <someone> GunsNRose: bsd下用过pgsql没
[19:59:55] <someone> ghosTM55, 用过,等于没用
[20:00:06] <someone> ghosTM55, 只是安了试了一下,比较看好pgsql
[20:00:16] <someone> GunsNRose: 升级过版本没有?
[20:06:09] <someone> 8.4.1
[21:00:02] <someone> gentoo-china-overlay: coderoar * r1033 /trunk/app-i18n/fcitx/ (fcitx-3.6.1.ebuild fcitx-3.6.ebuild Manifest ChangeLog): app-i18n/fcitx: removed obsolete
[21:05:31] <someone> Hi anybody
[21:06:38] <someone> I will install software do syslog the huawei route!!
[21:07:01] <someone> ?_?
[23:29:29] <someone> emerge gnome error:http://pastebin.com/m73e920b5
[23:29:32] <someone> pastebin - collaborative debugging tool

irc.freenode.net #gentoo-cn log: 2009-09-24

[10:25:24] <someone> ping 和 ssh使用的端口有什么不同? 为什么ping的同 ssh连不上? 不是端口原因?
[10:47:40] <someone> Range1900: ping 是 ICMP 协议
[10:47:47] <someone> ssh 是 TCP协议,22端口
[10:48:26] <someone> DF_xchat, 也有人说是 网卡的tcp协议问题 不过那是win下面啊。。。。
[10:48:50] <someone> 网卡有问题,那不是我能解决的了
[10:59:51] <someone> 请教个rdesktop的问题。这两天win2003(外网)不能连了,会是什么原因?在内网连xp可以,内网的XP连外网的win2003也可以,
[11:04:23] <someone> xp 远程桌面能连,rdesktop就能连
[11:05:05] <someone> 现在是不能啊
[11:05:52] <someone> rdesktop -0 123.181.18.122:3389 -u ny
[11:06:41] <someone> 连网内的xp就可以,真是郁闷
[11:07:06] <someone> 前两天还可以
[11:09:31] <someone> -_-!!!晕了,翻了一下工作日志,原来是端口记错了
[11:09:36] <someone> 不用带端口
[11:10:02] <someone> 我默认端口改了
[11:10:19] <someone> rdesktop -D -K -g 1024x768 -z -a 16 -u administrator host
[11:10:32] <someone> windows 又不会随便改rclient接入端口,何必捏
[11:11:05] <someone> 你要是知道怎么改windows rdesktop接入端口,也是高手了
[11:11:06] <someone> :P
[11:12:15] <someone> 懒得经常换密码,就把端口改了,把防火墙再将隐藏,就不管了,有时间去看看log,打下补丁
[11:13:20] <someone> 折腾windows比折腾gentoo麻烦十倍
[11:14:33] <someone> :P 还好,呵呵,有些东西没办法,必需要用win,找开发公司的时候人家说我们做不了linux
[11:17:39] <someone> linux 便宜,不好赚
[14:07:13] <someone> ~ims
[14:07:13] <someone> IMS相对指数 of Range1900: 智力 -0.97↑-0.91 情绪 -0.21↓-0.42 体力 -0.98↑-0.89 (-1...1)
[14:14:24] <someone> ~imspk Range1900
[14:14:24] <someone> sunmoon1997 ROCKS and Range1900 sucks today
[14:14:35] <someone> .............
[14:17:11] <someone> Range1900, hoho 现在谁都可以欺负你 :D
[14:17:36] <someone> sunmoon1997, 不会有那么多坏人滴~
[14:18:14] <someone> 来吧来吧,大家来围观 Range1900 有脱衣 show ...
[14:18:25] <someone> 昨天的问题 搞明白了 原来是网卡。。。。 有时linux 会让不出 换个新的就好了。。
[14:18:35] <someone> sunmoon1997, 换id = =
[14:20:47] <someone> ~ims
[14:20:47] <someone> IMS相对指数 of huntxu: 智力 -0.37↑-0.19 情绪 -0.79↑-0.63 体力 -0.73↑-0.53 (-1...1)
[14:21:00] <someone> 低谷,还是闪...
[14:21:19] <someone> huntxu, Range1900 更低
[14:21:33] <someone> ~imspk huntxu
[14:21:33] <someone> Range1900 sucks and huntxu ROCKS today
[14:21:37] <someone> = =
[14:21:47] <someone> 还以为。。。。。
[14:21:58] <someone> hoho
[14:22:25] <someone> 你有两项接近 -1...
[14:24:08] <someone> sunmoon1997, 有记录吧 谁负的最多?
[14:24:40] <someone> 每个人总有低潮的时候。。。
[14:25:13] <someone> sunmoon1997, 但愿现在是最低的低潮。。。。。。。。
[15:24:48] <someone> Range1901: 每个月总有那么几天的。
[15:25:40] <someone> DF_xchat, 日
[15:29:01] <someone> 有人研究过 msn为什么穿东西慢?
[15:35:25] <someone> Range1901: 估计是因为,,通过服务器?
[15:36:11] <someone> DF_xchat, 用msn传还抱怨慢。。。 艹
[15:36:38] <someone> Range1901: 用QQ吧,或者ftp
[15:38:18] <someone> DF_xchat, windows ?
[15:38:27] <someone> sunmoon1997: 什么?
[15:41:56] <someone> 用的是 windows 嘛?
[15:48:56] <someone> 现在是
[16:05:10] <someone> 传文件dropbox不错
[16:15:56] <someone> ~ims
[16:15:57] <someone> IMS相对指数 of c\nc: 智力 0.95↓0.87 情绪 1.00↓0.98 体力 -0.94↓-1.00 (-1...1)
[16:16:02] <someone> ~imspk bones7456
[16:16:03] <someone> c\nc ROCKS and bones7456 sucks today
[16:16:25] <someone> 。。
[16:40:32] <someone> ~ims
[16:40:33] <someone> IMS相对指数 of MeaCulpa: 智力 0.00↑0.17 情绪 0.90↑0.97 体力 0.41↓0.14 (-1...1)
[16:41:17] <someone> 情绪不错 接近1.。。。
[16:41:38] <someone> 我的太差 防止被人蹂躏 只能开马甲了 = =
[16:45:08] <someone> ~imspk Range1900
[16:45:09] <someone> huntxu ROCKS and Range1900 sucks today
[16:45:33] <someone> Range1901: 以为穿上马甲就认不出你了么...hoho
[16:45:44] <someone> huntxu, 你个流氓
[16:45:52] <someone> 啊啊啊啊啊啊 bug
[16:51:49] <someone> ...
[20:47:11] <someone> anyone using scim here?
[20:47:48] <someone> i can start scim successfully by scim -d, but cant trigger the pinyin input by ctrl+space, any idea how is that?
[20:49:30] <someone> Galapagos: did you set environment variables?
[20:50:38] <someone> i dont know what that is, could you enlight me plz?
[20:53:09] <someone> 他看到中文的
[20:53:19] <someone> yeah, i can read chinese
[20:53:35] <someone> nothing wrong with locale
[20:53:41] <someone> 我不會scim ,so,tell him ask here
[20:54:22] <someone> Galapagos: 'env |grep -i xim',then show it up
[20:55:00] <someone> GTK_IM_MODULE=scim
[20:55:07] <someone> 设上这个
[20:56:04] <someone> nothing returns with env | grep -i xim
[20:56:27] <someone> sunmoon1997: in locale.gen?
[20:56:45] <someone> no, export GTK_IM_MODULE=scim
[20:56:49] <someone> Galapagos, 这是环境变量。。
[20:57:02] <someone> then restart scim
[20:57:23] <someone> 输入法菜单里没有 scim 嘛?
[20:58:10] <someone> /etc/profile?
[20:59:24] <someone> export XMODIFIERS=@im=SCIM
[20:59:24] <someone> export GTK_IM_MODULE=scim
[20:59:24] <someone> export QT_IM_MODULE=scim
[20:59:26] <someone> 'export GTK_IM_MODULE=scim;pkill scim;scim -d'
[20:59:29] <someone> i set it
[21:03:34] <someone> still cant trigger it
[21:06:30] <someone> env and grep
[21:06:37] <someone> i did
[21:06:48] <someone> any result?
[21:07:09] <someone> no
[21:07:38] <someone> echo $GTK_IM_MODULE
[21:08:11] <someone> returns scim
[21:08:32] <someone> export XMODIFIERS=@im=SCIM
[21:08:33] <someone> export GTK_IM_MODULE=scim
[21:08:33] <someone> export QT_IM_MODULE=scim
[21:08:39] <someone> do it
[21:08:51] <someone> then restart scim
[21:09:35] <someone> still cant
[21:09:52] <someone> google....
[21:15:53] <someone> im using awesome, should i install scim-bridge or scim-qtimm?
[21:16:32] <someone> google...
[22:06:21] <someone> gentoo�������pu���������ܸߣ�
[22:06:21] <someone> haowan said "gentoo编译软件对cpu的要求是不是很高?" in GB2312, but we speak UTF-8 here
[22:10:33] <someone> gentoo中文化做的可以哇?
[22:10:50] <someone> 准备新装gentoo
[22:10:58] <someone> 不可以
[22:11:09] <someone> 你別裝
[22:11:15] <someone> 为什么?
[22:11:59] <someone> 因為...所以...,如果...就...
[22:12:16] <someone> 吓跑了
[22:12:24] <someone> XDDD
[22:12:47] <someone> 吾所欲也
[22:13:17] <someone> :P
[22:13:57] <someone> 博士好壞
[22:14:27] <someone> {^
[22:18:43] <someone> ~genfile openrc
[22:18:49] <someone> /etc/logrotate.d/openrc in sys-apps/openrc, /etc/findcruft/sys-apps/openrc in app-admin/findcruft2
[23:31:59] <someone> 有没有人在firefox上用gmail notifier或者gmail manager add-on的?
[23:32:00] <someone> 大家在这个插件登录有没有问题阿
[23:32:48] <someone> 目前gmail 出了点小问题
[23:34:14] <someone> MeaCulpa: 什么问题阿?我这里都不能登录好些天了。。。。昨天回去学校登录,可以了,但是回来家里又不行了。。换了dns试试,可以。。。但是今天又不行了。。
[23:34:50] <someone> MeaCulpa: 直接在官网上登录是可以的。。用firefox的插件就是不行。。太郁闷了
[23:46:57] <someone> hmm 我说的小问题只是联系人取不到而已。。。

The new Bond of Shanghai comming soon!

The new Bond is under construction... Being a mass now but soon it will open fresh and new.




Bird's peek on the Planned new Bond.


Where ppl gonna gather.



Some CLI tips note

# 去掉配置文件里的注释
egrep -v '^[[:space:]]*(#|$)'
.or.
sed '/ *#/d; /^ *$/d'

#做http url链接
echo $1 | sed -e h -e 's@/@\\@g' -e G -e 's@\([^\n]*\)\n\(.*\)@\1@'

#Python 自带当前目录的Http Server
python -m SimpleHTTPServer

#寻找所有不可读的文件
find -type f ! -perm -444

#寻找不可访问的目录
find -type d ! -perm -111

#Tar拷贝目录下的所有文件到目录/where/to/并保持文件属性
( cd /copy/from && tar -c . ) | ( cd /copy/to/ && tar -x -p )

#Tar拷贝目录到远程目录并保持文件属性
( tar -c /copy/from ) | ssh -C user@remote 'cd /copy/to/ && tar -x -p'

irc.freenode.net #gentoo-cn log: 2009-09-23

[09:06:20] <someone> druggo, 貌似ping 可以了 不过转发出问题了
[09:09:12] <someone> 还是说转发功能 只要修改一个参数 就可以了?
[09:21:39] <someone> iptables -t nat -A PREROUTING -d 58.xx30.6 -j DNAT --to 192.168.1.6
[09:21:55] <someone> 这样做的 目标地址转换 匹配源地址转换 是否有效?
[09:25:33] <someone> 你要转换什么?
[09:26:03] <someone> DF_xchat, 就是将内网地址变成外网的
[09:26:49] <someone> 或者叫映射。。。
[09:28:24] <someone> 就是说,比如访问外网的80端口,实际上是访问内网的80端口?
[09:33:48] <someone> DF_xchat, 是的 不过我这里做的是整个ip的映射 不仅仅是部分端口
[09:38:26] <someone> DF_xchat, 映射功能好了 转发就不行 崩溃啊
[09:44:59] <someone> 映射和转发不会冲突的
[09:54:55] <someone> Range1901, :)
[09:56:21] <someone> druggo, 麻烦了。。。
[09:56:48] <someone> Range1901, ?
[11:54:55] <someone> ~ims
[11:54:55] <someone> Use "birthday YYYY-MM-DD" to set the birthday for `Range1901' first. For privacy, whisper is recommended.
[11:55:04] <someone> 崩溃的孩子
[11:56:10] <someone> 更改了 /etc/conf.d/net 需要重启才能生效? 还是用别的命令 up down ?
[11:57:38] <someone> 应该是可以 up down
[11:58:25] <someone> /etc/init.d/net.XXX start
[11:58:58] <someone> net里面对应的设备去start stop restart ,还有可以rc-update add XXX default
[12:02:05] <someone> 干嘛要up down,一般设置好一次就够了啊
[12:02:21] <someone> 都先用基础的命令搞定了,再放到配置上去
[12:02:24] <someone> DF_xchat: 那也得加入特定的run-level
[12:02:26] <someone> 不要用配置去调试
[12:02:39] <someone> 不都是加入到default 或者 boot的嘛
[12:02:49] <someone> init.d 里面net随便起随便关,没事的
[12:11:55] <someone> druggo, 是真 好人 :D
[12:12:02] <someone> 赞美他~~~~~~~~~~~
[12:24:02] <someone> ssh不出去怎么回事。。。
[12:24:16] <someone> MeaCulpa, 人呐~
[12:27:35] <someone> 。。。
[12:27:41] <someone> 咋啦?
[12:27:58] <someone> MeaCulpa, 本机不能ssh 出去 能是哪里的问题? 没有错误提示。。。
[12:28:24] <someone> ping 的通么
[12:28:32] <someone> 痛~
[12:28:35] <someone> 通
[12:28:46] <someone> 看对方sshd的log...
[12:29:39] <someone> 哪里看sshd的log ?
[12:32:52] <someone> MeaCulpa, 好像没有log产生。。。
[13:00:41] <someone> Range1901: telnet 1.2.3.4 22
[13:00:52] <someone> 试试。。。
[13:00:55] <someone> 看看是否能连接上端口
[13:04:14] <someone> DF_xchat, 不行。。。
[13:05:37] <someone> DF_xchat, sshd 的log 是在var里面?
[13:19:39] <someone> ~ims
[13:19:39] <someone> IMS相对指数 of Range1900: 智力 -1.00↑-0.97 情绪 0.00↓-0.21 体力 -1.00↑-0.98 (-1...1)
[13:20:53] <someone> ...
[13:21:00] <someone> ~imspk Range1900
[13:21:01] <someone> gogonkt ROCKS and Range1900 sucks today
[13:21:04] <someone> O^ 哇哈哈!
[15:13:23] <someone> 最近在学习模块, 请教一下: 有没有文章专门讲述built-in和modular这两种module的比较?
[15:38:33] <someone> ssh被 ipv6 的占用了? 奇怪。。。。 22端口一直不可用
[15:53:15] <someone> 有没有firewall开着?
[15:55:45] <someone> ssh 不能联入 不能连出。。。。。 抑郁了。。。。
[15:56:09] <someone> Range1900: IP 都不一样
[15:56:15] <someone> netstat 看看吧
[15:58:35] <someone> DF_xchat, 自己连自己就很好 +_+
[15:59:10] <someone> @Range1900 你使用127.0.0.1连接?
[16:00:38] <someone> jessinio1, 用内网ip连的自己
[16:02:01] <someone> 你确认没有防火墙?
[16:03:02] <someone> jessinio1, 就算有防火墙 也不会拦着自己 不能连出去吧
[16:03:12] <someone> 刚才把iptables 清空了
[16:07:44] <someone> Range1900 ssh 不能联入 也 不能连出? 但是又能上网?
[16:08:08] <someone> jessinio1, 当时就是这样。。。。
[16:08:26] <someone> 当时?, 那现在?
[16:08:40] <someone> 当时就是现在 = =
[16:10:37] <someone> jessinio1, 抱歉。。。。 真的不能上网 不过为啥可以ping出去呢。。。
[16:11:20] <someone> 你ping哪里?
[16:11:29] <someone> ping baidu ping sina
[16:11:51] <someone> ping出的是什么IP呢?
[16:15:17] <someone> 202.208.33.32
[16:20:49] <someone> 我不认为这个33.32的IP是baidu或者是sina的
[16:25:13] <someone> 其他机器ping出来和这个一样
[16:25:29] <someone> ping sina.com.cn
[16:29:42] <someone> 202.108.33.32, 不是你刚才发的那个
[16:30:55] <someone> 其他在同一子网的机器可以上网? 就你的机器不行?
[16:31:37] <someone> jessinio1, 谢谢你看得这么仔细 不过只是我打错了 确实一样 都是108
[16:32:10] <someone> 同一子网的可以 他能ping 但是不能打开网页 ssh也不行
[16:32:37] <someone> -_-! 你公司是不是需要代理上网的呀?
[16:40:42] <someone> 好了。。。。问题明显了
[16:40:51] <someone> 能ping出去 但是无法打开网页。。。。
[16:50:33] <someone> 真不知道这是为什么.
[17:22:09] <someone> wget不行?
[17:28:12] <someone> MeaCulpa, wget我试下
[17:29:14] <someone> 下班,bb
[17:29:19] <someone> 。。。。
[17:29:58] <someone> wget 超时
[17:41:37] <someone> 有个人问 我能够上网,也能够ping通 某个网站的域名,但是就是打不开这个网站,其他网站都能正常打开。
[17:41:38] <someone> 不是那个网站服务器的原因,因为其他人都能正常访问。请问这是什么原因?
[17:41:51] <someone> 一楼的回答 :"你有没有做过对不起他们的事情?"
[19:16:56] <someone> 各位神仙啊 有没有遇到过 能ping出去 却不能打开网页么
[20:59:44] <someone> Range1900 怎么看都像是网关禁止了
[21:00:14] <someone> jessinio1, 网关没做其他设置啊 客户机都一样的。。。

在vim里发推

    Twitter用curl就可以实现交互的功能。有人作了工具脚本,TwitVim ,这下在vim里面上twitter更简单了,且代理也可设定。
简单用法:

    :PosttoTwitter - 提示输入信息发推
    :CPosttoTwitter - 把当前行推过去
    :BPosttoTwitter -把当前buffer推过去

    :FriendsTwitter - 显示 friends timeline. 
    :UserTwitter - 显示你的 timeline.
    :RepliesTwitter - 显示 @-回复.
    :PublicTwitter - 显示 public timeline.
    :DMTwitter - 显示 direct messages.


此外,在.vimrc里可以作一些设置:
    let twitvim_login = "user:pass"
    let twitvim_proxy = "host:port"
    let twitvim_count = 显示的推子数

此工具用两个窗口分开timeline和输入信息,方便,好用~

irc.freenode.net #gentoo-cn log: 2009-09-22

[00:00:08] <someone> http://dzen.geekmode.org/dwiki/doku.php?id=dzen:mainindex
[00:05:23] <someone> 有点意思...
[00:05:40] <someone> 日后研究
[00:07:18] <someone> feedburner 导出feed生成html,挺好玩
[00:07:32] <someone> ...
[00:07:33] <someone> http://dl.getdropbox.com/u/1383974/index.html
[00:08:39] <someone> ...........
[00:09:30] <someone> 咋的?
[00:10:03] <someone> linux 下有啥好的桌面twitter客户端么...qtwitter最近一碰就崩溃
[00:12:20] <someone> twitterfox...
[00:14:08] <someone> twitterfox ++
[00:14:13] <someone> 不过改名了
[00:14:56] <someone> 我用萬能版
[00:15:42] <someone> twitterfox 有点慌
[00:15:51] <someone> 我twitter老被suspend
[00:16:17] <someone> itweet.net + chromium 也不錯
[00:16:22] <someone> :D
[00:16:38] <someone> web的就算了,一大把
[00:16:50] <someone> windows上的客户端居然都是air的居多
[00:17:05] <someone> 破Air, 在blackbox里都出不来mainwind
[00:17:06] <someone> 好用的不多
[00:17:24] <someone> qtwitter不错,windows里我用,linux里老crash
[00:17:27] <someone> Air 的不分平台 :DDDD
[00:17:58] <someone> CLI的到是有两个twitter客户端
[00:18:52] <someone> gentoo 還無 AIR...
[00:19:37] <someone> 有趣的要数vim
[00:20:04] <someone> write ++enc=UTF-8 !curl --data-urlencode status@- --netrc --no-remote-name http://twitter.com/statuses/update.xml
[00:20:35] <someone> ?
[00:21:18] <someone> 什麼東東?
[00:21:49] <someone> 把当前文本推上去阿
[00:22:37] <someone> 怎麼用?
[00:22:41] <someone> 世界很精彩,但有GFW, 一切都要proxychains
[00:23:17] <someone> 我不用...
[00:23:44] <someone> vim?
[00:24:27] <someone> command -range Twitter
[00:25:19] <someone> 就是用curl吧文本推上twitter.com
[00:25:19] <someone> awesome 然後用 echinus,覺清爽
[00:26:10] <someone> MeaCulpa: tw () { curl -u gnkt: -d status=$* http://twitter.com/statuses/update.xml }
[00:26:57] <someone> MeaCulpa: tw () { curl -u user:passwd -d status=$* http://twitter.com/statuses/update.xml }
[00:27:28] <someone> http://www.vim.org/scripts/script.php?script_id=2204
[00:27:30] <someone> % tw bala bala bala :)
[00:27:30] <someone> TwitVim - Twitter client for Vim : vim online
[00:27:40] <someone> ?
[00:27:49] <someone> 还有人作好了现成的vim客户端
[00:28:12] <someone> gogonkt: en, hehe不错
[00:28:37] <someone> 在大陸沒鬼用
[00:28:42] <someone> 就是在,privoxy+tor后面很不稳定
[00:28:59] <someone> proxychains 直接proxychains urxvt...
[00:29:24] <someone> how to install scim-googlepinyin use layman?
[00:29:27] <someone> ~imspk gogonkt
[00:29:28] <someone> Use "birthday YYYY-MM-DD" to set the birthday for `Range1901' first. For privacy, whisper is recommended.
[00:29:35] <someone> ~imspk MeaCulpa
[00:29:35] <someone> Use "birthday YYYY-MM-DD" to set the birthday for `Range1901' first. For privacy, whisper is recommended.
[00:29:35] <someone> 抑或curl会认http_proxy环境变量?只要把privoxy设进http_proxy即可
[00:29:53] <someone> ...
[00:30:01] <someone> 大家好
[00:30:13] <someone> 看的話,用tailrss 就好了
[00:30:25] <someone> rsstail
[00:30:42] <someone> 看好办,因为有rss
[00:35:37] <someone> gogonkt: 那个bti不错,可以设代理,非交互式,适合灌水
[00:35:42] <someone> 推水...
[00:36:22] <someone> 而且tor/gapproxy都好用,奇了怪了
[00:36:40] <someone> 睡觉....nite all
[12:49:59] <someone> portage echinus
[12:50:46] <someone> portage pypanel
[13:03:19] <someone> reiserfschk 到底有用否,谁谈谈经验?
[13:05:57] <someone> ...
[15:29:03] <someone> 有人能给个vmware的注册码么
[15:45:36] <someone> 电驴内看到过
[15:47:22] <someone> 还有地址么
[15:51:13] <someone> 前段时间刚被我清理掉...
[15:51:15] <someone> ==
[15:52:00] <someone> vbox不是很好么...何必vmware
[15:54:16] <someone> 只找到个5.5.3 workstation
[15:55:40] <someone> 现在vbox出错了 google没有类似的,想换个vmware试试
[15:56:08] <someone> 我重装一次 看看还有没有问题 ,有问题再请教meaculpa
[15:59:49] <someone> http://dl.getdropbox.com/u/1383974/index.html
[15:59:58] <someone> 貌似比较老的码...
[16:01:44] <someone> 举例?
[16:03:07] <someone> ACPI: I/O resource 0000:00:1f.3 [0x1c20-0x1c3f] conflicts with ACPI region SMBI [0x1c20-0x1c2f]
[16:03:08] <someone> VMWare Nero Quake3 Quake2 Oracle
[16:03:37] <someone> 启动的时候出现的错误 是内核的问题 2.6.31的?
[16:03:53] <someone> windows我只有OS自己是盗版的,卸掉alcohol以后
[16:04:29] <someone> 装了nero说软件已经过期,都无语了
[16:04:39] <someone> 呵呵....k3b吧
[16:04:49] <someone> nero我也准备卸了
[16:04:55] <someone> MeaCulpa: 看过那个错误吗?
[16:05:01] <someone> MeaCulpa: 。。。。。那都没有原盘的。。
[16:05:05] <someone> wyatt1: 看过,不知
[16:05:06] <someone> 只是启动程序
[16:05:24] <someone> 哦
[16:05:25] <someone> DF_xchat_: 那不管,我的确是装上了盗版
[16:05:38] <someone> windows现在消灭盗版了
[16:05:51] <someone> 那是你,,和gentoo无关。。~~
[16:05:52] <someone> 不包括其本身,呵呵
[16:05:57] <someone> DF_xchat_: 我是说我
[16:06:06] <someone> 另外也赞扬一下Gentoo的包容性
[16:06:36] <someone> 没把linux搞成FSF的玩物
[16:08:52] <someone> Unknown media type in type 'all/allfiles'
[16:08:55] <someone> Unknown media type in type 'uri/mms'
[16:09:03] <someone> Unknown media type in type 'uri/mmst'
[16:09:22] <someone> 这个是什么原因,暂时对系统没有影响
[16:09:52] <someone> 晨想也在?哈哈
[16:10:48] <someone> 那个unknow的是怎么回事阿 总觉得不爽
[16:13:20] <someone> MeaCulpa: ?
[16:14:59] <someone> ??
[16:15:08] <someone> MeaCulpa: 。。。好吧。。。
[16:15:11] <someone> wyatt1: 在说什么?
[16:15:53] <someone> emerge 的时候出现很多上面的unkown
[16:16:23] <someone> 啊?emerge的时候?启动的时候如此倒也算了
[16:16:35] <someone> ACPI: I/O resource 0000:00:1f.3 [0x1c20-0x1c3f] conflicts with ACPI region SMBI [0x1c20-0x1c2f]
[16:16:54] <someone> Unknown media type in type 'all/allfiles'
[16:17:01] <someone> Unknown media type in type 'uri/mms'
[16:17:03] <someone> 这个
[16:17:50] <someone> o
[16:18:22] <someone> 这个的意思是,有一个东西在监听某些mimetypes...但是不知如何handle
[16:19:21] <someone> 那怎么解决呢
[16:22:07] <someone> grep -r "all/allfiles" /usr/share/mime 可以看看到底是who
[16:22:23] <someone> grep -r "uri/mms" /usr/share/mime
[16:22:59] <someone> 反正报错的几个都跑一遍,看看那些天杀得xml里写了啥,有没有没卸载干净的东西
[16:23:17] <someone> 恩 谢谢
[16:23:36] <someone> 不过不知道怎么改...
[16:24:16] <someone> 系统mime, 那叫一个乱啊
[16:24:48] <someone> update-mime-database试试看
[16:25:14] <someone> 喜欢狂适用gnome/kde那些大家伙的朋友经常遇到的
[16:26:33] <someone> 好像是kde的东东
[16:31:49] <someone> Please add "vboxdrv", "vboxnetflt" and "vboxnetadp" to:
[16:31:51] <someone> * /etc/conf.d/modules
[16:32:20] <someone> 是不是把三个东东写进去就可以的呢
[16:32:22] <someone> 照做
[16:32:34] <someone> 要重启么
[16:32:52] <someone> modprobe直接起试试看...
[16:35:01] <someone> FATAL: Error inserting vboxdrv (/lib/modules/2.6.31-gentoo/misc/vboxdrv.ko): Unknown symbol in module, or unknown parameter (see dmesg)
[16:35:55] <someone> 我没试过,一般都是直接重启...
[16:36:04] <someone> 好的
[17:31:21] <someone> 怎么vbox一直停在spawning session上了
[17:36:13] <someone> wyatt1: 死机了吧,lol
[17:36:15] <someone> ~ims
[17:36:16] <someone> IMS相对指数 of huntxu: 智力 -0.69↑-0.54 情绪 -0.98↑-0.91 体力 -0.98↑-0.89 (-1...1)
[17:37:00] <someone> ~ims
[17:37:01] <someone> IMS相对指数 of Range1900: 智力 -0.99↓-1.00 情绪 0.22↓0.00 体力 -0.94↓-1.00 (-1...1)
[17:37:16] <someone> ~imspk huntxu
[17:37:17] <someone> Range1900 ROCKS and huntxu sucks today
[17:42:47] <someone> ~ims
[17:42:48] <someone> IMS相对指数 of sunmoon1997: 智力 0.36↑0.53 情绪 0.90↑0.97 体力 -0.81↓-0.94 (-1...1)
[17:43:02] <someone> .....
[17:45:04] <someone> /etc/init.d/xboxdrv 也不存在
[17:45:12] <someone> ~imspk Range1900
[17:45:13] <someone> sunmoon1997 ROCKS and Range1900 sucks today
[17:45:33] <someone> HOHO,终于报仇了 :D
[17:47:01] <someone> 风水轮流转啊
[17:47:04] <someone> ~imspk sunmoon1997
[17:47:05] <someone> jdkcn sucks and sunmoon1997 ROCKS today
[17:47:28] <someone> 囧。。。还可以pk的?
[17:54:22] <someone> 额 各位帮忙看看是怎么回事
[18:10:46] <someone> 问个比较菜的问题,默认crontab中没有定义cron.daily,weekly...文件夹,里面的计划任务会执行吗?
[18:10:51] <someone> 别外check scripts in cron.hourly...是干嘛的?
[18:48:45] <someone> hi, i have this kernel complain at boot: http://dpaste.com/96670/
[18:48:50] <someone> dpaste: #96670: kernel
[18:48:56] <someone> what ACPI am I missing?
[18:49:02] <someone> acpi driver
[19:00:40] <someone> dmesg里面的信息?
[19:11:53] <someone> druggo, 在么?
[19:14:22] <someone> Range1900, 什么事?我马上走人了
[19:14:36] <someone> druggo, 。。。 晚上不上来了?
[19:14:59] <someone> 还是那个 iptables的问题 似乎要一个eth1 绑定两个ip。。。
[19:16:03] <someone> Range1900, 那就绑呗
[19:16:47] <someone> druggo, 需要在route 中设置么? 还是在iptables 和转发同样设置?
[19:17:50] <someone> Range1900, 绑IP你在网卡设置里写就好了
[19:20:28] <someone> druggo, 中的网卡设置文件在... 那里?
[19:20:59] <someone> sheep204, yes
[19:21:16] <someone> Range1900, /etc/conf.d/net
[19:21:38] <someone> :) 谢谢 druggo
[19:24:12] <someone> druggo, 现在路由上面设置 一个网卡绑定两个外网IP 然后制定 每个ip针对不同的功能?
[19:25:34] <someone> Range1900, 绑好IP,配置iptables规则即可
[19:25:50] <someone> Range1900, 和端口映射一样啊
[19:26:09] <someone> iface_eth1="58.xxx.30.6 brodcast 192.168.1.255 netmask 255.255.255.240"
[19:26:09] <someone> gateway="eth1/58.xxx.30.1
[19:31:24] <someone> druggo, 麻烦了 那个外网ip还是不能ping到。。。
[19:47:07] <someone> 各位老大 帮我想想 是不是漏了什么,这台是网关还有些应用跑在上面
[19:47:30] <someone> 现在要让内网的一台机器也有外网ip
[19:48:10] <someone> 所以在这个网关的一个网卡上绑定了两个ip ,准备在iptables中设置 转发和映射
[19:49:08] <someone> 两个这样的东东 iptables -A FORWARD -i eth1 -d 192.168.0.0/255.255.0.0 -j ACCEPT
[21:41:18] <someone> 我的天,udev是不是把我的pc喇叭模块带回来了,吓到宝宝了
[21:52:18] <someone> MeaCulpa: 那快干掉udev...lol
[21:52:51] <someone> huntxu: :P
[22:58:47] <someone> can anyone help me? when i mount cdrom, it returns unknown device
[22:59:59] <someone> Galapagos: 你 dmesg 看看有什麼不對
[23:00:27] <someone> dmesg |grep -i errorrrrrrrrrr
[23:01:36] <someone> nothing, only some minor messages about xfce4
[23:02:08] <someone> [ 61.462427] xfce4-panel[4136]: segfault at 7f4100000019 ip 00007f417e16fedb sp 00007fff2912a170 error 4 in libc-2.9.so[7f417e0fa000+14b000]
[23:03:17] <someone> is there any modules i need to notice to enable in the kernel?
[23:26:25] <someone> hi,all.
[23:27:05] <someone> what's difference between gentoo and funtoo?
[23:27:50] <someone> i just use a sabayon live-cd installed,and use a funtoo portage.
[23:29:40] <someone> but,now it says libXmu emerge error.So,how's going?
[23:30:14] <someone> ?
[23:30:49] <someone> libXmu emerge error,it says emake faile....
[23:31:31] <someone> emerge --resume --skipfirst not work
[23:31:38] <someone> 說清楚點
[23:34:19] <someone> btw,i'm using console enviroment in en_us.utf8.
[23:35:13] <someone> the X hasn't installed.
[23:35:53] <someone> ~genfile libXmu
[23:35:57] <someone> not found
[23:36:44] <someone> OMG
[23:39:13] <someone> sili0n: read log and seach bugs.gentoo.org
[23:42:23] <someone> gogonkt: thanks

irc.freenode.net #gentoo-cn log: 2009-09-21

[10:42:52] <someone> ~ims
[12:00:54] <someone> ~ims
[12:00:55] <someone> IMS相对指数 of zrby: 智力 0.53↑0.68 情绪 0.62↑0.78 体力 -0.73↑-0.53 (-1...1)
[13:46:35] <someone> ~ims
[13:46:36] <someone> Use "birthday YYYY-MM-DD" to set the birthday for `jdkcn' first. For privacy, whisper is recommended.
[13:47:31] <someone> ~ims
[13:47:32] <someone> IMS相对指数 of jdkcn: 智力 0.97↑1.00 情绪 -0.91↑-0.79 体力 -1.00↑-0.98 (-1...1)
[14:13:19] <someone> ~ims
[14:13:19] <someone> IMS相对指数 of Range1900: 智力 -0.94↓-0.99 情绪 0.44↓0.22 体力 -0.81↓-0.94 (-1...1)
[15:37:19] <someone> ip映射 也是可以用 iptables 来完成的?
[15:37:44] <someone> 召唤各位 大侠~~
[15:42:15] <someone> Range1900, 什么是IP映射?
[15:42:25] <someone> layman -L ×的颜色分别是什么意思?
[15:42:28] <someone> druggo, 。。。。。。
[15:43:47] <someone> shom, 表示你系统里有没有对应的checkout工具,就是中间方括弧里的版本控制工具
[15:48:21] <someone> druggo, 不对吧?添加的是gentoo-china,[ebuild R ] app-portage/layman-1.2.3 USE="subversion -git -test"
[15:49:19] <someone> druggo, 那个颜色应该是表示服务器状态的吧?
[15:49:32] <someone> druggo, 让局域网的机器 可以直接被外方访问 不是ip映射么?
[15:49:57] <someone> Range1900, 一般是用端口映射吧,除非你们外网IP有多
[15:50:26] <someone> druggo, 嗯 我们一共四个ip ip映射可以方便些吧
[15:51:01] <someone> Range1900, 都差不多,反正都是NAT
[15:52:20] <someone> shom, man layman
[15:52:26] <someone> druggo, 给个范例 咋写的iptables
[15:53:37] <someone> Range1900, 没用过,你搜一下吧
[16:10:52] <someone> Range1900, 冒死测试了, iptables -t nat -A PREROUTING -d 123.123.123.123 -j DNAT --to 192.168.0.222
[16:11:11] <someone> druggo, 嘿嘿
[16:11:17] <someone> druggo, :)
[16:11:36] <someone> boss 说周三就要 看来我要加班搞好了
[16:11:49] <someone> 谢谢你 druggo :D
[16:11:55] <someone> Range1900, 几秒钟的事
[16:12:14] <someone> Range1900, 就是把端口映射的端口去掉
[16:13:55] <someone> druggo, 虽然我配过iptables 转发 不过还是没把握,现在看起来 我和配过的相差不多:)
[16:15:38] <someone> Range1900, 差不多了,目的不同而已
[16:17:33] <someone> 嗯嗯 现在买机器 这就配咯
[17:03:41] <someone> emerge -avuDN world时会怎样才能不使用overlay里面的包升级?
[17:56:47] <someone> mask之
[18:09:49] <someone> druggo, 在么? 吃饭时间了。。。
[18:10:16] <someone> Range1900, 还未下班
[18:11:47] <someone> druggo, 有个问题 当外网访问内网这个被映射的ip时 这个ip应该是B类地址?
[18:12:11] <someone> 不是B 是C。。。。
[18:13:28] <someone> Range1900, 我不懂你说啥
[18:15:33] <someone> 呃。。。 我先整理下 X机器有外网ip直连,y是内网需要经过X连接出去 y的ip是?
[18:16:27] <someone> X 看到的是 Y 吧
[18:18:20] <someone> sunmoon1997, 我是想知道y如果是外网地址 网关为X,是否还能连接出去,X的iptables配置为允许转发(映射?)
[18:19:50] <someone> 国内虚拟主机有推荐的吗?
[18:20:28] <someone> Range1900, 嘿嘿,这个不清楚。。
[18:22:01] <someone> sunmoon1997, :)
[18:27:33] <someone> Range1900, X是网关,可以出去,Y是内网,必须经过X才能出去?那么Y的外网IP一样配在X上
[18:28:42] <someone> druggo, 还是有些迷糊。。。 Y的ip是外网ip 还是内网的?
[18:29:12] <someone> Range1900, 你都说了Y是内网机器,不是内网IP是什么?
[18:30:23] <someone> druggo, 可以用其他的外网ip么? 只用一个直连 但是用两个ip ?
[18:31:41] <someone> Range1900, 这和端口映射一样的,只是有个专门的IP专门用而已,这个专门的IP自然还是要在网关身上
[18:32:23] <someone> Range1900, Y作为内网机器配外网IP是没有意义的,Y只知道自己是内网的小角色而已
[18:32:45] <someone> druggo, 哦 明白了哦 在
[18:32:50] <someone> Range1900, 一切有网关大人做主。。
[18:34:10] <someone> 在X中标明 Y是内网的小角色 网关大人可以给个internet地址 不给也可以
[18:34:26] <someone> 特定端口去找Y就可以
[18:35:53] <someone> Range1900, 和端口映射(转发)一样,去掉端口号而已
[18:37:55] <someone> druggo, 如果没有设备设置这个ip(例如xxx.xxx) iptables 也可以指定这个 xxx.xxx去找Y么?
[18:39:17] <someone> Range1900, 好像也可以,因为网络设置决定了该IP路由去哪台网关,不过你最好还是把IP配在网关上吧
[18:40:30] <someone> druggo, 老大 明天陪我加班吧 10点-18点 :P 搞不完就的通宵了 很重要的东东
[18:42:40] <someone> Range1900, 你会做端口映射,就没问题了。 把IP配在网关上就行了
[18:43:42] <someone> Range1900, 我估计你是私设的网关吧,那必须配上IP,不然流量是不会到达的。
[18:44:22] <someone> 双网关。。。
[22:59:46] <someone> 又有问题了......
[23:00:39] <someone> ?
[23:01:50] <someone> 我用了好些lxde的组件,可是都是英文的,本来以为是中文的i18n没跟上,后来发现,源码下是有zh_CN.po的,但是emerge却不安装任何语言文件
[23:02:24] <someone> linguas?
[23:02:33] <someone> MeaCulpa: hi
[23:02:50] <someone> gogonkt: hi
[23:02:56] <someone> MeaCulpa, 我已经设置zh zh_CN了
[23:03:20] <someone> 用上了 echinus ,awesome 扔一邊了 :)
[23:03:27] <someone> gogonkt: 好用么?
[23:03:38] <someone> 不錯
[23:03:45] <someone> yafeng: 没看到lxde有啥USE...具体啥组建
[23:03:52] <someone> gogonkt: 我echinus进不去哦
[23:04:09] <someone> xinit怎么写?echinus?exec echinus?
[23:04:21] <someone> 你先试试pcmanfm吧.......
[23:04:25] <someone> 只是有的地方要小hacks 一下
[23:04:44] <someone> 係
[23:04:57] <someone> yafeng: 没有语言相关的USE
[23:05:13] <someone> MeaCulpa, 对啊.....
[23:05:40] <someone> MeaCulpa, 没有语言的USE就啥都不装么......
[23:05:47] <someone> 我下的source tarball ,make,make install
[23:05:49] <someone> 那就是说程序运行时自己解决支持问题,而不是编译时
[23:06:00] <someone> gogonkt: 你怎么进的echinus?
[23:06:11] <someone> exec echinus
[23:06:26] <someone> echinus ,ourico
[23:06:34] <someone> enough
[23:06:43] <someone> ourico什么东西
[23:07:13] <someone> #echinus)
[23:07:16] <someone> *) exec xfce4-panel& eval `cat $HOME/.fehbg`&
[23:07:27] <someone> (sleep 2;exec /usr/local/bin/ourico)&
[23:07:31] <someone> (sleep 10;exec conky -d &)&
[23:07:34] <someone> #exec stalonetray&
[23:07:37] <someone> exec /usr/local/bin/echinus
[23:07:41] <someone> ;;
[23:07:45] <someone> ...
[23:07:58] <someone> 卧式试看
[23:08:26] <someone> 其實就2行 :)
[23:08:32] <someone> exec /usr/local/bin/echinus
[23:08:36] <someone> MeaCulpa, 有办法装中文的mo么?
[23:08:45] <someone> exec /usr/local/bin/ourico
[23:08:55] <someone> MeaCulpa, 只能改ebuild文件了?
[23:10:17] <someone> 你把 po 扔目錄裏不就成了?
[23:13:02] <someone> gogonkt, 那是没有办法的办法啊,能emerge搞定的就不手工啊
[23:13:52] <someone> yafeng: * lxde [Mercurial ] (http://bitbucket.org/yngwin/lxde-o...)
[23:14:38] <someone> gogonkt, ?
[23:14:52] <someone> http://bitbucket.org/yngwin/lxde-overlay/
[23:14:54] <someone> yngwin / lxde-overlay / overview — bitbucket.org
[23:15:00] <someone> ...
[23:15:10] <someone> 有用麼?
[23:19:23] <someone> 可能你要改EBUILD了
[23:22:05] <someone> yafeng: https://bugs.gentoo.org/show_bug.cgi?id=281345
[23:22:11] <someone> Gentoo Bug 281345 - New LXDE configuration HOWTO
[23:22:14] <someone> BadGirl: https://bugs.gentoo.org/281345 "New LXDE configuration HOWTO"; Documentation, New Documentation; NEW; NathanZachary@g.o:docs-team@g.o
[23:22:18] <someone> Gentoo Bug 281345 - New LXDE configuration HOWTO
[23:22:18] <someone> Do I look like a freakin' infobot, Willikins?
[23:22:18] <someone> BadGirl: https://bugs.gentoo.org/281345 "New LXDE configuration HOWTO"; Documentation, New Documentation; NEW; NathanZachary@g.o:docs-team@g.o
[23:22:29] <someone> gogonkt, 我看了看lxde的overlay,也没语言的选项......
[23:25:24] <someone> why lxde?
[23:25:50] <someone> gogonkt, 快....
[23:29:22] <someone> ...
[23:30:20] <someone> echinus 还行...
[23:30:41] <someone> 那你改好了cc 一份給我,放到china overlay 裏,可以麼?
[23:31:42] <someone> 要我的 echinusrc 麼?
[23:33:17] <someone> 我只是copy了example...
[23:33:27] <someone> 自己没时间改阿...
[23:33:38] <someone> 你的看看,哈哈
[23:33:58] <someone> here: http://dpaste.com/96338/
[23:34:00] <someone> 这个Xdefault式的配置,看着不知道比awesome舒服多少
[23:34:01] <someone> dpaste: #96338: .echinus/echinusrc, by gogonkt
[23:34:36] <someone> 你看看 README :)
[23:34:45] <someone> 很有用
[23:36:29] <someone> en
[23:36:53] <someone> 我一直fluxbox,系统里没panel...
[23:37:06] <someone> 你用lxde的panel?
[23:38:54] <someone> exec xfce4-panel&
[23:39:42] <someone> o
[23:39:53] <someone> 有時用用菜單
[23:40:34] <someone> o
[23:49:02] <someone> gogonkt: 明明有ebuild么
[23:49:18] <someone> portage echinus
[23:50:13] <someone> ?
[23:50:39] <someone> 我覺得太老了
[23:52:50] <someone> o
[23:53:03] <someone> 9999 ebuild 伺候
[23:53:19] <someone> :D

生成了一个Blog内容缩略站...

BuzzBoost + Dropbox = Document Site of the Blog!

    利用FeedBurner的buzzboost功能,可以自动用feed生成HTML网页。这个把buzzboost生成网页的JS放进某html,再把那个html放进了我DropBox的public folder.
    如此一来,Dropbox就帮你host了一个缩略镜像站... 而除了帖子本身,可以加其他东西甚至widget, Post以外的CSS, Javascript之类,都可以随便搞...


懒得找hoster,懒得翻墙,也能看到我的blogspot内容,挺有趣...

从urandom取随机数

/*
  Read a random number from /dev/urandom
*/
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdlib.h>

#include <string.h>  /* for strerror(int errno) */
#include <errno.h>
extern int errno;

#define BUFS 4

/* Assumes ssize_t is 4 bytes on the system */

union U {
  ssize_t mlong;
  char c[4];
};

int main (void)
{
  int fp,n;
  char buf[BUFS+1];
  union U u;
  
  /*  /dev/random only returns bytes when enough noise has 
      been generated from the entropy pool. Hense you may 
      be blocked waiting. In contrast, /dev/urandom will always 
      return bytes. */
  if ((fp = open ("/dev/urandom", O_RDONLY)) == -1)
    {
      fprintf (stderr, "Can't open data: %s\n", strerror (errno));
      return 1;
    }

 if ( ( n=read(fp, buf, BUFS )) >=  4)
   {
     buf[n]='\0';
     u.c[0]=buf[0];
     u.c[1]=buf[1];
     u.c[2]=buf[2];
     u.c[3]=buf[3];

     // check sizes
     fprintf(stderr,"%u %d  sizeof(%d)  sizeof(%d)\n",u.mlong,n,sizeof(u.mlong),sizeof(u)); 
     printf("%u\n",u.mlong);
   }
 close(fp);

  return 0;
}

UNIX 管道操作小Demo

/* 摘自 
    "UNIX SYSTEMS Programming: Communication, 
    Concurrency, and Threads", by Kay a. Robbins, 
    and Steven Robbins. 第190页
*/

#include 
#include 
#include 
#include 

int main(void)
{
  pid_t childpid;
  int fd[2];

  if ((pipe(fd) == -1) || ((childpid = fork()) == -1)) {
    perror("failed to setup pipeline");
    return 1;
  }
  
  if (childpid == 0) {
    if (dup2(fd[1], STDOUT_FILENO) == -1)
      perror("Failed to redirect stdou of ls");
    else if ((close(fd[0]) == -1) || (close(fd[1]) == -1))
      perror("Failed to close extra pipe descriptors on ls");
    else {
      execl("/bin/ls","ls","-l", NULL);
      perror("Failed t exec ls");
    }
    return 1;
  }

  if (dup2(fd[0], STDIN_FILENO) == -1)
    perror("Failed to redirect stdin of sort");
  else if ((close(fd[0]) == -1) || (close(fd[1]) == -1))
    perror("Failed to close extra pipe file descriptors on sort");
  else {
    execl ("/bin/sort","sort", "-n","+4",NULL);
    perror("Faile dot exec sort");
  }
  return 1;
}

bti: 好用的linux CLI twitter/identica 客户端

找到个好用的CLI T/I 客户端:bti,直接输出结果,十分合适bash里pipe使用。
配合Privoxy 或者 GAPPProxy使用:

$bti --proxy 127.0.0.1:8118 --host twitter --account methuselar --password XXX --action friends
src在这里:

也适合武装上bot... 虽说python模块很成熟了, 有个C的现成玩意儿也不错...

irc.freenode.net #gentoo-cn log: 2009-09-18

[00:16:48] <someone> Some people here do ?
[00:17:13] <someone> 我还是找老外去。。。 这频没有人
[00:19:45] <someone> I was looking for foreigners to go!! Some people not here do!!
[00:20:53] <someone> = =!I enjoy speak english..
[00:21:50] <someone> ~~period
[00:21:50] <someone> period: 'pi2ri2d n. 时期,周期,时代,现代,当代;学时,课时,一节课;句号,结束a. 某一时代的
[01:02:28] <someone> sabayon...
[01:02:28] <someone> overlay 加上 scrotwm ,有人用麼?
[01:02:28] <someone> gogonkt, scrotwm 是虾米
[01:02:28] <someone> a wm - -b...
[01:02:29] <someone> 怎么安装twitter后找不到程序呢
[01:02:30] <someone> ~ims
[01:02:33] <someone> IMS相对指数 of Range1900: 智力 -0.45↓-0.62 情绪 0.98↓0.91 体力 0.14↓-0.12 (-1...1)
[01:02:36] <someone> 终于变得正常了 感冒 肌肉伤痛。。。
[01:02:38] <someone> ~ims
[01:02:41] <someone> IMS相对指数 of sunmoon1997: 智力 -0.54↑-0.37 情绪 0.00↑0.21 体力 0.41↓0.14 (-1...1)
[01:02:44] <someone> r0bertz, hi
[01:02:46] <someone> GNOME怎么就没好点的twitter?
[01:02:49] <someone> GNOME 有 twitter?
[01:02:51] <someone> Qwit?
[01:02:54] <someone> 错了,这个是QT的。
[01:02:56] <someone> 不是有个的么
[01:02:59] <someone> eix -S twitter
[01:03:01] <someone> hi anybody
[01:03:04] <someone> 有人没有?
[01:03:06] <someone>?
[09:18:42] <someone> 要读手机里面的micro sd卡,大家知道该怎么配置内核不?谢谢
[09:43:57] <someone> 早上好。。各位。。
[09:44:11] <someone> 目前我在纠结中。。。。。
[09:45:12] <someone> 桌面环境是用 KDE or Gnome or awsome
[09:47:54] <someone> 谁给推荐一个。
[09:49:06] <someone> 都试一下
[09:49:54] <someone> 恩,都试一下
[09:50:32] <someone> awesome 开发者就像小脚老太,整天着眼于小处,lua患得患失,用户体验毫无加强,唉
[09:50:55] <someone> 也难怪,谁叫咱懒得dwm xmonad
[09:52:25] <someone> MeaCulpa: xmonad 不错的
[09:52:35] <someone> 不过小屏幕,也用得不爽
[09:53:08] <someone> junmin: microCD 用读卡器,与一般usb没太大差别啊
[09:53:24] <someone> haskell挺恶心...
[09:53:28] <someone> MeaCulpa: fdisk -l 就是显示不出来
[09:53:35] <someone> 看到用语言做配置的WM就烦
[09:54:36] <someone> MeaCulpa: 现在是直接手机连接电脑,跟读卡器一样?
[09:54:51] <someone> 那就不一样了...

Finds all devices with quotas

/* 
Finds all devices with quotas.
*/

#include <stdio.h>
#include <stdlib.h>
#include <malloc.h>
#include <mntent.h>
#include <string.h>

FILE *setdev()
{
 FILE *fp;
 if ((fp = setmntent(MOUNTED, "r")) == NULL) {
  fprintf(stderr, "Error calling setmntent\n");
 }
 return fp;
}

int getdev(FILE * fp,char *device)
{
 struct mntent *mnt;
        char *p;
        char *h;

 while ((mnt = getmntent(fp)) != NULL) {
  if (hasmntopt(mnt, "usrquota")) {
    if ((h = hasmntopt(mnt,"loop=/dev/loop")) != NULL) {
                    snprintf(device,255,"%s",h+5);
      p=device;
                    while(*p++) {
        if ( *p == ',') {
   *p='\0';
   break;
        }}
    return strlen(device);
   } else {
     snprintf(device,255,"%s",mnt->mnt_fsname);
    return strlen(device);
   }
  }

 }
    
 return 0;
}

int main(void)
{
 FILE *fp;
 char device[256];

 if ((fp = setdev()) == NULL) {
  fprintf(stderr, "setdev returned NULL\n");
  exit(1);
 }

 while ( getdev(fp,device)) {
  printf("%s\n", device);

 }

 endmntent(fp);
 exit(0);
}

irc.freenode.net #gentoo-cn log: 2009-09-17

[00:01:54] <someone> sabayon...
[10:43:08] <someone> overlay 加上 scrotwm ,有人用麼?
[10:45:12] <someone> gogonkt, scrotwm 是虾米
[10:45:37] <someone> a wm - -b...
[10:51:05] <someone> 怎么安装twitter后找不到程序呢
[15:18:18] <someone> ~ims
[15:18:19] <someone> IMS相对指数 of Range1900: 智力 -0.45↓-0.62 情绪 0.98↓0.91 体力 0.14↓-0.12 (-1...1)
[15:18:41] <someone> 终于变得正常了 感冒 肌肉伤痛。。。
[15:40:15] <someone> ~ims
[15:40:16] <someone> IMS相对指数 of sunmoon1997: 智力 -0.54↑-0.37 情绪 0.00↑0.21 体力 0.41↓0.14 (-1...1)
[17:28:03] <someone> r0bertz, hi
[21:24:26] <someone> GNOME怎么就没好点的twitter?
[21:30:20] <someone> GNOME 有 twitter?
[21:37:20] <someone> Qwit?
[21:39:32] <someone> 错了,这个是QT的。
[21:46:36] <someone> 不是有个的么
[21:53:09] <someone> eix -S twitter
[23:44:40] <someone> hi anybody
[23:50:08] <someone> 有人没有?

getpwnam 结构

#include <stdio.h>
#include  <stdlib.h>
#include  <sys/types.h>
#include  <pwd.h>

int main(int argc, char **argv)
{
  struct passwd *pw;

  if(argc <= 1) {
      printf("./getpwuid  \n");
      return 0;
  }

  pw = getpwnam(argv[1]);
  if( pw != NULL ) {
    printf("User name %s\n",pw->pw_name);
    printf("user password %s\n",pw->pw_passwd);
    printf("user id %d\n",pw->pw_uid);
    printf("group id %d\n",pw->pw_gid);
    printf("real name %s\n",pw->pw_gecos);
    printf("home directory %s\n",pw->pw_dir);
    printf("shell program %s\n",pw->pw_shell);
 
  } else {
    printf("User not found!\n");
  }
  return 0;

}

惊闻"黑车门", 杂想

    黑车...我也坐过一回的...
    以后知道了,千万别搭载不认识的人。
    还有以后路边那些举着【带路】牌子的人,恐怕要加一个【不要钱】的声明了!
    由此想到了卖淫嫖娼,这个活动在我国大多数是不开发票的,居然电视里严打的镜头展现的是捉奸在床?!不合逻辑...
    完全没有法律依据么!!既然没有发票,那就没有物证能证明买卖关系,那警方唯一的突破口就是从业者了...警娼一家啊!所以做人要自重,不要去光顾那些业内人士,她们可都是"倒钩"呢!相比之下还是抓黑车的讲证据,卧底的干活...
  
       我国真该把这些灰色行业监管起来,现在说是说不许,但却仍然乌烟瘴气,一样给社会造成负面影响,何不好好把关,妥善管理,增加点财政收入呢

    我国领导对电视、网络等媒体,似乎是监管色情的力度大于暴力,那些恐怖的“法制节目”,在黄金时段大行其道,同时,青少年也仍旧可随便买到烟酒之类...领导们认为性生活危害大于抽烟喝酒,大于不分级的影视节目,大于赤裸裸展现凶杀现场的法制节目, 不知是基于怎样的生活阅历得出的结论!

A simple ls

#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <dirent.h>
#include <unistd.h>

int main(int argc, char *argv[])
{
  DIR *dp;
  struct dirent *dirp;

  if (argc != 2)
    {
      fprintf(stderr,"usage: ls dir_name\n");
      exit(EXIT_FAILURE);
    }

  if ((dp = opendir(argv[1])) == NULL)
    {
      fprintf(stderr,"cannot open %s\n",argv[1]);
      exit(EXIT_FAILURE);
    }    

  while ((dirp = readdir(dp)) != NULL)
    printf("%s type=%d\n", dirp-&gt;d_name,dirp-&gt;d_type);

  closedir(dp);

  exit(EXIT_SUCCESS);
}

Simple gdbm demo

Taken from CPearls
/*
  Simple gdbm example.

  This is how you compile

      $ gcc gdbm_ex1.c -lgdbm -o gdbm_ex1

  Format of the datum struct:

      typedef struct {
                 char *dptr;
                 int  dsize;
              } datum;
*/
#include 
#include 

int main (void)
{
  GDBM_FILE dbf;
  datum key = { "testkey", 7 };     /* key, length */
  datum value = { "testvalue", 9 }; /* value, length */
  datum content;

  printf ("Storing key-value pair... ");
  dbf = gdbm_open ("test", 0, GDBM_NEWDB, 0644, 0);
  gdbm_store (dbf, key, value, GDBM_INSERT);
  gdbm_close (dbf);

  dbf = gdbm_open ("test", 0, GDBM_READER, 0644, 0);
  content = gdbm_fetch(dbf, key);
  printf("\n Output %s\n",content.dptr);
  printf ("done.\n");
  gdbm_close (dbf);

  return 0;
}

Linux signal 目录小监控

/*
   notify if anything is modified in the current directory
*/

#define _GNU_SOURCE
#include 
#include 
#include 
#include 

static volatile int event_fd;
static volatile int event_sig;
static volatile void *event_data;

static void handler(int sig, siginfo_t *si, void *data)
{
  event_fd = si->si_fd;
  event_sig = sig;
  event_data = data;
}

int main(void)
{
  struct sigaction act;
  int fd;

  act.sa_sigaction = handler;
  sigemptyset(&act.sa_mask);
  act.sa_flags = SA_SIGINFO;
  sigaction(SIGRTMIN + 1, &act, NULL);

  fd = open(".", O_RDONLY);
  fcntl(fd, F_SETSIG, SIGRTMIN + 1);
  fcntl(fd, F_NOTIFY, DN_ACCESS|DN_MODIFY|DN_CREATE|DN_RENAME|DN_DELETE|DN_ATTRIB|DN_MULTISHOT);
  
  while (1) {
    pause();
    printf("Sth happened on fd=%d\n", event_fd);
  }
}

3 Weeks and he really meant to GRIN... without teeth

 
 For more of my son:
.or.

唉,他妈生他的时候在待产室看[蜡笔小新]...

  唉,偶儿子这小脸蛋...

A Left Node Right (LNR) linked list - Learning note

/*  
A Left Node Right (LNR) linked list.
*/
#include 
#include 

struct linked_list {
 double item;
 struct linked_list *left;
 struct linked_list *right;
};

void insert_left(struct linked_list **main_list, double item_to_insert)
{
 struct linked_list *new_item;
 new_item = malloc(sizeof(struct linked_list));
 if (new_item == NULL) {
  fprintf(stderr, "Out of memory: insert_left\n");
  exit(1);
 }
 new_item->item = item_to_insert;
 if (*main_list == NULL) {
  new_item->left = NULL;
  new_item->right = NULL;
  *main_list = new_item;
 } else {
  new_item->left = (*main_list)->left;
  new_item->right = NULL;
  (*main_list)->left = new_item;
 }
}

void insert_right(struct linked_list **main_list, double item_to_insert)
{
 struct linked_list *new_item;
 new_item = malloc(sizeof(struct linked_list));
 if (new_item == NULL) {
  fprintf(stderr, "Out of memory: insert_right\n");
  exit(2);
 }
 new_item->item = item_to_insert;
 if (*main_list == NULL) {
  new_item->left = NULL;
  new_item->right = NULL;
  *main_list = new_item;
 } else {
  new_item->left = NULL;
  new_item->right = (*main_list)->right;
  (*main_list)->right = new_item;
 }

}

void print_LNR(struct linked_list *main_list)
{
 if (main_list == NULL)
  return;
 print_LNR(main_list->left);
 printf("%f\n", main_list->item);
 print_LNR(main_list->right);

}

void print_NLR(struct linked_list *main_list)
{
 if (main_list == NULL)
  return;
 printf("%f\n", main_list->item);
 print_NLR(main_list->left);
 print_NLR(main_list->right);
}

void print_LRN(struct linked_list *main_list)
{
 if (main_list == NULL)
  return;
 print_LRN(main_list->left);
 print_LRN(main_list->right);
 printf("%f\n", main_list->item);
}

void free_LRN(struct linked_list *main_list)
{
 if (main_list == NULL)
  return;
 free_LRN(main_list->left);
 free_LRN(main_list->right);
 /*  printf("%f\n",main_list->item);   */
 free(main_list);
 main_list = NULL;

}

int main()
{
 struct linked_list *main_list = NULL;
 insert_right(&main_list, 0.0);
 insert_left(&main_list, -5);
 insert_right(&main_list, 5);

 print_LRN(main_list);
 free_LRN(main_list);

 return 0;
}

A regular expression parser example in "Beautiful Code" [978-0-596-51004-6]

/*
  This is the program that appears in Ch1 of ("Beautiful Code", 
  edited by Andy Oram and Greg Wilson. Copyright 2007 O'Reilly Media, 
  Inc., 978-0-596-51004-6.) which is a working regular expression 
  example written by Rob Pike.

  Regular Expression Matcher for the following:

  c Matches any literal character
  . Matches a single character
  ^ Beginning character
  $ Matches the end of an input string
  * Zero or more characters
 */

#include 
#include 

int match(char *regexp, char *text);
int matchhere(char *regexp, char *text);
int matchstar(int c, char *regexp, char *text);

/* match: search for regexp anywhere in text */
int match(char *regexp, char *text)
{
 if (regexp[0] == '^')
  return matchhere(regexp + 1, text);
 do {   /* must look even if string is empty */
  if (matchhere(regexp, text))
   return 1;
 } while (*text++ != '\0');
 return 0;
}

/* matchhere: search for regexp at beginning of text */
int matchhere(char *regexp, char *text)
{
 if (regexp[0] == '\0')
  return 1;
 if (regexp[1] == '*')
  return matchstar(regexp[0], regexp + 2, text);

 if (regexp[0] == '$' && regexp[1] == '\0')
  return *text == '\0';
 if (*text != '\0' && (regexp[0] == '.' || regexp[0] == *text))
  return matchhere(regexp + 1, text + 1);
 return 0;
}

/* matchstar: search for c*regexp at beginning of text */
int matchstar(int c, char *regexp, char *text)
{
 do {   /* a * matches zero or more instances */
  if (matchhere(regexp, text))
   return 1;
 } while (*text != '\0' && (*text++ == c || c == '.'));
 return 0;
}

int main(void)
{
  if (match("ab*", "one two three ab")) {
  printf("Match\n");
  return 1;
  }
  else {
  printf("No Match\n");
  return 0;
  }
}

Dumping svn repository

Dumping a svn is so easy... I made a windows batch:
@echo off  

call :svndump %DATE:~0,10% reponame
goto :EOF  

:svndump
setlocal
echo [%1%] >> log_backup.txt
echo %TIME% dumping [%2%] start >> log_backup.txt

if not exist %1 mkdir %1
"svnadmin.exe" dump Path\To\Svnrep\%2 > %1\%2.dmp
echo dump success, start compressing... >> log_backup.txt
"7z.exe" a %1\%2.dmp.7z %1\%2.dmp
del /F %1\%2.dmp >> log_backup.txt

echo %TIME% dumping [%2%] finished >> log_backup.txt
echo. >> log_backup.txt
endlocal
goto :EOF  
Windows batch... have to work with windows...Batch is not bad with basic flow control and "mimiced" function call, anyway. After equipped with Gnuwin32.

对Python List 进行 quick sort 竟如此简单明了...

挺让我意外的Python list comprehensions... 简单,自然的List QuickSort实现:
from random import randrange       
def qsortlist(list):
    """
    Quicksort using list comprehensions and randomized pivot
    """
    def qsort(list):
        if list == []: 
            return []
        else:
            pivot = list.pop(randrange(len(list)))
            lesser = qsort([l for l in list if l < pivot])
            greater = qsort([l for l in list if l >= pivot])
            return lesser + [pivot] + greater
    return qsort(list[:])
如此清晰,简便的快速排序...虽然性能肯定远不如一般的C,C++之类的实现,但是鉴于这是针对list的排序,应用广阔而方便,python的数字计算能力也不差, 又有不错的随机数生成器。 C的话要提供比较方法,C++的话要用模板类来推广,而我自认为C/C++水平远不及Python解释器. C的那些存储,赋值,等小数据处理操作一不小心性能就被拉下去了... 所以懒惰的我觉得这也算是挺实用的,比如英文姓名排序...

Perform a Sleep() in windows batch

Need a sleep() in Windows Batch? Here are the ways...

1. ping yourself!
SET SLEEP=ping 127.0.0.1 -n
%SLEEP% 11 > nul

2. awesome TIME calculation from here
    @ECHO OFF
    SETLOCAL EnableExtensions
    CALL :ProcDelay 200
    ECHO %TIME%
    GOTO :EOF

    :ProcDelay delayMSec_
    SETLOCAL EnableExtensions
    FOR /f "tokens=1-4 delims=:. " %%h IN ("%TIME%") DO SET start_=%%h%%i%%j%%k
        :_procwaitloop
        FOR /f "tokens=1-4 delims=:. " %%h IN ("%TIME%") DO SET now_=%%h%%i%%j%%k
        SET /a diff_=%now_%-%start_%
    IF %diff_% LSS %1 GOTO _procwaitloop
    ENDLOCAL & GOTO :EOF
    :EOF

3. windows2003 now provide "timeout" command.

Send mail(smtp) in Python

# -*- coding: utf-8 -*-
import sys
import os
from time import strftime, localtime
import getopt
import smtplib
from email.MIMEText import MIMEText
from optparse import OptionParser

__version__ = u'0.0.1'
__author__ = u'MeaCulpa '
__all__ = [u'sendmail']

CHARSET = 'utf8'

def main(argv=None):

    default_input = os.path.join(os.getcwd(), u'test', u'testmail.txt')
    RECIPIENT = ''
    
    # parse commandline options
    optparse = OptionParser(version=__version__)
                        
    optparse.add_option('-i', '--inputfile',
                        dest = "inputfile",
                        metavar = "FILE",
                        default = default_input,
                        help = "file to post content to e-mail")
                        
    optparse.add_option('-r', '--recipient',
                        dest = "recipient",
                        default = RECIPIENT,
                        help = "e-mail recipient")   

    optparse.add_option("-q", "--quiet",
                        action = "store_false", 
                        dest = "verbose", 
                        default = True,
                        help = "don't print status messages to stdout")

    opts, args = optparse.parse_args()

    if args:
        optparse.error(u'invalid arguments')

    # if no option print help()
    if len(sys.argv) == 1:
        optparse.print_help()
    else:
        doRealThings(args)    
        sendmailfromfile(opts.inputfile, opts.recipient)

def doRealThings(args):
    print "---" + strftime(u' %Y-%m-%d %H:%M:%S ', localtime()) + "---"
    
def sendmailfromfile(filename, recipient):

    smtpserver = ''
    AUTHREQUIRED = 1 # if need to use SMTP AUTH set to 1
    SENDER = ''    
    # for SMTP AUTH, set SMTP username here
    smtpuser = ''
    # for SMTP AUTH, set SMTP password here
    smtppass = ''
                                           
    # Set up a MIMEText object (it's a dictionary)
    mmsg = open(filename, 'r').read()
    msg = MIMEText(mmsg, 'plain', CHARSET)

    # Can use add_header or set headers directly ...
    msg['Subject'] = 'Automated mail: ' + strftime(u'%Y-%m-%d', localtime()) + ' GMT+8'
    # Following headers are useful to show the email correctly
    # in your recipient's email box, and to avoid being marked
    # as spam. They are NOT essential to the snemail call later
    msg['From'] = SENDER
    msg['Reply-to'] = SENDER
    msg['To'] = recipient  

    # Establish an SMTP object and connect to your mail server
    s = smtplib.SMTP(smtpserver)
#        s = smtplib.SMTP_SSL(smtpserver)
    # Send the email - real from, real to, extra headers and content ...
    if AUTHREQUIRED:
        s.login(smtpuser, smtppass)
    print "Posting: " + filename
    print "     to: " + recipient
    smtpresult = s.sendmail(SENDER,recipient, msg.as_string())
    s.close()
    if smtpresult:
      errstr = ""
      for recip in smtpresult.keys():
          errstr = """Could not delivery mail to: %s"""
      print u' Result: failed! ' + errstr
    else:
        print u' Result: success!'

if __name__ == "__main__":
    sys.exit(main())

Fetch pop3 email using Python

# -*- coding: utf-8 -*-
import poplib
import email
import email.Parser
import email.header
import os
import sys
import base64
from optparse import OptionParser

__version__ = u'0.0.1'
__author__ = u'MeaCulpa '
__all__ = [u'fetchmail']

class email_attachment:
    def __init__(self, messagenum, attachmentnum, filename, contents):
        '''
        arguments:
            messagenum - message number of this message in the Inbox
            attachmentnum - attachment number for this attachment
            filename - filename for this attachment
            contents - attachment's contents
        '''
        self.messagenum=messagenum
        self.attachmentnum=attachmentnum
        self.filename=filename
        self.contents=contents
        return

    def save(self, savepath, savefilename=None):
        '''
        Method to save the contents of an attachment to a file
        arguments:
            savepath - path where file is to be saved
            safefilename - optional name (if None will use filename of attachment
        '''

        savefilename=savefilename or self.filename
        f=open(os.path.join(savepath, savefilename),"wb")
        f.write(self.contents)
        f.close()
        return

class email_msg:
    def __init__(self, messagenum, contents):
        self.messagenum=messagenum
        self.contents=contents
        self.attachments_index=0  # Index of attachments for next method
        self.ATTACHMENTS=[]       # List of attachment objects

        self.msglines='\n'.join(contents[1])
        #
        # See if I can parse the message lines with email.Parser
        #
        self.msg=email.Parser.Parser().parsestr(self.msglines)
        if self.msg.is_multipart():
            attachmentnum=0
            for part in self.msg.walk():
                # multipart/* are just containers
                mptype=part.get_content_maintype()
                filename = part.get_filename()
                if mptype == "multipart": continue
                if filename: # Attached object with filename
                    attachmentnum+=1
                    self.ATTACHMENTS.append(email_attachment(messagenum, attachmentnum, filename, part.get_payload(decode=1)))
                    print "Attachment filename=%s" % filename

                else: # Must be body portion of multipart
                    self.body=base64.b64decode(part.get_payload())

        else: # Not multipart, only body portion exists
            self.body=base64.b64decode(self.msg.get_payload())

        return


    def get(self, key):
        try: return self.msg.get(key)
        except:
            emsg="email_msg-Unable to get email key=%s information" % key
            print emsg
            sys.exit(emsg)

    def has_attachments(self):
        return (len(self.ATTACHMENTS) > 0)

    def __iter__(self):
        return self

    def next(self):
        #
        # Try to get the next attachment
        #
        try: ATTACHMENT=self.ATTACHMENTS[self.attachments_index]
        except:
            self.attachments_index=0
            raise StopIteration
        #
        # Increment the index pointer for the next call
        #
        self.attachments_index+=1
        return ATTACHMENT

class pop3_inbox:
    def __init__(self, server, userid, password):
        self._trace=0
        if self._trace: print "pop3_inbox.__init__-Entering"
        self.result=0             # Result of server communication
        self.MESSAGES=[]          # List for storing message objects
        self.messages_index=0     # Index of message for next method
        #
        # See if I can connect using information provided
        #
        try:
            if self._trace: print "pop3_inbox.__init__-Calling poplib.POP3(server)"
            self.connection=poplib.POP3(server)
            if self._trace: print "pop3_inbox.__init__-Calling connection.user(userid)"
            self.connection.user(userid)
            if self._trace: print "pop3_inbox.__init__-Calling connection.pass_(password)"
            self.connection.pass_(password)

        except:
            if self._trace: print "pop3_inbox.__init__-Login failure, closing connection"
            self.result=1
            self.connection.quit()

        #
        # Get count of messages and size of mailbox
        #
        if self._trace: print "pop3_inbox.__init__-Calling connection.stat()"
        self.msgcount, self.size=self.connection.stat()
        #
        # Loop over all the messages processing each one in turn
        #
        for msgnum in range(1, self.msgcount+1):
            self.MESSAGES.append(email_msg(msgnum, self.connection.retr(msgnum)))

        if self._trace: print "pop3_inbox.__init__-Leaving"
        return

    def close(self):
        self.connection.quit()
        return

    def remove(self, msgnumorlist):
        if isinstance(msgnumorlist, int): self.connection.dele(msgnumorlist)
        elif isinstance(msgnumorlist, (list, tuple)):
            map(self.connection.dele, msgnumorlist)
        else:
            emsg="pop3_inbox.remove-msgnumorlist must be type int, list, or tuple, not %s" % type(msgnumorlist)
            print emsg
            sys.exit(emsg)

        return

    def __iter__(self):
        return self

    def next(self):
        #
        # Try to get the next attachment
        #
        try: MESSAGE=self.MESSAGES[self.messages_index]
        except:
            self.messages_index=0
            raise StopIteration
        #
        # Increment the index pointer for the next call
        #
        self.messages_index+=1
        return MESSAGE

if __name__=="__main__":
    
    # parse commandline options
    optparse = OptionParser(version=__version__)
                        
    optparse.add_option('-s', '--server',
                        dest = 'server',
                        default = '',
                        help = 'smtp server')
                        
    optparse.add_option('-u', '--userid',
                        dest = 'userid',
                        default = '',
                        help = 'smtp userid')   

    optparse.add_option('-p', '--password',
                        dest = 'password', 
                        default = '',
                        help = 'smtp password')

    opts, args = optparse.parse_args()

    if args:
        optparse.error(u'invalid arguments')
        sys.exit()

    #if in-sufficient option print help
    if len(sys.argv) < 3:
        optparse.print_help()
        sys.exit()

    inbox=pop3_inbox(opts.server, opts.userid, opts.password)
    if inbox.result:
        emsg="Failure connecting to pop3_inbox"
        print emsg
        sys.exit(emsg)

    print "Message count=%i, Inbox size=%i" % (inbox.msgcount, inbox.size)

    counter=0
    for m in inbox:
        counter+=1
        print "Subject: %s" % email.header.decode_header(m.get('subject'))[0][0]
        print "-------------Message (%i) body lines---------------" % counter
        print m.body
        print "-------------End message (%i) body lines-----------" % counter
        if m.has_attachments():
            acounter=0
            for a in m:
                acounter+=1
                print "-------------Message (%i) attachments-------------" % counter
                print "%i: %s" % (acounter, a.filename)
                print "-------------End message (%i) attachments---------" % counter
                a.save(os.path.join(os.getcwd(), u'tmp'))

        else: print "-------------Message has no attachments----------"

    inbox.close()

Simple indent Normalizer

# -*- coding: utf-8 -*-
#!/usr/bin/env python

"""Try to standalize indentation"""

import sys
import re
from collections import defaultdict

INDENT = 4  # what we should set it to

_whitespace_re = re.compile(r'\s*')
_blank_re = re.compile(r'^\s+$')

class RedentError(Exception):
    pass

def main():
    data = sys.stdin.read()
    if u'\t' in data:
        raise RedentError(u'omg tabs detected, fix that before running this')
    lines = data.splitlines()
    changes = defaultdict(int)
    last_indent = None
    parsed = []
    for line in lines:
        line = _blank_re.sub(u'', line)
        indent = len(_whitespace_re.match(line).group(0))
        tail = line[indent:]
        parsed.append((indent, tail))
        if last_indent is not None:
            change = last_indent - indent
            if change < 0:
                change *= -1
            if change:
                changes[change] += 1
        last_indent = indent
    changes = sorted(changes.iteritems(), key=lambda item: item[1],
                     reverse=True)
    detected_indent = changes[0][0]
    if detected_indent == INDENT:
        raise RedentError(u'no work needs to be done, indent level is same')
    for i, line in enumerate(parsed):
        indent, tail = line
        if indent % detected_indent:
            raise RedentError(u'uneven indentation detected')
        level = indent / detected_indent
        print (u' ' * INDENT * level) + tail
    return 0

if __name__ == u'__main__':
    sys.exit(main())

Simple HTML cleaner

# -*- coding: utf-8 -*-
#!/usr/bin/env python
'''
Cleansing HTMLs
'''

import sys
from optparse import OptionParser
import re
import os

newline = re.compile(r'[\r\n]+')
tag = re.compile(r'^\s*<(/?)(\w+).*?(/?)>$', re.DOTALL)
sw = 2
noindent = ('br',)

def clean(filename):
    fo = open(filename, 'rb')
    try:
        data = fo.read()
    finally:
        fo.close()
    data = newline.sub('\n', data)
    data = data.replace('>', '>\n')
    data = data.replace('<', '\n<')
    data = data.splitlines()
    new = []
    for line in data:
        line = line.strip()
        if len(line):
            new.append(line)
    data = new
    new = []
    ilevel = 0
    for line in data:
        padding = ' ' * (sw * ilevel)
        line = padding + line
        try:
            close1, tagname, close2 = tag.search(line).groups()
            if close2 or tagname.lower() in noindent:
                pass
            elif close1:
                if ilevel:
                    ilevel -=1
                    padding = ' ' * (sw * ilevel)
                    line = padding + line.strip()
            else:
                ilevel += 1
        except:
            pass
        new.append(line)
    data = '\n'.join(new) + '\n'
    sys.stdout.write(data)


def main():
    op = OptionParser()
    opts, args = op.parse_args()
    for filename in args:
        clean(filename)

    return 0

if __name__ == '__main__':
    sys.exit(main())

Simple python code format cleaner

This simple script helps me fix indentions:
# -*- coding: utf-8 -*-
#!/usr/bin/env python

import sys

def main():
    assert len(sys.argv) == 2, u'need a filename'
    f = open(sys.argv[1], u'rb')
    try:
        data = f.read()
    finally:
        f.close()

    lines = data.splitlines()
    lines = map(lambda x: x.rstrip(), lines)
    lines = filter(lambda x: len(x), lines)
    lines.reverse()

    fixed = []
    for line in lines:
        fixed.append(line)
        if line.strip().startswith(u'def '):
            fixed.append(u'')
        elif line.strip().startswith(u'class '):
            fixed += [u'', u'']
    fixed.reverse()

    print u'\n'.join(fixed)

    return 0

if __name__ == u'__main__':
    sys.exit(main())

Sabayon Linux CoreCD!

 http://www.sabayonlinux.org/pages/show/id/88
    Nice for those who don't wanna read Gentoo Handbook or who don't like compiling from the right start.
    I personally use Sabyon as a Gentoo Installer. Gets rid of entropy ASAP but... 
    Sabayon IS a great work. The installer, the config, the scripts, a nice kernel sourceset.
    Gentooers should have Sabyaon overlay!

用了把新浪微博

用了把新浪微博,很强大的用户基数,很商业化的氛围...
现在还比较原始,不知道言论泛滥后,过滤和监控工作如何,呵呵...

The Equation of our life

MINUS
 
EQUALS

祝贺我国局域网建设取得阶段性成果

Google 整个被端掉了,终于到了这一天...
大家目前情绪稳定。网络环境健康了,空气清新了,接踵而来的一定是带宽的提升,与朝鲜的对接等等...

Convert video for iphone using ffmpeg

I've had luck on making iPhone/iPodTouch compatible movies using x264 with ffmpeg yesterday:
#!/bin/sh
ffmpeg -r 29.97 -vcodec libx264 -flags +loop -cmp +chroma -deblockalpha 0 -deblockbeta 0 -crf 21 -bt 256k -refs 1 -coder 0 -me_method full -me_range 16 -subq 5 -partitions +parti4x4+parti8x8+partp8x8 -g 250 -keyint_min 25 -level 30 -trellis 2 -sc_threshold 40 -i_qfactor 0.71 -s 480x320 -aspect 16:9 -acodec libfaac -ab 112kb -ar 48000 -ac 2 -i "$1" "$2"
Cool!

Aria2c 还有Windows版,爽!

方便好用的Aria2有windows binary. 好用的很
http://aria2.sourceforge.net/

原本gentoo更新利用它多源下载的特性,现在Windows里也能用咯,和FlashGet说拜拜了~~
| More

Twitter Updates