Archive for the ‘Programming’ Category

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 [...]

Friday, January 22nd, 2010 at 11:48 | 5 comments
Categories: Programming

#!/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, [...]

Friday, October 30th, 2009 at 20:04 | 2 comments
Categories: Programming, linux

It’s my first time writing something in perl, the code is not very efficient and for now it can only display info of cpu, memory, bandwidth and uptime.

# Configuration
$eth = "eth0";
 
# Script
Xchat::register("Sysinfo", "0.1", "System Information Displayer");
Xchat::print("Sysinfo 0.1 Loaded.");
Xchat::hook_command("uptime", "uptime");
Xchat::hook_command("os", "os");
Xchat::hook_command("bw", "bw");
Xchat::hook_command("cpu", "cpu");
Xchat::hook_command("mem", "mem");
 
sub uptime {
$uptime = `cat /proc/uptime | awk ‘{printf \$1}’`;
$_day = 60 * [...]

Sunday, August 30th, 2009 at 20:23 | 0 comments
Categories: Programming, linux

I was extremely bored this afternoon, so here it is, the converter for converting download links among FlashGet, QQ Tornado and Xunle, and also decrypting the real link. The tool is pretty much self-explanatory (and useless) so I guess there’s no need for any manuals or instructions. If you are bored too, you can check [...]

Friday, August 7th, 2009 at 19:44 | 1 comment
Categories: Programming

在顯示樓層插件的基礎上加上了引用回復功能
因為是以顯示樓層插件為基礎, 所以要求依然是 firefox+greasemonkey, 並且包括顯示樓層功能
引用回復的 link 只有在鼠標在回復區塊上時才會顯示
如果想引用留言所在頁面不是最後一頁, 因此沒有回復框, 插件會自動在頁面上加上回復框
引用完成後頁面會滾動到底部回復框
* 增加: ctrl+enter 回復功能 (04/06/2009)
* 修正bug: 不能在非第一頁或最後頁創建回復框 (10/06/2009)
* 增加: 如果討論分頁, 在頁首也顯示導航條 (10/06/2009)

Wednesday, June 3rd, 2009 at 14:59 | 0 comments
Categories: Programming

如題
requirements 是 firefox + greasemonkey
啟用後的效果如下

Tuesday, June 2nd, 2009 at 18:42 | 1 comment
Categories: Programming

兩個 class 加兩個 jsp …
功能極其有限 lol
source 在這裡

Friday, April 17th, 2009 at 12:03 | 0 comments
Categories: Programming
Tags: ,

google 看到 raptium同學的 post Twitter和饭否同步
像我這種懶人自然就拿來用了
不過又不想把 twitter 上的回復也 sync 到飯否
so 加了一個 statement 把 @blah 都過濾了
如果有比我更懶得同學也想這麼做的話只要把

elif snode.nodeName == ‘text’:

改成

elif (snode.nodeName == ‘text’) and (snode.childNodes[0].nodeValue[0] != ‘@’):

就可以了

Friday, March 27th, 2009 at 10:16 | 0 comments
Categories: Programming

Suppose you have asterisk 1.6 with freepbx and you are developing with the latest asterisk-java library. Somehow you wanna perform different tasks based on calls coming through different SIP trunks.
When there’s a new incoming call, asterisk-java will trigger a newChannelEvent, but there’s no information in this event that can be used for distinguish from which [...]

Thursday, March 19th, 2009 at 11:28 | 1 comment
Categories: Programming, linux

上班無聊隨便寫了個….
This plugin can retrieve the most recent 10 updates from your personal rss on last.fm, please notice that there is delay for the rss to get updated.

Monday, March 9th, 2009 at 17:08 | 0 comments
Categories: Programming
Page 1 of 212
TOP