2011年3月10日 星期四

Paste Code Block

Ref: formatmysourcecode

<pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"><code>Code... Code... Code...

</code></pre>

2011年3月9日 星期三

Folder Color When ls

1. Linux use the shell variable, LS_COLORS to set the colors when you `ls`.
2. A program dircolors is designed to help users set the variable LS_COLORS elegantly. According to the man page, the syntax of dircolors is as following.
dircolors [option] ... [file]
The file is a configuration specifying the output colors. Dircolors parse the file and output the corresponding statements used in shell scripts. Here is an example output for bash shell.
littletake@littletake-desktop [~] [16:26] dircolors -b .dircolors
LS_COLORS='rs=0:di=01;36:ln=01;36;44:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:
cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:
ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lzma=01;31:
*.tlz=01;31:*.txz=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:
*.lz=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:
*.rpm=01;31:*.jar=01;31:*.rar=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:
*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:
*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:
*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.ogm=01;35:*.mp4=01;35:
*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:
*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:
*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:
*.aac=00;36:*.au=00;36:*.flac=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:
*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.axa=00;36:*.oga=00;36:*.spx=00;36:*.xspf=00;36:';
export LS_COLORS
3. What should I do? First of all, generate the output file by the following command and modify .dircolors to fit my need. It is simple if you take some time to read the comments in .dircolors.
littletake@littletake-desktop [~] [16:45] dircolors -p > .dircolors
4. Add the following lines, that can be found in /etc/skel/.bashrc, to your .bashrc
#
# Directory Colors (.dircolors can be created by dircolors -p > ./.dircolors)
#
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
fi

2011年3月8日 星期二

Debian Linux Chinese Xwindow


1. Debian GNU/Linux 中文桌面環境 快速入門指南
2. 在 GNU/Linux 上設定字型 (上)
3. 在 GNU/Linux 上設定字型 (中) - 安裝與設定 X11 字型
4. 在 GNU/Linux 上設定字型 (下) - 安裝與設定 Xft

sudoer

Quick note here.

The fundamental entries of /etc/sudoers is as follwoing.
USER TRUSTED_HOST: (RUN_AS_USER) COMMANDS.
  • USER indicates a list the names on which the rule applies.
  • TRUSTED_HOST is typically a list of networks or IPs, i.e. 192.168.1.0/255.255.555.0. When USER login from the trusted network or IP, USER can execute COMMANDS.
  • RUN_AS_USER is a list of user. In this way, USER can execute COMMANDS as one of user in the list
  • COMMANDS is a list of commands the USER is allowed to run.
To sum up, the entry means USER can can COMMANDS from TRUSTED_HOST as RUN_AS_USER.

debian sources.list

An entry in /etc/apt/source.list consitsts of 3 parts, which are 1) URL, 2) distribution, and 3) area.

  • URL is where you can download the software packages. For example,
  • Distribution is the current version you would like to install. There are three main distributions: stable, testing, and unstable. User can also specify the code of the debian release, i.e. squeeze for debian 6.0.0.
  • Area are assorted according to the policy of debian authority. Main is for softwares that completely comply with the DFSG (Debian Free Software Guidelines). Contrib is for the softwares that rely on the softwares can not complete obedient to DFSG, that is, non-free packages. Besides main and contrib, non-free packages suffers some issues of patents.
Here are examples of entries of /etc/apt/sources.list
deb http://ftp.tw.debian.org/debian/ squeeze main contrib non-free
deb-src http://ftp.tw.debian.org/debian/ squeeze main contrib non-free








2011年3月4日 星期五

Cygwin Man Page

Ref: http://softsmith.blogspot.com/2008/03/cygwin-man-pages.html

  1. Download latest manual pages from Linux Document Project
  2. Extract to where the man pages should belocated, for ex. /usr/share/man/man-pages-3.32/
  3. In this case, add MANPATH /usr/share/man/man-pages-3.32/ to /etc/man.conf