2008年10月28日 星期二

quote and unquote 應用


#!/bin/python
#coding: utf-8
# -*- coding: utf-8 -*-
import urllib

str = "測試utf8 編解碼"
str_en = urllib.quote(str).encode('utf-8')
print str_en
print urllib.unquote(str_en)
codeing 指定本文編碼

其他應用
from urllib import quote, unquote

input = u"http://test.net/~admin"
input = input.encode('utf8')
print quote(input) # http%3A//test.net/%7Eadmin
print quote(input, '') # http%3A%2F%2Ftest.net%2F%7Eadmin
print quote(input, '~/') # http%3A//test.net/~admin

2008年10月22日 星期三

取得使用者最後登入日期及密碼最後更改日期

last 使用者名稱 | head -n 1

chage -l 使用者名稱

2008年8月14日 星期四

URL rewrite

今日有人問, 有沒有辦法將某個流量大的用戶把他的網頁導至某個警告的網頁. 搜尋了一下, 發現可以用以下幾個方式實現:

1. proxy, 在squid 中 url_rewrite_program
http://www.cs.nctu.edu.tw/~chwong/course/netadm-2007/slide/10_Web%20FTP%20&%20Proxy.ppt
2. Apache 中的 rewrite modules
http://phorum.study-area.org/index.php?PHPSESSID=08cb468163f6235085b7a319eaffa70b&topic=51611.msg264089#msg264089
3. iptables 不過要搭配以上二種才行, 不知可不可以直接修改封包內容.

2008年6月10日 星期二

Installation google gadgets

Operation System: Ubuntu 8.04
file: google-gadgets-for-linux-0.9.2.tar.gz
download link: http://code.google.com/p/google-gadgets-for-linux/

sudo apt-get install libtool automake autoconf libxul-dev libghc6-mozembed-dev libcurl4-gnutls-dev libxml2-dev zlib1g-dev xulrunner xulrunner-1.9-dev libgtk2.0-dev libcairo2-dev libdbus-1-dev libdbus-glib-1-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev libqt4-dev

xulrunner-1.9-dev 若有安裝過xulrunner-lib 會出現衡突,可不安裝
libqt4-dev 和 libgtk2.0-dev 可只選一安裝

./configure --prefix=/usr
make
sudo make install

If sucessful, type ggl-gtk in execute window (ALT+F2)

2008年6月5日 星期四

Linux 下compiler 一覽

Linux 下compiler 一覽


CC++F77F90
GNUgccg++f77N/A
PGIpgccpgCCpgf77pgf90
Intel i368icciccifcifc
Intel x86_64ecceccefcefc