2009-07-14
colordiffが無いからcdiffを使った
Linux | |
diffの結果に色を付けられるcolordiffなるものを使おうとした。
% sudo yum install colordiff No package colordiff available. Nothing to do
ショック。俺のcentos5には使わせないつもりか。
% sudo yum list '*diff*' cdiff.noarch
何か居た。多分こいつだ。どうでもいいがrpmforgeだ。
% sudo yum install cdiff
本体はシェルスクリプトだった。
svnではdiff-cmdにcdiffを指定すればいいらしいのだが、svn1.5.6で期待する動きをしないので以下で我慢した。
% alias sl sl='svn diff | cdiff'
まあ本家に有ったんだけどね。こんにちはcolordiffさようならcdiff
2009-04-30
bashとzshでアスタリスクの解釈が変わる例
bash
$ ls h1 h2 h3 h4 h5 te $ hoge=[h]* $ echo $hoge h1 h2 h3 h4 h5
zsh
% hoge=[h]* % echo $hoge [h]*
2009-04-09
xchatのメニューを消してしまったらF9を押せ
Linux | |
centosをサーバとして使ってて、ついでにircクライアントのxchatをつけっ放しにしている。
loquiが使えればいいのだけれど、どーしてもサーバに繋がらない。
で、このxchat、導入直後にメニューバーを消してしまった。消そうと思ったわけじゃなく、マウス操作を間違えて消した。
元に戻せないので困ってた。rpm -eして再インストールしても設定そのままだし。
柔道家に相談してみた。
「設定どっかに残ってるはずだから探して消せば」
% ls -a … .xchat2 …
何かいたよ。
% rm -rf .xchat2
無事メニューバーが戻った。正確に言うと、設定とログ全部吹っ飛ばして戻った。
メニューバーの表示・非表示はF9でトグルできるよ!
メインウィンドウを右クリックして「閲覧」>「Menu Bar」でも出るよ!
きづかねーよ!
柔道家の人ありがとうございました。無事メニューも発言時刻も出せました。
で、loquiもアカウント設定からやり直したら普通にfreenode繋がった。
2009-01-31
コマンドラインでperlを使う
たとえば、全ファイルからサブルーチン名を抜き出したいと思ったとき。
% grep sub * | perl -nle '/sub\s+(\w+)/ and print $1;'
こういうことばっかりやってると、perlが無い環境にいったときに苦労する。
そんな環境滅んでしまえって気もするが。
% grep sub * | sed -n 's/.*sub \([a-zA-Z0-9_]*\).*/\1/p'
sed
man sed
-n, --quiet, --silent
suppress automatic printing of pattern space
info sed
The `s' command can be followed by zero or more of the following FLAGS:
`p'
If the substitution was made, then print the new pattern space.
Note: when both the `p' and `e' options are specified, the
relative ordering of the two produces very different results. In
general, `ep' (evaluate then print) is what you want, but
operating the other way round can be useful for debugging. For
this reason, the current version of GNU `sed' interprets specially
the presence of `p' options both before and after `e', printing
the pattern space before and after evaluation, while in general
flags for the `s' command show their effect just once. This
behavior, although documented, might change in future versions.
最初、manだけ見ててpをコマンドと勘違いした。
2009-01-29
memcachedに手を出してみる
前からやろうやろうと思って逃げてたmemcachedをやってみるテスト
下準備
# yum --enablerepo=rpmforge install memcached # yum install libevent-devel cpan[1]> install Cache::Memcached cpan[2]> install DBIx::Class::Cursor::Cached
起動
# /etc/rc.d/init.d/memcached start
とりあえずread/write
use strict; use warnings; use Data::Dumper; local $\ = "\n"; sub p ($) { print Dumper shift } use Cache::Memcached; my $m = Cache::Memcached->new( +{ servers => ['127.0.0.1:11211'] } ); $m->enable_compress(0); $m->set("k1", "Some value"); p $m->get("k1");
課題
- セッションストアに使ってみる
- DBIx::Classで使ってみる

shipit 使うとバージョンアップも楽になりますよ。
http://search.cpan.org/~bradfitz/ShipIt/lib/ShipIt.pm
ディレクトリで区切られる config はいいですね。
一つのディレクトリだとファイルが増えたときがカオスな事になるので。
問題ないと思います。初 up されたモジュールなんかだと、連続バージョンアップとか結構良くあると思う。
僕はテストが通らなくて連発したことはあります。
shipit便利そうですね、使ってみます。
さっそくバージョンが上がっております。しかも小さな修正とかで。このままでは大差ないまま0.1を迎えてしまう…
色々ありがとうございますー。