Skip to content

Instantly share code, notes, and snippets.

Avatar

Yoshiyuki Hisamatsu karia

View GitHub Profile
@karia
karia / nginx_location.conf
Last active Jun 7, 2019
nginxでlocationと正規表現を使い、条件によって異なる複数の内部ホストにproxyし、パスもスラッシュ区切りで改変する例
View nginx_location.conf
set $a_host internal-a.example.com;
set $b_host internal-b.example.com;
# locationブロックでは3個引数があるかどうかをチェックしてる(単に /a 前方一致だと関係無いリクエストがlocationブロックに紛れ込むため)
location ~ ^/a/(.+)/(.+)/(.+)$ {
rewrite ^/a/(.+)/(.+)/(.+)$ /x=$1,y=$2/$3 break;
proxy_pass https://$a_host;
}
@karia
karia / alb_count5xx.sh
Created Jan 30, 2018
5xx status count for AWS ALB log file
View alb_count5xx.sh
echo "day,total,5xx"
for i in `seq -w 01 10`
do
echo ${i},`gzcat ${i}/*.gz | wc -l`,`gzcat ${i}/*.gz | awk '$9 ~ /^5/{print $9}' | wc -l`
done
View pukiwiki.cls.php
<?php
/**
* PukiWiki Plus! notification for slack
*
* @copyright Copyright &copy; 2011-2015, karia <karia@side2.net> Sho Sawada <s@shao.jp>
* @author karia <karia@side2.net> Sho Sawada <s@shao.jp>
* @version $Id: notify.cls.php,v 0.2 2015/12/21 00:15:00 upk Exp $
* @license http://opensource.org/licenses/gpl-license.php GNU Public License (GPL2)
*/