最近 7 日分 / 今月の一覧
2010-09-01 Wed
■ ecc.u-tokyo.ac.jp から送信する設定 [wl]
自分(研究所)の設定は当日の秘密日記に。親切な方に感謝 http://d.hatena.ne.jp/kjan/20070507
オフィシャル:http://www.ecc.u-tokyo.ac.jp/system/mail.html
には載ってないよな。ふつー wanderlust なんて
imap
;; IMAP
(setq elmo-imap4-default-server "imap.ecc.u-tokyo.ac.jp")
(setq elmo-imap4-default-port 993)
(setq elmo-imap4-default-user "xxxxxx@mail.ecc.u-tokyo.ac.jp")
(setq elmo-imap4-default-authenticate-type 'clear)
(setq elmo-imap4-default-stream-type 'ssl)
;; SMTP
(setq wl-smtp-posting-server "smtp.ecc.u-tokyo.ac.jp")
(setq wl-smtp-posting-port 465)
(setq wl-smtp-posting-user "xxxxxx@mail.ecc.u-tokyo.ac.jp")
(setq wl-smtp-authenticate-type "login")
(setq wl-smtp-connection-type 'ssl)
(setq smtp-end-of-line "\n")
(setq ssl-program-arguments
'("s_client"
"-quiet"
"-host" host
"-port" service
)) ;ルート証明書の確認をサボる(秘密日記に)
2010-08-30 Mon
■ Linux等でのログのモニタリングで簡単にアラートをキャッチするワンライナー [server][maintenance]
http://d.hatena.ne.jp/rx7/20100827/p1
とあるログファイルの出力から、ある文字列が検出された際に、ビープ音を鳴らすワンライナーは以下。
$ tail -f ログファイル | sed -e 's/\(対象文字列\)/\1^G/'
「^G」(0x07)の部分が、ASCIIのBELキャラクタのリテラルです。
$ echo -n "^G"
などとしてやれば、ベル(ビープ音)が鳴ります
ちなみに、「^G」は、[Ctrl-V] ⇒ [Ctrl-G] の順に入力してやればOK。emacsだと[Ctrl-Q] ⇒ [Ctrl-G]かな。
2010-08-28 Sat
■ bash で配列 [tips:command]
http://www.asahi-net.or.jp/~AA4T-NNGK/bash.html#basharray
##### test of array #####
ARRAY=(one two) 配列の宣言はスペース区切りの値を( )で囲む
${#ARRAY[@]} is: 2 配列の要素数をカウントする
# Let us push one element at the end 配列の末尾に要素を追加(Perlやphpで言う`push')
ELEMENTS=${#ARRAY[@]} 要素数を得ておく
ARRAY[$ELEMENTS]=three 配列の`要素数'番目に新たな値を代入
${#ARRAY[@]} is: 3 増えた
$ARRAY is: one [序数]を省くと0番目の要素が参照できる
${ARRAY[@]} is: one two three [@] と [*] による参照方法による違いのテスト
echo ${ARRAY[@]} by "for" loop: [@] ではリスト
one
two
three
${ARRAY[*]} is: one two thr
...
...
2010-08-27 Fri
■ shopt (shell option?) [tips:command]
shopt は shell options のこと。
bashの組み込みコマンドshoptは,setコマンドと同様,シェルのオプション項目を設定・表示します。
bashには様々なオプション動作を定義している変数があり,on/offによって動作が変わります。
shoptコマンドを使って,それらのオプション項目を表示したり,on/offをトグルしたりすることができます。
例えば、
bashでは通常,ワイルドカード「*」は「.」で始まるファイル名にはヒットしません。
しかし,dotglobオプションを有効にすると,ドットファイルにもヒットするようになります。
dotglobオプションを設定する
# ls *bash*
ls: *bash*: そのようなファイルやディレクトリはありません
# shopt -s dotglob
-s :Enable (set) each optname.
-u :Disable (unset) each optname.
# ls *bash*
.bash_history .bash_logout .bash_profile .bashrc
とか?
http://nobuit.blog56.fc2.com/blog-entry-91.html
shopt