Hatena::ブログ(Diary)

SeBrain RSSフィード

2007-04-17

Plagger 01:44

FedoraCore6なので

# rpm -ivh http://pub.woremacx.com/worepo/worepo-release-6.rpm

# yum install perl-Plagger

2007-04-15

[Server] Tripwire 17:57

インストール

# 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] $重複 21:42

JQuery結構使ってるけど、重複の避け方があったとはしらなんだ。

$関数を使っているライブラリは多いから、安心だね。

jQuery.noConflict();

// Do something with jQuery

jQuery("div p").hide();

// Do something with another library's $()

$("content").style.display = 'none';

2007-04-10

[雑記] Window出さずにBat起動 22:04

CreateObject("WScript.Shell").Run "C:\test.bat",0

VBS使えばいけるのか。。

2007-04-05

[PHP] Symfony 動作[1] 21:41

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 インストール 14:06

インストール

# 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

http://xxxx.com/index.php/testmoduleにアクセス

2007-04-03

[] WEBアプリケーションフレームワーク 13:32

[Ruby]

Ruby on Rails

http://www.rubyonrails.org/


[Python]

django

http://www.djangoproject.com/

turbogears

http://www.turbogears.org/

[Perl]

catalyst

http://www.catalystframework.org/

[PHP]

maple [PHP4,5]

http://kunit.jp/maple/

symfony [PHP5]

http://www.symfony-project.com/

2007-04-02

[Perl] 数値 12:55

数値は全て内部的には倍精度浮動小数点数

[雑記]Server購入 00:30

PowerEdgeTM SC440

デュアルコア インテル® Xeon® プロセッサー 3040 (1.86GHz, 2MB L2 Cache, 1066MHz FSB)

512MB (512MBx1) DDR2-SDRAMメモリ

80GB 7200回転 SATA II 3.5" HDD

2007-03-29

[雑記] ほげ学 13:31

screenshot

ほげほげ

[Perl] LWP::UserAgent 14:08

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;

2007-03-27

[雑記] 2007-03-27 23:11

楽しそう

screenshot