Skip to content

Instantly share code, notes, and snippets.

View yteraoka's full-sized avatar

Yoshinori Teraoka yteraoka

View GitHub Profile
@yteraoka
yteraoka / mod_headers-toenv.patch
Created March 6, 2013 10:27
特定の Response Header の値を環境変数にコピーして Header を削除する機能を mod_headers に追加する patch for Apache 2.4.4
diff -uNr httpd-2.4.4.orig/modules/metadata/mod_headers.c httpd-2.4.4/modules/metadata/mod_headers.c
--- httpd-2.4.4.orig/modules/metadata/mod_headers.c 2012-12-09 22:20:13.000000000 +0900
+++ httpd-2.4.4/modules/metadata/mod_headers.c 2013-02-27 19:37:08.466361782 +0900
@@ -96,7 +96,8 @@
hdr_unset = 'u', /* unset header */
hdr_echo = 'e', /* echo headers from request to response */
hdr_edit = 'r', /* change value by regexp, match once */
- hdr_edit_r = 'R' /* change value by regexp, everymatch */
+ hdr_edit_r = 'R', /* change value by regexp, everymatch */
+ hdr_toenv = 'E' /* copy to subprocess_env and unset */
@yteraoka
yteraoka / puki2doku.pl
Last active December 16, 2015 05:09
PukiWiki から DokuWIki への移行スクリプト (ファイルの埋め込みは未対応) 汚いけど使い捨てだし動けばいいから。 https://github.com/yteraoka/puki2doku に移しました。
puki2doku.pl has moved to https://github.com/yteraoka/puki2doku
@yteraoka
yteraoka / cronolog-symlink.patch
Created May 21, 2013 11:13
EPEL の cronolog に取り込まれていなかった symlink patch
@yteraoka
yteraoka / register_read_type_line.pl
Created May 22, 2013 13:09
CR (Carriage Return) で Cinnamon が期待通りに動作しない件
register_read_type line => sub {
my ($self, $cb, $eol) = @_;
if (@_ < 3) {
# this is more than twice as fast as the generic code below
sub {
$_[0]{rbuf} =~ s/^([^\015\012]*)(\015?\012)// or return;
$cb->($_[0], "$1", "$2");
1
@yteraoka
yteraoka / jpaddr.pl
Last active December 19, 2015 22:29
APNIC の IP Address リストから日本に割り当てられている CIDR のリストを抽出する
#!/usr/bin/perl
#
# http://ftp.apnic.net/stats/apnic/delegated-apnic-latest
#
#
use strict;
use warnings;
print "#" x 78 ."\n";
print "# \$Id\$\n";
@yteraoka
yteraoka / file0.txt
Created August 5, 2013 14:44
標準入力から Bash script を実行する場合に引数を渡す方法 ref: http://qiita.com/yteraoka/items/b592dc147f233564dc24
$ echo 'echo $1; echo $2' | bash hoge fuga
bash: hoge: No such file or directory
@yteraoka
yteraoka / mysqld_spec.rb
Created August 5, 2013 15:22
Ansible Tutorial の ServerSpec 設定例 (mysqld のチェック)
require 'spec_helper'
describe package('mysql-server') do
it { should be_installed }
end
describe service('mysqld') do
it { should be_enabled }
it { should be_running }
end
@yteraoka
yteraoka / wordpress_spec.rb
Last active December 20, 2015 19:49
Ansible Tutorial の ServerSpec 設定例 (WordPress のチェック)
# coding: ascii-8bit
require 'spec_helper'
describe command('/usr/bin/curl -s http://localhost/wp-admin/install.php') do
it { should return_stdout /5分でできる WordPress の有名なインストールプロセスへようこそ/ }
end
@yteraoka
yteraoka / file0.txt
Created August 30, 2013 10:42
ttyrec でターミナルの録画・再生 ref: http://qiita.com/yteraoka/items/ea85f094f7c934e78e11
$ sudo yum -y install compat-glibc-headers
$ git clone git://git.kitenet.net/ttyrec.git
$ cd ttyrec
$ make CFLAGS="-DSVR4 -D_XOPEN_SOURCE=500 -I/usr/lib/x86_64-redhat-linux5E/include"
@yteraoka
yteraoka / NG
Created September 9, 2013 14:46
Ansible の YAML で「:」を使う方法 ref: http://qiita.com/yteraoka/items/2afaa39d0635c7af1de4
- lineinfile: >
regexp='^%wheel'
line='%wheel ALL=(ALL) NOPASSWD: ALL'
dest=/etc/sudoers