Apache の mod_filter で正規表現のデリミタのエスケープが効かない問題

Apache 2.1 以降では AddOutputFilterByType による設定は非推奨 になっている為、同等の事をやるには mod_filter を利用することになるが、

FilterDeclare gzip CONTENT_SET
FilterProvider gzip DEFLATE Content-Type /^text\/.+/
FilterChain gzip

の様に / を含む正規表現を設定すると Bad regexp エラーが出る。

打開策は / を \x2F に置き換える。

FilterProvider gzip DEFLATE Content-Type /^text\x2F.+/

なお、本問題は 2.2.21 で直った模様。

ちなみに書式が大幅に変わってる 2.4 からは代替デリミタの書式が使える。

FilterProvider gzip DEFLATE "%{CONTENT_TYPE} =~ m|^text/.+|i"

PHP でフィボ・トリボ・テトラナッチ数とリュカ数

$ curl -skL https://gist.github.com/raw/5028200 | php
string(64) "0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987"
string(55) "0, 0, 1, 1, 2, 4, 7, 13, 24, 44, 81, 149, 274, 504, 927"
string(54) "0, 0, 0, 1, 1, 2, 4, 8, 15, 29, 56, 108, 208, 401, 773"
string(58) "2, 1, 3, 4, 7, 11, 18, 29, 47, 76, 123, 199, 322, 521, 843"

コード

PHP >= 5.4.0

git commit が受けつける date フォーマット

RFC2822 や Unixtime を受けつけてくれる。

RFC2822 (※スペースが含まれるのでクオート必須)

$ git commit --amend --no-edit --date="$(date --rfc-2822)"

Unixtime

$ git commit --amend --no-edit --date=$(date +%s)