Skip to content

Instantly share code, notes, and snippets.

View hayakawa's full-sized avatar

Yuta Hayakawa hayakawa

View GitHub Profile
@hayakawa
hayakawa / build_php71.sh
Last active April 7, 2017 04:59
Build PHP 7.1.x from Source Tarball
#!/bin/bash
# Source: http://www.php.net/
cd ./php71
./configure \
\
--prefix=/usr/local/php71 \
\
--with-apxs2=/usr/local/apache2/bin/apxs \
<?php
// 置換元と置換先のマップは配列で用意
$search = array("が","ぎ","ぐ","げ","ご","ざ","じ","ず","ぜ","ぞ","だ","ぢ","づ","で","ど","ば","び","ぶ","べ","ぼ","ぱ","ぴ","ぷ","ぺ","ぽ","ガ","ギ","グ","ゲ","ゴ","ザ","ジ","ズ","ゼ","ゾ","ダ","ヂ","ヅ","デ","ド","バ","ビ","ブ","ベ","ボ","パ","ピ","プ","ペ","ポ");
$replace = array("が","ぎ","ぐ","げ","ご","ざ","じ","ず","ぜ","ぞ","だ","ぢ","づ","で","ど","ば","び","ぶ","べ","ぼ","ぱ","ぴ","ぷ","ぺ","ぽ","ガ","ギ","グ","ゲ","ゴ","ザ","ジ","ズ","ゼ","ゾ","ダ","ヂ","ヅ","デ","ド","バ","ビ","ブ","ベ","ボ","パ","ピ","プ","ペ","ポ");
// 引数が適正かをチェック
if ($argc > 1 and !empty($argv[1]) and is_dir($argv[1]) and is_writable($argv[1])) {
// 引数値を正規化
$dirpath = str_replace('//', '/', trim($argv[1] . '/'));
@hayakawa
hayakawa / devenv.sh
Created July 10, 2014 15:58
devenv.sh
#!/bin/bash
function apache() {
case "$1" in
"start" | "stop")
sudo /usr/sbin/apachectl $1;
;;
"status" )
apachestat=`ps -efww|grep "httpd"|grep -v grep|wc -l`;
if [ ${apachestat} -gt 0 ]; then
@hayakawa
hayakawa / usrgrp_add.sh
Created June 6, 2014 12:57
usrgrp_add.sh
#!/bin/bash
# Pre-check
if [ -f ./group.list ];
then
echo "[SUCCESS] ./group.list is found"
else
echo "[ERROR] ./group.list file is not found.";
exit 1;
fi
@hayakawa
hayakawa / wordpress-xmlrpc-pingback-checker.php
Last active August 29, 2015 13:57
Wordpress XML-RPC Pingback checker
<?php
if ($argc != 2 or empty($argv[1])) {
echo "Usage : $argv[0] {CHECK TARGET}\n";
echo "Example: $argv[0] http://www.example.com/wp/xmlrpc.php\n";
exit(1);
} elseif (!preg_match("/^(http|https):\/\//",$argv[1])) {
echo "Invalid URL\n";
exit(1);
}