Thursday, May 14, 2009


* 2009 La Casa della Musica, Parma, Italy - Website, A/V Streams & Slides

LAC (Linux Audio Conference) is held annually and this year it was in Italy in April, and from its papers and slides, it can be observed that frugal may be the next right direction.

Sunday, May 10, 2009

之前写过一篇 Blog
这里,能找到这个系列又多了一个
  1. Karmic Koala (命运的树袋熊) 9.10 Released in October 2009
最近又发现了一系列有意思的名字,就是 Linux 内核的发布代号:

这个代号隐藏于 每一内核发布的 Makefile 文件中,第5行是

git show v2.6.30-rc5:Makefile |head -n5
VERSION = 2
PATCHLEVEL = 6
SUBLEVEL = 30
EXTRAVERSION = -rc5
NAME = Vindictive Armadillo


其中 Vindictive Armadillo (怀恨的犰狳) 就是了。

倒推过来是
  1. v2.6.30 Vindictive Armadillo (怀恨的犰狳) (Not Released Yet)
  2. v2.6.29 Temporary Tasmanian Devil (临时的 Tasmanian 恶魔)
  3. v2.6.28 Erotic Pickled Herring ()
  4. v2.6.27 Rotary Wombat ()
  5. v2.6.26 Rotary Wombat
  6. v2.6.25 Funky Weasel is Jiggy wit it
  7. v2.6.24 Arr Matey! A Hairy Bilge Rat!
  8. v2.6.23 Arr Matey! A Hairy Bilge Rat!
  9. v2.6.22 Holy Dancing Manatees, Batman!
  10. v2.6.21 Nocturnal Monster Puppy
  11. v2.6.20 Homicidal Dwarf Hamster
  12. v2.6.19 Avast! A bilge rat!
  13. v2.6.18 Avast! A bilge rat!
  14. v2.6.17 Crazed Snow-Weasel
  15. v2.6.16 Sliding Snow Leopard
  16. v2.6.15 Sliding Snow Leopard
  17. v2.6.14 Affluent Albatross
  18. v2.6.13 Woozy Numbat
  19. v2.6.12 Woozy Numbat
  20. v2.6.11 Woozy Numbat

Friday, May 08, 2009

A simple way with curl to post code snippet to ubuntu paste:


$ curl -v -d 'poster=chengrq&syntax=python' --data-urlencode 'content@/home/gektop/bin/diff-filter' http://paste.ubuntu.com
* About to connect() to paste.ubuntu.com port 80 (#0)
* Trying 91.189.90.174... connected
* Connected to paste.ubuntu.com (91.189.90.174) port 80 (#0)
> POST / HTTP/1.1
> User-Agent: curl/7.18.2 (x86_64-pc-linux-gnu) libcurl/7.18.2 OpenSSL/0.9.8j zlib/1.2.3
> Host: paste.ubuntu.com
> Accept: */*
> Content-Length: 3002
> Content-Type: application/x-www-form-urlencoded
> Expect: 100-continue
>
< HTTP/1.1 100 Continue
< HTTP/1.1 302 Found
< Date: Fri, 08 May 2009 01:29:08 GMT
< Server: Apache/2.2.8 (Ubuntu) mod_python/3.3.1 Python/2.5.2 mod_ssl/2.2.8 OpenSSL/0.9.8g mod_perl/2.0.3 Perl/v5.8.8
< Location: /166435/
< Content-Length: 0
< Content-Type: text/html; charset=utf-8
<
* Connection #0 to host paste.ubuntu.com left intact
* Closing connection #0

I need a diff (or patch) manipulation utility, but unfortunately I have not found one, then I wrote one, of course, it's in Python.



#!/usr/bin/python

import sys, os

# Usage: diff-filter [-v] path1 path2 ...
# <INPUT >OUTPUT
if len(sys.argv) <= 1:

print "Usage: %s [-v] path1 path2 ... <INPUT" % \
os.path.basename(sys.argv[0])

sys.exit(1)

# some global variables
inChunk = True

strip = 1
matched = False
buffer = ''

invert = False

# to invert the filter
if sys.argv[1] == '-v':

invert = True
del sys.argv[1]

# the main filter
while True:
line = sys.stdin.readline()

if not line:
break

if line.startswith("--- ") or \
line.startswith("diff") or \
line.startswith("Binary") or \
line.startswith("Index"):

matched = False
inChunk = False

if line.startswith("diff") or \
line.startswith("Binary") or \
line.startswith("Index"):

buffer += line
continue
else:
path = line.split()[1]

slash = path.find('/')
path = path[slash+1:]

for arg in sys.argv[1:]:
if path.startswith(arg):

matched = True
break
else:
matched = False

if invert:
matched = not matched
if not matched:

buffer = ''

if inChunk:
print line,

if matched:
if buffer:
print buffer,

buffer = ''
print line,


It also can be reached by the ubuntu paste service:



http://paste.ubuntu.com/166435/

Application field: if you have a big diff generated by "diff -R", and want to split it according to some seperate path or components, you can use this. Happy hacking!

Monday, March 30, 2009

Albert H. Einstein

When I was a fairly precious young man, the nothingness of the hopes and strivings that chases most men restlessly through life came to my consciousness with considerable vitality.
Moreover I soon discovered the cruelty of that chase, which in those years was much more carefully covered up by hypocrisy and glitterings words than is the case today.
By the mere existence of the stomach everyone was condemned to participate in that chase.

To the great Albert.

Tuesday, January 20, 2009

登记 gnupg 公钥

PGP/GPG 公钥和私钥对是很多场合都要求的认证机制,

PGP/GPG public key (not an SSH key)


既然如此,那就做一个吧:

安装一个最新版本的 gnupg:

$ emerge =app-crypt/gnupg-2.0.9-r1
$ gpg --gen-key


此过程一系列问题,姓名、电邮、Comment,最后生成的ID的形式是:



"Name (Comment) "


做好了之后,就传到服务器上去吧,当然传送的是公钥了,私钥是不以任何方式泄漏的;

$ gpg --list-keys
$ gpg --export --armor
$ gpg --keyserver hkp://keys.gnupg.net --keyserver-options debug --send-keys f9b0925b
$ gpg --keyserver hkp://keys.gnupg.net --keyserver-options debug --send-keys f9b0925b
gpg: sending key F9B0925B to hkp server keys.gnupg.net
gpgkeys: curl version = libcurl/7.18.2 OpenSSL/0.9.8j zlib/1.2.3
* About to connect() to keys.gnupg.net port 11371 (#0)
* Trying 86.59.21.34... * Timeout
* Trying 129.128.98.22... * connected
* Connected to keys.gnupg.net (129.128.98.22) port 11371 (#0)
> POST /pks/add HTTP/1.1
Host: keys.gnupg.net:11371
Accept: */*
Content-Length: 1956
Content-Type: application/x-www-form-urlencoded
Expect: 100-continue

* HTTP 1.0, assume close after body
< HTTP/1.0 200 OK
< Server: sks_www/1.0.10
< Content-type: text/html; charset=UTF-8
<
* Closing connection #0


http://www.kernel.org/faq/#account

缺省传送的是 hkp://keys.gnupg.net 服务器,在 ~/.gnupg/gpg.conf 文件中,也提示了其它传送方式,包括发送邮件的形式;因为上面这样的传送有时会失败,如 "86.59.21.34... * Timeout" 。

这个 hkp 访问协议从上面的传送过程也可以看出来,实际上就是一个在非标准端口运行的 http 服务器,提交的过程实际就是 http 表单的提交,既然知道了它在使用 11371 端口号,当然也可以使用浏览器来访问了,如:

http://keys.gnupg.net:11371/pks/lookup?search=0xf9b0925b

Monday, January 19, 2009

2098, "Hello, World!"

2098-hello-world.png

Saturday, January 10, 2009

黄油文件系统(Btrfs)与南瓜文件系统(Squashfs)

黄油文件系统(Btrfs)是Linux下一代文件系统,具有很多先进的文件系统特性,在2008年9月份的内核峰会上已讨论决定在2.6.29合并入主流内核,现在正是2.6.29的rc开放时期(为期两周),linus在昨天刚刚把它合并进去了~

http://lkml.org/lkml/2008/12/31/85

使用Btrfs的方法详见wiki站点:

http://btrfs.wiki.kernel.org/index.php/Main_Page

可以这么评价吧:
1. Solaris曾经有最后两根救命稻草是DTrace探测工具和ZFS文件系统,现在在Linux上有了带utrace内核的Systemtap和Btrfs文件系统,Solaris操作系统再也没有任何优势了,

另外,在这个页面还包含了很多Btrfs的许多创意想法,有已实现和正在实现的,包括在文件系统层次的RAID5,6:

http://btrfs.wiki.kernel.org/index.php/Project_ideas

南瓜文件系统(Squashfs)可能就更熟悉了,它采用gzip或lamz(更高压缩率)来制作只读的映像文件,常见于各发行版的LiveCD光盘中,也在今天早上(UTC时间1月9日凌晨)刚刚合并入主流内核(linus的mainstream内核)

http://marc.info/?l=linux-kernel&m=123153961726343&w=2

关于Squashfs的合并之路,倒不是一帆风顺的:
1. 其作者 Phillip Lougher 在这个线索中提到,在过去的数个月(据我观察有两三年了)中,他不停地接到用户的抱怨说为什么Squashfs停止了开发,于是在六个月前, Phillip 辞掉工作,专职为 Squashfs 开发,直到前不久,在与 Andrew Morton 的一次讨论中, Andrew 觉得可以合并进入 linux-next-for-2.6.31 的分支,但这个过程仍然很漫长,(根据3个月的规则,还至少需要七八个月)。 Phillip 已经6个月没有工作,对此已尽乎绝望,希望能尽快合并入主流,可以重新去找份工作,挣点钱。
2. 接下来的回复中,有两种观点;一种常规的观点是文件系统不是一般的驱动程序,是不能贸然合并的,这是传统的观点; Andrew 也是基于此观点认为 Squashfs 还需要在 linux-next 中观察个半年。反对的观点来自 Alan Cox ,说很多发行版的 LiveCD 已经在用 Squashfs 很多年了,还有什么样的大规模测试比这更能说明问题?
3. 终于, Andrew 同意现在就合并吧!我们终于有了一个以蔬菜命名的文件系统了~
4. 调侃继续:
蔬菜总比 FAT (肥胖) 好吧~
我喜欢南瓜(Squash)胜过于黄油(Butter)~

http://thread.gmane.org/gmane.linux.file-systems/28733/focus=28881

http://marc.info/?l=linux-kernel&m=123153961726343&w=2