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"
Windows 版 emacs のポータブル化
以下のスクリプトを emacs ディレクトリ直下 (README.W32 とかがある所) に配置し、実行する。
*nix, Windows 向けの Ricty をさくっと生成する
https://github.com/waltarix/ricty_generator
生成方法は README.md に記載。
生成されるものは生 Ricty、そして Discord の ascii 版と Powerline 版。
Discord はデフォルトで l のみ改変するように。
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)
zsh で httpstatus
httpstatus コマンドで、HTTP のステータスコードをすばやくしらべる! - tokuhirom's blog. の zsh 版。
使用例
$ curl -kL https://gist.github.com/raw/5023212 >> $ZDOTDIR/.zshrc $ source $ZDOTDIR/.zshrc $ httpstatus 200 OK