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 [...]
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. [...]
#!/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, [...]
從 jaunty 的 repository 裡面安裝的 eva 登錄就崩潰了, 自己從 svn 拉回來編譯了一個, 只編譯了 x86 的因為現在沒有 x64 的機器, 目前發現隱身可見的用戶發來消息的時候會崩潰… 有興趣的同學可以裝上試試
順便 fuck 麻花騰, qq for linux 就這麼停了
好吧 終於我也投奔到kde了
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 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>&- &
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 [...]
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 [...]
