Archive for the ‘linux’ Category

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

Friday, January 1st, 2010 at 22:20 | 2 comments
Categories: linux

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

Friday, December 11th, 2009 at 08:23 | 2 comments
Categories: linux

#!/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

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

Sunday, September 6th, 2009 at 22:09 | 0 comments
Categories: linux

好吧 終於我也投奔到kde了

Thursday, September 3rd, 2009 at 06:47 | 1 comment
Categories: blah, 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 used to redirect the output to /dev/null, but sometimes it’s not good enough. It’s much better to just turn off stdout and stderr.

$ command 1>&- 2>&- &

Monday, August 24th, 2009 at 09:32 | 0 comments
Categories: linux

效果比正黑好得不是一點點
一點都沒有虛邊的感覺

Monday, May 11th, 2009 at 21:04 | 5 comments
Categories: linux

I don’t know if it’s a real bug or it’s just me
wired network keeps going up and down from time to time
since I don’t use wireless so I don’t know if it’s the same for wireless network
anyways, problem solved by replacing network manager with wicd
one good thing about jaunty is that they finally include wicd [...]

Monday, March 30th, 2009 at 21:06 | 0 comments
Categories: blah, linux

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
Page 1 of 512345
TOP