二月 17, 2012
» [tips] access gnome-keyring in cron

It seems program execute in your crontab doesn't have the luxury to use the gnome-keyring daemon to get the permission it should had. In order to let your program access gnome-keyring, you need to reuse a environment variable in your desktop session called DBUS_SESSION_BUS_ADDRESS in your cron environment also.The quickest way to do it is to add these line:


. ~/.dbus/session-bus/*-0
export DBUS_SESSION_BUS_ADDRESS


in your cron script (it assume you logged in under X display 0)

四月 27, 2008
» letoh

這兩天回到 Windows 作業,深感不便,所以臨時找了一些工具讓 Windows 可以更好用一些 winbash tcsh (official) tcsh (znc) GNU ls for Windows 玩了一下覺得 winbash 比 tcsh 方便多了,要 cd 到中文目錄也沒問題;tcsh 不管是官方版和日文版都無法輸入中文… 另外我也試了一下 shell script 的支援,winbash 對於 CRLF 結尾的檔案似乎也能正確執行,這樣在 win32 寫的 script 就不用特地再轉換 file format (借用 vim 的用語) 了。 至於 GNU ls…以前裝的 UnxUtils 雖然也有附一個 ls,但無法處理中文檔名,列出來會是一堆問號。這次找到的 ls 除了可以顯示中文外,也可以加上顏色 (–color),小缺點是有中文時字寬會算錯,大概是 locale 的部份沒有轉換好 (windows 不曉得有沒有相關設定…) 這篇文章還有一個 tag 是 ACG 要說明一下。znc 版的 tcsh 提供了各種風味的錯誤訊息翻譯,大部份是 ACG 角色的語氣,也有日本方言,只要設定 TCSHLANG [...]

四月 25, 2008
» What I installed? What can I install? Grep APT Packages

mkdir ~/tmp

Put this in your .zshrc or .bashrc
alias dl='dpkg -l > ~/tmp/dl'
alias dlg="cat ~/tmp/dl | sed -e 's/ii \([a-zA-Z\-]*[[:space:]]*[0-9a-zA-Z\.:\-]*\).*/\1/' | grep -i"
alias al='apt-cache pkgnames > ~/tmp/al'
alias alg='cat ~/tmp/al | grep'

Ok, that's done. Let us try:
% dl
will cache a list of packages you have installed.
% dl python
will list all packages' name contains 'python' string.
% al
will cache a list of available packages.
% alg 'kde4'
will list all packages' name contains 'kde4' string.
I use these a lot. Hope this will help.

biggo.com.tw

A Django site.