OS: Arch Linux
Display Manager: xdm
Desktop Environment: Xfce 4.8
之前用
netstat -tnlp
都會看到一個 6000 的 Port 開著,雖然知道那是 X 啟動的,而且 iptables 有設定好應該也不會出什麼問題,但還是有點討厭,查了一些資料,設定 ~/.xinitrc 也沒用,今天突然想到從 xdm 這邊下手,果然一試就成功。
目前是照 ArchWiki 上所寫,修改 /etc/inittab 來啟動 xdm,要關閉 6000 的 Port 必須在啟動 X 的時候傳個參數 -nolisten tcp ( 請參考 man xserver ),需要修改的檔案是 /etc/X11/xdm/Xservers
將原本的
:0 local /usr/bin/X :0
改成
:0 local /usr/bin/X -nolisten tcp :0
接著 sudo init 3 關閉 X ,sudo init 5 重新啟動 X 應該就不會看到 6000 Port 開著了 :)
Reference:
How Do I Prevent X From Exposing A TCP Port?
Arch Linux Forums: X is listening on port 6000?
2011年3月4日 星期五
2011年2月21日 星期一
use `tree` to list current directory contents
想要看某個目錄下面的目錄和檔案結構,但是用 `ls` 一層層列出來實在是太麻煩了,而且也很不直觀,用 `tree` 可以過濾不想要的 pattern,也可以設定 level,寫了支小 script 來處理各項變數;將查詢的 script 放在同一個目錄下面,方便管理,將每次的查詢結果加上日期儲存起來。
放在 bitbucket 上的 repository 裡,以後如果寫些 script 也會丟進裡面( 年輕人就是要玩 HG ! )
Reference:
tree man page
Four ways to extract the current directory name
放在 bitbucket 上的 repository 裡,以後如果寫些 script 也會丟進裡面( 年輕人就是要玩 HG ! )
script download
#!/bin/bash
# using `tree` to list current directory
# extract current directory name, record time and append to output file
# original: tree -L 3 -I "porn*|tree*" --noreport ./ >> ./tree.txt
LEVEL=3
EXCLUDE_PATTERN="porn*|tree*"
DIRNAME=`basename $PWD`
OUTPUT_FILE="tree.txt"
echo "Using \`tree\` to list contents of \"" $DIRNAME "\" to" $OUTPUT_FILE
echo >> $OUTPUT_FILE
echo "********" >> $OUTPUT_FILE
echo `date` >> $OUTPUT_FILE
echo "********" >> $OUTPUT_FILE
echo >> $OUTPUT_FILE
cd ..
tree -L $LEVEL -I "$EXCLUDE_PATTERN" --noreport $DIRNAME >> $DIRNAME/$OUTPUT_FILE
Reference:
tree man page
Four ways to extract the current directory name
2011年1月25日 星期二
fix emesene 1.6.3 login error
一兩個月前開始,登入 emesene 1.6.3 版的時候都會跳出下列錯誤:
因為懶得再去找 SVN 版本下來安裝,就直接上 Repository 抓 ProfileManager.py 下來產生 patch,反正有問題再用 patch -R 就可以更改回來,目前使用起來一切正常,不知道 emesene2 什麼時候才會發佈 stable 版本?
emesene error接著 MSN 暱稱變成註冊信箱,個人狀態一片空白,在官方論壇看到討論說這是 MSN 傳回的內容有改變,造成 emesene 抓不到暱稱和狀態,只要更新到最新的 SVN 版本就可解決。
Exception
You are using emesene 1.6.3 - "Uberlândia" so you're free to complain here:
http://forum.emesene.org/index.php/board,19.0.html
Check already existing tickets for duplicates first, please.
Traceback (most recent call last):
File "/usr/share/emesene/emesenelib/soap/manager.py", line 139, in process
return process()
File "/usr/share/emesene/emesenelib/soap/manager.py", line 76, in process
response.callback(response, *response.args)
File "/usr/share/emesene/emesenelib/ProfileManager.py", line 155, in onGetProfile
photo = response.body.split('</Photo>')[0].split('<Photo>')[1]
IndexError: list index out of range
因為懶得再去找 SVN 版本下來安裝,就直接上 Repository 抓 ProfileManager.py 下來產生 patch,反正有問題再用 patch -R 就可以更改回來,目前使用起來一切正常,不知道 emesene2 什麼時候才會發佈 stable 版本?
diff -u /usr/share/emesene/emesenelib/ProfileManager.py ~/ProfileManager.py > emesene_profile.patch
patch -v /usr/share/emesene/emesenelib/ProfileManager.py emesene_profile.patch
2010年12月26日 星期日
幾個有趣的 Project 和文章
因為分頁開著放很久了,又沒時間去看,先紀錄下來,以後如果有空再...。
pep8:
archery:
Archey is a system information tool written in Python.
psutil :
psutil is a module providing an interface for retrieving information on running processes and system utilization (CPU, memory) in a portable way by using Python, implementing many functionalities offered by command line tools like ps, top, kill, lsof and netstat.
shellinabox:
Shell In A Box implements a web server that can export arbitrary command line tools to a web based terminal emulator. This emulator is accessible to any JavaScript and CSS enabled web browser and does not require any additional browser plugins.
How to get your code into an open source project
pep8:
pep8 is a tool to check your Python code against some of the style conventions in PEP 8.
archery:
Archey is a system information tool written in Python.
psutil :
psutil is a module providing an interface for retrieving information on running processes and system utilization (CPU, memory) in a portable way by using Python, implementing many functionalities offered by command line tools like ps, top, kill, lsof and netstat.
shellinabox:
Shell In A Box implements a web server that can export arbitrary command line tools to a web based terminal emulator. This emulator is accessible to any JavaScript and CSS enabled web browser and does not require any additional browser plugins.
How to get your code into an open source project
2010年11月14日 星期日
讓 xpdf 能正常顯示無內嵌字型的檔案
之前有寫過一篇 讓 xpdf 能正常顯示中文 (Arch Linux);但是捐血中心寄來的檢驗報告一直都是亂碼,原本以為是捐血中心的問題,直到前幾天想下載 大家來學 Vim 一個歷久彌新的編輯器 的 pdf 才發現沒有內嵌字型的 pdf 也是亂碼,於是就用 shell 呼叫 xpdf 開檔案,再由錯誤訊息去 google ,找了一堆討論,發現 xpdf 的語言包可以解決這個問題;自己測試沒有問題後,再追到 Arch Linux 的 package 上面,發現最新的 PKGBUILD 沒有複製 Adobe-CNS1.cidToUnicode 到 /usr/share/xpdf/ 下面,丟了個 bug report ,隔天 trunk 的 PKGBUILD 就更新了,雖然不知道什麼時候才會移到正式版上面去,但是能貢獻自己小小心力,還有學到一丁點知識,有點開心 :)
Reference:
FreeBSD Chinese HOWTO - 6.9. 以 gs 觀看不內嵌的 pdf 檔
"資訊人權貴" 之家 - 字形/中文
Edward G.J. Lee 的 xpdfrc 範例檔
xpdf - Download
Arch Linux Package - xpdf-chinese-traditional
Arch Wiki - Creating Packages
Reference:
FreeBSD Chinese HOWTO - 6.9. 以 gs 觀看不內嵌的 pdf 檔
"資訊人權貴" 之家 - 字形/中文
Edward G.J. Lee 的 xpdfrc 範例檔
xpdf - Download
Arch Linux Package - xpdf-chinese-traditional
Arch Wiki - Creating Packages
訂閱:
意見 (Atom)

