Skip to content

Instantly share code, notes, and snippets.

View hayakawa's full-sized avatar

Yuta Hayakawa hayakawa

View GitHub Profile
@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);
}
@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 / 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
<?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 / 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 \
@hayakawa
hayakawa / php.ini
Created April 7, 2017 04:43
php.ini for PHP7.1.x
[PHP]
;;;;;;;;;;;;;;;;;;;
; About php.ini ;
;;;;;;;;;;;;;;;;;;;
; PHP's initialization file, generally called php.ini, is responsible for
; configuring many of the aspects of PHP's behavior.
; PHP attempts to find and load this configuration from a number of locations.
; The following is a summary of its search order:
@hayakawa
hayakawa / build_xdebug.sh
Created April 7, 2017 05:10
Build Xdebug from Source Tarball
#!/bin/bash
# Source: https://github.com/xdebug/xdebug/releases
cd ./xdebug
/usr/local/php71/bin/phpize
./configure --enable-xdebug --with-php-config=/usr/local/php71/bin/php-config
@hayakawa
hayakawa / build_apache24.sh
Created April 7, 2017 05:27
Build Apache 2.4.x from Source Tarball
cd ./apache24
make distclean
./configure \
--prefix=/usr/local/apache2 \
--enable-pie \
--enable-modules=all \
--enable-mods-shared=all \
--enable-authn-dbm \
--enable-authn-anon \
--enable-authn-dbd \
@hayakawa
hayakawa / replace_slink.sh
Last active April 11, 2017 01:54
Replace Symbolic Link for php from Source Tarball
@hayakawa
hayakawa / getCategoryInfo.sql
Created April 19, 2017 00:56
How to get category infomation from wordpress
SELECT a.term_id
, a.name
, a.slug
, b.count
FROM wp_terms a
LEFT JOIN wp_term_taxonomy b
ON a.term_id = b.term_id
WHERE b.taxonomy = 'category';