2007-04-17
■ Plagger
FedoraCore6なので
# rpm -ivh http://pub.woremacx.com/worepo/worepo-release-6.rpm
# yum install perl-Plagger
2007-04-15
■ [Server] Tripwire
インストール
# wget http://jaist.dl.sourceforge.net/sourceforge/tripwire/tripwire-2.4.1.1-src.tar.bz2
# tar jxvf tripwire-2.4.1.1-src.tar.bz2
# cd tripwire-2.4.1.1
twadmin -m G -S /etc/tripwire# vi install/install.cfg
TWPOLICY="/etc/tripwire" TWDB="/var/lib/tripwire"
# ./configure
# make
# make install
設定
# vi /etc/tripwire/twpolmake.rb
#!/usr/bin/env ruby
in_rule = false;
ARGF.each do |line|
line.chomp!
if line =~ /^\{/
in_rule = true
elsif line =~ /^\}/
in_rule = false
elsif in_rule and line =~ /^(\s*\#?\s*)(\/\S+)\b(\s+->\s+.+)$/
sharp = $1
path = $2
cond = $3
if File.exist?(path)
line = "#{sharp.gsub(/\#/, '')}#{path}#{cond}"
else
line = "#{sharp}\##{path}#{cond}" if sharp !~ /\#/
end
end
puts line
end
最適化
# cat /etc/tripwire/twpol.txt | ruby /etc/tripwire/twpolmake.rb > /etc/tripwire/twpol.txt.new
# twadmin -m P -c /etc/tripwire/tw.cfg -p /etc/tripwire/tw.pol -S /etc/tripwire/site.key /etc/tripwire/twpol.txt.new
DB作成
# tripwire -m i -s -c /etc/tripwire/tw.cfg
# rm -f /etc/tripwire/*.txt
定期ファイル作成
# vi tripwire.sh
#!/bin/bash PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/bin # パスフレーズ設定 LOCALPASS=******** # ローカルキーファイルパスフレーズ SITEPASS=******** # サイトキーファイルパスフレーズ MAILTO=root # チェック結果をメールで送る際の送信先 cd /etc/tripwire # Tripwireチェック実行 tripwire -m c -s -c tw.cfg|mail -s "Tripwire(R) Integrity Check Report in `hostname`" $MAILTO # ポリシーファイル最新化 twadmin -m p -c tw.cfg -p tw.pol -S site.key | ruby twpolmake.rb > twpol.txt.new twadmin -m P -c tw.cfg -p tw.pol -S site.key -Q $SITEPASS twpol.txt.new > /dev/null rm -f twpol.txt* rm -f *.bak # データベース最新化 rm -f /var/lib/tripwire/*.twd* tripwire -m i -s -c tw.cfg -P $LOCALPASS
# chmod 700 tripwire.sh
# mv tripwire.sh /etc/cron.daily
2007-04-11
■ [JQuery] $重複
JQuery結構使ってるけど、重複の避け方があったとはしらなんだ。
$関数を使っているライブラリは多いから、安心だね。
jQuery.noConflict();
// Do something with jQuery
jQuery("div p").hide();
// Do something with another library's $()
$("content").style.display = 'none';
2007-04-05
■ [PHP] Symfony 動作[1]
1.${project_root}\apps\${app_name}\modules\${module_name}\actions\actions.class.phpに追加
public function executeMyAction()
{
$today = getdate();
$this->hour = $today['hours'];
}
2.${project_root}\apps\${app_name}\modules\${module_name}\templates\にmyActionSuccess.phpを作成
<p>Hello, world!</p> <?php if ($hour >= 18): ?> <p>Or should I say good evening? It's already <?php echo $hour ?>.</p> <?php endif; ?>
3.http://localhost/${app_name}_dev.php/${module_name}/myAction
Hello, world! Or should I say good evening? It's already 21.
2007-04-04
■ [PHP] Symfony インストール
インストール
# pear install http://phing.info/pear/phing-current.tgz
# pear channel-discover pear.symfony-project.co
# pear install symfony/symfony
プロジェクトのセットアップ
# mkdir test
# cd test
# symfony init-project test
アプリケーションのセットアップ
#symfony init-app myapp
WEBServerのSetUp
httpd.confに追加
モジュールのセットアップ
# symfony init-module test testmodule
2007-04-03
■[言語] WEBアプリケーションフレームワーク
[Ruby]
Ruby on Rails
[Python]
django
turbogears
[Perl]
catalyst
http://www.catalystframework.org/
[PHP]
maple [PHP4,5]
symfony [PHP5]
2007-03-29
■ [Perl] LWP::UserAgent
use LWP::UserAgent;
use HTTP::Request::Common qw(POST);
my $url = 'http://xxxxxxx/xxx/’;
my %formdata = ('user' => 'hogehoge', 'password' => 'password');
my $request = POST($url, [%formdata]);
my $ua = LWP::UserAgent->new;
$ua->agent("Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)");
my $res = $ua->request($request);
print $res->as_string;

