2009-04-01

Google Release Search Interface for Fallout 3

Google has released a search interface for Fallout3. To use it just bring up the Pipboy interface and hit the tilde key (~), then enter google followed by a return, the google interface will show up. Google's product manager Doug Garland states that this is for the players' convinience, and Google may release more similar products later (for example, a search interface in The Sims 3).

2008-11-05

Wiki Moved

My Wiki

My wiki has moved to here. I have redesigned the style to a dark theme and rearrange the footer area. Stuff about XeTeX was added into the TeX section and slightly changed the index page.

Plan to add a page about Gnuplot and maybe GNU/Linux, when I get the time.

In fact I was trying to put a Wordpress blog onto that host. But the service is such a rubbish that I was forced to give up...

2008-09-08

iBus Input Method Engine

大家都知道在 Linux 里有两个中文输入法最著名,一个是已经停止更新的Fcitx,还有一个是现在常用的输入法引擎 SCIM。SCIM 虽然好,但是有很多的兼容性问题,所以我一直用 Fcitx。现在据说是原来发明 SCIM-python 的人,觉得 SCIM 太搓了,于是又写了这个 iBus,架构优良,完全用 Python 写的,实乃我辈中人之良择,遂装之。

目前 iBus 还是个很初级的版本,我是用 git 搞下来以后编译的,自己写了 PKGBUILD 脚本,后来才发现 AUR 里有,冏... 装的过程基本顺利,不过这个东西的 dependence 实在是多,而且由于用到了 python-gconf,必须装 gnome-python,还好 Arch 的这个包不要求 Gnome~~

这个版本的 iBus 虽然初级,但效果已经很好,可以进行一般的整句输入,真是大大超出我的预料~,日后必有作为!上截图~~

Screenshot of iBus

现在我已经把 Fcitx 换下来了~ 哈哈

2008-08-11

Linux vs. Mac @ last.fm

The Mac group in last.fm has 80+ members, Apple has much more, 800+ in total, while the Linux has nearly 5000 members, which really surprises me. Is it because "Linux rocks"? :-D

And BTW, the top 3 artists in the Linux group are Radiohead, Pink Floyd and Metallica. Pretty rocking, huh?

2008-07-28

Slow Motion in Leopard

Found a "hidden" feature in Leopard. When you let the system do an animation, hold shift while do so will make the animation slow. For example, when minimizing a window, hold shift while press the yellow button will make the "genie" effect slow (enough for you to see the detail about how the window shrinks). Also, when you drag a file into a driver icon on the desktop, a finder windows will show up. Holding shift will make this a slow motion.

2008-05-03

GTA IV

Shot of trailer

GTA IV has been put on shelves in market. I've just watched the 4 trailer videos, and I think the graphics sucks in comparison to Assassins Creed, the animation sucks in comparison to Prince of Persia 3, and the modeling sucks in comparison to Doom 3. But, guys, BUT: it has got "Grand Theft Auto" in its name. What else can a man want from a video game?

2008-04-24

EMI Sued MP3tunes

April 22th, CEO of MP3tunes sent all users an email, saying that MP3tunes was sued by EMI because of that copywrong thing.

As you may be aware, the major record label EMI has sued MP3tunes, claiming our service is illegal. You can read about the case here. Much is at stake -- if you don't have the right to store your own music online then you won't have the right to store ebooks, videos and other digital products as well. The notion of ownership in the 21st century will evaporate. The idea of ownership is important to me and I want to make sure I have that right and my kids do too.

I don't think MP3tunes did wrong and we all know what rights we have. So I just want to say, EMI, you suck!

2008-03-20

I Need an Apple Cinema Display

Apple Cinema Display

Yes, I do. Because when I'm working on my paper, my desktop becomes this:
sorry-looking desktop
The apps are Emacs, xpdf x 3, rox file manager and terminal.

And I can optimize it a little, which results in this:
sorry-looking desktop 2
I can make use of one xpdf now, while lose the usability of the terminal...

2008-02-16

Report IP and More via e-mail

Want to SSH to you machine at home but don't know the DSL IP address? Why not make your home Linux mail it to you? I wrote some tiny programs that would keep an eye on you mail spool and do stuff according to some specific mail subject. For example, I can send an e-mail to myself which has a subject [CMD] ip_wan and sometime later I will receive an e-mail containing the WAN IP of my router, so that I can easily make a SSH/ftp/telnet session between where I currently am and my box at home.

The first program check my e-mail spool and tell if doing some tasks is needed.

#!/usr/bin/env python

import sys
import mailbox
import StringIO
import rfc822

SPOOL="/var/mail/corsair"

def lookUp(mbox):
    MBox = mailbox.mbox(mbox)
    Deletes = []
    CMDs = []
    for Mail in MBox.items():
        Msg = StringIO.StringIO()
        Msg.write(str(Mail[1]))
        Msg.seek(0)
        MsgParsed = rfc822.Message(Msg)
        if MsgParsed["Subject"].startswith("[CMD]"):
            CMD = MsgParsed["Subject"][6:]
            MBox.remove(Mail[0])
            CMDs.append(CMD)
        Msg.close()
    MBox.close()
    return CMDs

def main():
    for CMD in lookUp(SPOOL):
        print CMD

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

And the second is a shell script that does specific task according to standard input.

#!/bin/zsh

MailAddr="My Email Address"

mailsend()
{
    print -l "Subject: CMD reply\n" $1 $2 | msmtp $MailAddr
}

for CMD in $(cat); do
    case $CMD in
        ip_wan)
            echo "Sending wan IP..."
            mailsend "Wan IP is" \
                $(wget -O - -q http://myip.dk/ | sed -nr 's|^<title>Your IP: ([^<]+)</title>$|\1|p')
            ;;
        ip_lan)
            echo "Sending lan IP..."
            mailsend "Lan IP is" "$(ifconfig)"
            ;;
        *)
            ;;
    esac
done

You can tell that this script currently only support sending LAN and WAN IP.

A possible usage of these two programs is to run the following every some minutes:

mailcmd.py | mailcmdexec.sh

2007-11-07

Terminal Broadcasting

Some days ago I registered an Aardwolf MUD account, and want to show to my girlfriend about MUD and how to play it. So I needed a method to copy the content of my terminal to hers, which I called terminal broadcasting. I got help from the official BBS of my college, that I could redirect the output of the script program to the target pt. The shell command ran thus:

$ script /dev/null 2>&1 | tee /dev/pts/2

Where I assumed that the target pt was /dev/pts/2.

Why was script functional? What I wanted was to duplicate the content of my terminal to hers, both of which, in fact, were file under /dev. So what I've got to do was to write the content of /dev/pts/1 (I assume it's my pt) to /dev/pts/2. Generally, for regular files, one can just do a redirected cat like this

$ cat /dev/pts/1 > /dev/pts/2

But since /dev/pts/1 changes continuously, the command above does not suit our needs. Furthermore, if we just redirect the output, we ourselves are not able to see the content of /dev/pts/1, which will make us unable to do any thing in it. So quite natually, tee will be used. And for the real-time-update stuff, we need a tool that gives us a subshell, and "watch" all the input and output and err. It very seems that a shell itself will do; however, unfortunately, a shell is too low-leveled for this task, and script is the very program (just see what script does: it write the content of current pt to a file). But the question is that why redirect? It seem a simple script /dev/pts/2 will do it perfectly. Yes it seems; however the answer is concerning the "update continuously" thing: by default, script only updates the file when encounter a line break (return), so we have to use a pipe. If you really hate pipes and redirection, you can pass a -f as an option like this:

$ script -f /dev/pts/2

It works similarly as using a pipe.

So for now we have two methods, and there is one more: using a named pipe.

$ mkfifo temp.fifo
$ nc -l -p 1234 -c "cat temp.fifo" &
$ script -f temp.fifo

When others want to see your terminal, they can telnet you via port 1234. This is a more robotic way.