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 [...]
#!/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, [...]
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 * [...]
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 [...]
在顯示樓層插件的基礎上加上了引用回復功能
因為是以顯示樓層插件為基礎, 所以要求依然是 firefox+greasemonkey, 並且包括顯示樓層功能
引用回復的 link 只有在鼠標在回復區塊上時才會顯示
如果想引用留言所在頁面不是最後一頁, 因此沒有回復框, 插件會自動在頁面上加上回復框
引用完成後頁面會滾動到底部回復框
* 增加: ctrl+enter 回復功能 (04/06/2009)
* 修正bug: 不能在非第一頁或最後頁創建回復框 (10/06/2009)
* 增加: 如果討論分頁, 在頁首也顯示導航條 (10/06/2009)
如題
requirements 是 firefox + greasemonkey
啟用後的效果如下
兩個 class 加兩個 jsp …
功能極其有限 lol
source 在這裡
google 看到 raptium同學的 post Twitter和饭否同步
像我這種懶人自然就拿來用了
不過又不想把 twitter 上的回復也 sync 到飯否
so 加了一個 statement 把 @blah 都過濾了
如果有比我更懶得同學也想這麼做的話只要把
elif snode.nodeName == ‘text’:
改成
elif (snode.nodeName == ‘text’) and (snode.childNodes[0].nodeValue[0] != ‘@’):
就可以了
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 [...]
上班無聊隨便寫了個….
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.
