Skip to content

Instantly share code, notes, and snippets.

View co3k's full-sized avatar
🔞
"><s>'\

Kousuke Ebihara co3k

🔞
"><s>'\
View GitHub Profile
@co3k
co3k / gist:3903869
Created October 17, 2012 05:36
Git リポジトリ内で ack しようとするとこらーって言うやつ
function ack()
{
if git log -0 &> /dev/null ; then
echo "You are in git repository so you can grep by git-grep command"
else
/usr/local/bin/ack $*
fi
}
@co3k
co3k / generate-bundled-op3-list.php
Created September 5, 2011 11:04
バンドルプラグインリストのデータを読み込み、 OpenPNE の各メジャーバージョンの最新のマイナーバージョンにどのプラグインのどのバージョンがバンドルされているかをリストするやつ
<?php
// To run, you need the Symfony\Yaml and Symfony\ClassLoader.
// You can get these libraries from PEAR installer by the followings:
// $ pear channel-discover pear.symfony.com
// $ pear install symfony2/Yaml
require_once 'Symfony/Component/Yaml/Yaml.php';
require_once 'Symfony/Component/Yaml/Parser.php';
require_once 'Symfony/Component/Yaml/Inline.php';
@co3k
co3k / gist:1099076
Created July 22, 2011 08:17
チケットに含まれるハッシュ値のうち、 stable-3.6.x に含まれるもののみを抽出するワンライナー
curl "https://raw.github.com/gist/1044456/dbe6d1d76e18d90c26c0352f6f8f51d9f68d5d4a/list-commit-hash-from-ticket.php" | sed 's/show\/165/show\/190/' | php | awk '{print "git branch --contains="$1"\|grep -q stable-3.6.x && echo "$1}' | sh
@co3k
co3k / list-commit-hash-from-ticket.php
Created June 24, 2011 08:48
バージョンに紐づいたチケットに紐づいたコミットのハッシュ値っぽい文字列をチケットのページから取ってくるやつ(こいつらのハッシュ値が意図通りのブランチに紐づいているかはちゃんと調べないとダメ)
<?php
$url = 'http://redmine.openpne.jp/versions/show/165';
function getCommitHashList($path)
{
$url = 'http://redmine.openpne.jp'.$path;
$text = file_get_contents($url);
@co3k
co3k / opInteractiveTaskTestHandler.class.php
Created May 16, 2011 12:43
対話型タスクのテストをする奴の書き殴り中実戦投入中の奴
<?php
class opInteractiveTaskTestHandler
{
public $cli, $t, $lastStatus, $resource = null;
public $pipes = array();
public $output = '';
public function __construct($t)
@co3k
co3k / openpneActionListTask.class.php
Created October 29, 2010 05:51
symfony アプリケーションのアクションの一覧を出すやつ
<?php
/**
* This file is part of the OpenPNE package.
* (c) OpenPNE Project (http://www.openpne.jp/)
*
* For the full copyright and license information, please view the LICENSE
* file and the NOTICE file that were distributed with this source code.
*/

XHProf 導入

はじめに

PHP アプリのボトルネックの分析に XHProf を使う。

XHProf は PECL 拡張として提供されている。

#!/usr/bin/env php
<?php
print apc_clear_cache('user') ? 'Remove user cache successfully.' : 'Failed to remove user cache.';
echo PHP_EOL;
print apc_clear_cache() ? 'Remove system cache successfully.' : 'Failed to remove system cache.';
echo PHP_EOL;