Skip to main content

Posts

Showing posts from September, 2006

Custom monitoring graphs for xrp.ninja validator

还是screen

C-o会和vim里的命令冲突的
所以现在用\\
escape \\\\
意思是\是命令键,相当于之前的C-a,要打反斜线\就打两个\\
同理 escape ^Oo 意思是C-o是命令键,C-o o就相当于C-o

看来我应该放弃AIGLX的努力了

https://help.ubuntu.com/community/CompositeManager/AIGLX
Information about unsupported hardware The open-source ATI driver (radeon) uses software rendering for alpha (transparency). This makes Compiz unusably slow on a Radeon 9200 (one of the fastest cards supported). No word from ATI on when their proprietary driver (which has proper 3d acceleration) will support AIGLX.

想让screen更像个桌面么?

需要有个好的screenrc
screen的默认配置的最大问题是ctrl-A和bash里回到行首的快捷键冲突,导致要使用后者要多打一个a(ctrl-a a)。比较麻烦。
下面这个screenrc重定义了这个快捷键
而且加上了一个更漂亮的caption,有日期时间主机名等
现在terminal是否有tab功能对我来说已经无所谓了
哈哈
# ~/.screenrc
# use visual bell
vbell on
# replace ctrl-A by ctrl-O
escape ^Oo
# set a big scrolling buffer
defscrollback 5000
# Set the caption on the bottom line
caption always "%{= kw}%-w%{= BW}%n %t%{-}%+w %-= @%H - %LD %d %LM - %c"

一个python脚本,把一个目录下所有文件转成utf8编码

chardet package is in gentoo-china-overlay
layman -a gentoo-china
I have already filed a chardet's bug, requesting it to be added to portage
However, no response yet

#! /usr/bin/python
import sys,chardet,shutil,os,tempfile

def convert(fname):
        fp = open(fname)
        text = fp.read()
        encoding = chardet.detect(text)['encoding']
        rate = chardet.detect(text)['confidence']
        if rate > 0.9 and not encoding == 'utf-8':
                tmp,tmpname=tempfile.mkstemp()
                os.write(tmp, unicode(text,encoding).encode('utf-8'))
                shutil.move(tmpname, fname)

if __name__=="__main__":
        dir = sys.argv[1]
        for f in os.listdir(dir):
                pathname = os.path.join(dir, f)
                convert(pathname)

Emacs + Gdb

早有耳闻这两者是不错的搭配
真正试验了一把之后发现
那岂止是不错,那是相当的不错!
绝配啊Linux的程序员一定要试一下
否则终生遗憾两个提示:
一个是在~/.emacs里定义变量gdb-many-windows:(defvar gdb-many-windows t)
再一个是启用gub-tooltip-mode,这样鼠标指向源代码里的变量时,emacs就能以tooltip提示框的形式显示变量的地址和值。再也不用p和x了。简直是太方便了,太方便了!

gdb in emacs, gdbtui and inputrc

In readline, C-j functions like "enter" key.
However, I defined C-j as menu-complete in my ~/.inputrc.
So, in gdbtui and when using gdb in emacs, enter key don't function as
usual, instead it performs menu-complete. As a consequence, i can't
use gdbtui and gdb in emacs.
I solved the problem myself.
I just thought that this problem should has something to do with
readline library.
Maybe my readline is too new? This is my first suspicion.
Then I suddenly remembered that I had redefined some key-binding in my
~/.inputrc.
Thus, the problem solved.reference:
http://tiswww.tis.case.edu/~chet/readline/rltop.html