僕の .zshrc

# -*- Coding: utf-8 -*-

# 文字コードの設定
export LANG=ja_JP.UTF-8

# パスの設定
PATH=/usr/local/bin:$PATH

alias ls='ls --color=auto'

# プロンプトの設定 
PROMPT='$ '
RPROMPT="[%~]"

# ヒストリの設定
HISTFILE=~/.histfile
HISTSIZE=10000
SAVEHIST=10000

# 履歴ファイルに時刻を記録
setopt extended_history

# 補完するかの質問は画面を超える時にのみに行う。
LISTMAX=0

autoload -Uz compinit; compinit

# sudo でも補完の対象
zstyle ':completion:*:sudo:*' \
    command-path /usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /sbin /bin

# cdのタイミングで自動的にpushd
setopt auto_pushd 

# 複数の zsh を同時に使う時など history ファイルに上書きせず追加
setopt append_history

# 補完候補が複数ある時に、一覧表示
setopt auto_list

# 保管結果をできるだけ詰める
setopt list_packed

# 補完キー(Tab, Ctrl+I) を連打するだけで順に補完候補を自動で補完
setopt auto_menu

# カッコの対応などを自動的に補完
setopt auto_param_keys

# ディレクトリ名の補完で末尾の / を自動的に付加し、次の補完に備える
setopt auto_param_slash

# ビープ音を鳴らさないようにする
setopt no_beep

# 直前と同じコマンドラインはヒストリに追加しない
setopt hist_ignore_dups

# ヒストリにhistoryコマンドを記録しない
setopt hist_no_store

# 余分なスペースを削除してヒストリに記録する
setopt hist_reduce_blanks

# 行頭がスペースで始まるコマンドラインはヒストリに記録しない
# setopt hist_ignore_spece

# 重複したヒストリは追加しない
# setopt hist_ignore_all_dups

# ヒストリを呼び出してから実行する間に一旦編集できる状態になる
setopt hist_verify

# auto_list の補完候補一覧で、ls -F のようにファイルの種別をマーク表示しない
setopt no_list_types

# コマンドラインの引数で --prefix=/usr などの = 以降でも補完できる
setopt magic_equal_subst

# ファイル名の展開でディレクトリにマッチした場合末尾に / を付加する
setopt mark_dirs

# 8 ビット目を通すようになり、日本語のファイル名を表示可能
setopt print_eight_bit

# シェルのプロセスごとに履歴を共有
setopt share_history

# Ctrl+wで直前の/までを削除する。
WORDCHARS='*?_-.[]~=&;!#$%^(){}<>'

# ディレクトリを水色にする。
export LS_COLORS='di=01;36'

# ファイルリスト補完でもlsと同様に色をつける。
zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}

# ウィンドウのタイトル
function settitle() {
    print -Pn "\e]2; %n@%m:%~\a"
}

settitle # 最初の一発

# cd
function chpwd() {
    if [ "$TERM" != "dumb" -a "$TERM" != "emacs" ]
    then
	settitle
    fi

    ls
}

# ディレクトリ名だけでディレクトリの移動をする。
setopt auto_cd

# C-s, C-qを無効にする。
setopt no_flow_control

function fullpath { find `pwd` -maxdepth 1 -name $* 2>/dev/null }

ディスプレイの解像度

ウチのへぼPCにインストールしたら、解像度が1024x768までしか認識できないではないか。
いくらへぼくっても、1280x1024くらいはあるんだい。
とゆーワケで、~/.xprofileを作りました。

#!/bin/sh
xrandr --newmode "1280x1024_60.00" 109.00  1280 1368 1496 1712  1024 1027 1034 1063 \
    -hsync +vsync

xrandr --addmode VGA-0 "1280x1024_60.00"
xrandr --output VGA-0 --mode "1280x1024_60.00"

.xprofileへ実行権を与えるのを忘れずに…。

ThinReports で Shape を印刷するかどうかを動的に制御する

visible メソッドを使います。

# coding: utf-8

require 'rubygems'
require 'thinreports'

# レイアウトファイル: toggle-line.tlf
# 出力ファイル:       toggle-line.pdf
ThinReports::Report.generate_file('toggle-line.pdf',
                                  :layout => 'toggle-line.tlf') do
  start_new_page

  # 引数があれば、アイテム toggle_line を非表示にする。
  if ARGV[0].length != 0
    page.item(:toggle_line).visible(false)
  end
end

圧縮転送

bzip2 で圧縮しながら、ネットワーク越しに sshディレクトリを転送する方法です。

$ ssh [source_host] "tar jcvf - [source_directory]" | tar jxvf -

そのままコピった方が早いかも。CPU と ネットワークの性能で、変わると思います。

ここを参照しました。 http://www.cyberciti.biz/faq/howto-use-tar-command-through-network-over-ssh-session/

CentOS のネットワーク接続

CentOSでネットワークが繋がらないんで、うんうん唸ってたら…。
自動接続にしてませんでしたorz

で、このダイアログを出す方法ですが…。
[システム]...[設定]...[ネットワーク接続]から…。

ここクリックすると、出てきます。
実際の設定は /etc/sysconfig/network-scripts/ifcfg-eth0 の ONBOOT に保存されます。
d:id:p4life:20090413:1239624784 を参考にさせて頂きました。