April 10th, 2010 | Categories: blah | Tags:

Accidentally saw this cherry tree full of blossoms on the metro, I couldn’t help but got off the metro right away and took this picture with my iphone, so please pretend that you don’t notice the poor quality :p

IMG 0052 337x450 春・桜

8 comments (48 views)
January 22nd, 2010 | Categories: Programming | Tags: , , , ,

Finally I got sometime to work on implementing my own python script for posting douban saying, again. This time I used the library written by Leah Culver, and everything went smoothly. It’s just that I have no idea why douban chose to use a different signing algorithm(if a thing as stupid as it is can be called a algorithm) for requesting access token.

終於又有時間再一次捯鼓豆瓣. 這次在 Leah Culver 寫的 library 的基礎上, 終於把python腳本發送豆瓣廣播終於搞定了. 唯一理解不能的事就是豆瓣在獲取access token的時候用了一個莫名其妙的簽名算法(如果這種也能叫做算法的話 = =).

Click on read more to view the actual code of the script.
查看腳本內容請點擊 read more
Read more…

5 comments (94 views)
January 1st, 2010 | Categories: linux | Tags: , ,

Suppose you wanna have HighID and open KAD network connection for eMule on a computer in a LAN, and the gateway is running iptables. Just add the rules below to your existing iptables rules and you are done.

# this example is based on the assumption that
# eth0 is WAN interface and eth1 is LAN interface,
# 192.168.0.2 is the ip address of a computer in LAN,
# 4262 is the tcp port for ed2k network,
# 4272 is the udp port for kad network.

-A PREROUTING -i eth0 -p tcp -m tcp --dport 4262 -j DNAT --to-destination 192.168.0.2:4262
-A PREROUTING -i eth0 -p udp -m udp --dport 4272 -j DNAT --to-destination 192.168.0.2:4272

-A FORWARD -d 192.168.0.2/32 -i eth0 -o eth1 -p tcp --dport 4262 -j ACCEPT
-A FORWARD -d 192.168.0.2/32 -i eth0 -o eth1 -p udp --dport 4272 -j ACCEPT
2 comments (189 views)
December 11th, 2009 | Categories: linux | Tags: , , ,

Yesterday I wanted to download a file but could find only magnet link. Since rtorrent doesn’t support magnet link yet officially, I did some research on google and came cross this great tutorial on how to patch the source from svn and get magnet link support. So here they are, deb packages for libtorrent and rtorrent. These packages were built for my debian squeeze, so I’m not sure if they also work on ubuntu, but if you want you can try.

unknown rtorrent with magnet link support  libtorrent11_0.12.6-4_i386.deb (371.5 KiB, 421 hits)

unknown rtorrent with magnet link support  rtorrent_0.8.6-2_i386.deb (393.9 KiB, 389 hits)

7 comments (2,123 views)
October 30th, 2009 | Categories: Programming, linux | Tags: , , , , ,
#!/usr/bin/env python
import base64
import simplejson as json
import os
import sys
import urllib
import urllib2

global twitter_username
global digu_username
global digu_password
twitter_username = 'username'
digu_username = 'username'
digu_password = 'password'

def post_to_digu(msg):
	url = 'http://api.minicloud.com.cn/statuses/update.json'
	data = urllib.urlencode(msg)
	req = urllib2.Request(url, data)
	req.add_header("Authorization", "Basic %s" % base64.encodestring('%s:%s' % (digu_username, digu_password))[:-1])
	handle = urllib2.urlopen(req)

def main():
	path = sys.path[0]
	if (sys.platform[:3] == 'win'):
		path += '\\'
	else:
		path += '/'
	id_file = path + 'last_id'
	last_id = 0
	if os.path.exists(id_file):
		f = open(id_file, 'r')
	        last_id = int(f.read())
        	f.close()
	else:
		f = open(id_file, 'w')
		f.write('0')
		f.close()
	url = 'http://twitter.com/statuses/user_timeline/' + twitter_username + '.json?last_id='
	updates = json.load(urllib.urlopen(url+str(last_id)))
	new_last_id = None
	n = 0
	for update in updates:
		text = update['text']
		id = update['id']
		if (text[0] != '@') and (id > last_id):
			if (new_last_id < id):
				new_last_id = id
			text = urllib.quote(text.encode('utf-8'))
			msg = {'content': text}
                        stack.append(msg)
        while (stack)
                post_to_digu(stack.pop())
	if (new_last_id != None):
		f = open(id_file, 'w')
		f.write(str(new_last_id))

if __name__ == "__main__":
    main()
2 comments (145 views)
October 22nd, 2009 | Categories: blah | Tags:

map of fukien

very funny, and somehow accurate :D

2 comments (26 views)
September 11th, 2009 | Categories: blah | Tags: , , , ,

您的结果

政治立场坐标
0.4

文化立场坐标
1

经济立场坐标
0.5

測試題目在這裡

1 comment (73 views)
September 6th, 2009 | Categories: linux | Tags: , , , , , , ,

從 jaunty 的 repository 裡面安裝的 eva 登錄就崩潰了, 自己從 svn 拉回來編譯了一個, 只編譯了 x86 的因為現在沒有 x64 的機器, 目前發現隱身可見的用戶發來消息的時候會崩潰… 有興趣的同學可以裝上試試

順便 fuck 麻花騰, qq for linux 就這麼停了

unknown eva 0.4.921 svn79  eva_0.4.921svn79-0ubuntu1_i386.deb (2.7 MiB, 435 hits)

0 comments (39 views)
September 5th, 2009 | Categories: blah | Tags: ,

Tweetboard can be activated by either clicking on the button on the left side of the page or directly opening http://phill84.org/#tboard

The old twitter widget is removed

4 comments (14 views)
September 3rd, 2009 | Categories: blah, linux | Tags: , ,

好吧 終於我也投奔到kde了

snapshot1 450x270 KDE 4.3.1

snapshot2 450x270 KDE 4.3.1

1 comment (117 views)
Page 1 of 191234510...Last »
TOP
Brain Bliss