Skip to content

Instantly share code, notes, and snippets.

View ichikaway's full-sized avatar

Yasushi Ichikawa (ichikaway) ichikaway

View GitHub Profile
@ichikaway
ichikaway / gist:1633366
Created January 18, 2012 14:57
/root/onMemoryDeploy.sh
#!/bin/sh
MYSQL=/etc/rc.d/init.d/mysql
MEMDIR=/dev/shm
MEM_MYSQL=$MEMDIR/mysql
LIBDIR=/var/lib
ORIGDIR=$LIBDIR/mysql
@ichikaway
ichikaway / gist:1633368
Created January 18, 2012 14:58
/etc/rc.d/init.d/onMemoryMySQL
#!/bin/bash
#
# Startup script for onMemoryMySQL
# chkconfig: 345 85 15
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/usr/sbin:/usr/bin:/bin
test -f /root/onMemoryDeploy.sh || exit 0
@ichikaway
ichikaway / gist:1832549
Created February 15, 2012 02:11
stream wrapper for variable input
<?php
/**
* stream wrapper for variable input
* usage:
* $val = 'Hello <?php echo "World"; ?> hehe.';
* stream_wrapper_register("var", "VariableStream");
* include("var://".urlencode($val));
**/
class VariableStream {
public $position;
@ichikaway
ichikaway / gist:2768801
Created May 22, 2012 12:37
RecursiveIteratorIterator example
<?php
Class TableRII extends RecursiveIteratorIterator {
private $parentKey = null;
public function beginIteration() {
echo '<table border=1><tr><th>key</th><th>value</th></tr>';
}
public function endIteration() {
echo '</table>';
@ichikaway
ichikaway / gist:3129900
Created July 17, 2012 14:59
check copy on write of PHP
<?php
$GLOBALS['memstart'] = memory_get_usage();
function mem() {
$m2 = memory_get_usage();
echo $m2 - $GLOBALS['memstart'] ."\n";
}
class Foo {
public function bar($x = null){
@ichikaway
ichikaway / gist:3291004
Created August 8, 2012 00:48
put current branch name on input cursor(need bash version 4)
bind -x '"\C-o": READLINE_LINE="${READLINE_LINE:0:$READLINE_POINT}
`git symbolic-ref HEAD | cut -d/ -f 3` ${READLINE_LINE:${READLINE_POINT}}"'
@ichikaway
ichikaway / gist:3300279
Created August 9, 2012 01:58
cache router url
diff --git a/lib/Cake/Routing/Router.php b/lib/Cake/Routing/Router.php
index cb28f6e..c6a38c3 100644
--- a/lib/Cake/Routing/Router.php
+++ b/lib/Cake/Routing/Router.php
@@ -810,23 +810,30 @@ class Router {
$url += array('controller' => $params['controller'], 'plugin' => $params['plugin']);
- $match = false;
+ $cacheKey = 'Router-' . sha1(serialize($url));
@ichikaway
ichikaway / CircleCI-VAddy-sample.yml
Last active August 29, 2015 14:10
CircleCI-VAddy-sample
test:
override:
- ./test.sh
deployment:
staging:
branch: master
commands:
- ./deploy.sh
- git clone [email protected]:vaddy/vaddy-api-ruby.git && rvm use 2.1.0 && cd ./vaddy-api-ruby/ && ruby vaddy.rb
- ./deploy2.sh
@ichikaway
ichikaway / gist:e20450fe1910f760c613
Last active August 29, 2015 14:21
VAddy Codeship Config Sample
./unit-test.sh
./deploy-staging.sh
git clone [email protected]:vaddy/vaddy-api-ruby.git && cd ./vaddy-api-ruby && ruby vaddy.rb && cd ../
./deploy-production.sh
@ichikaway
ichikaway / bash example
Last active August 2, 2016 07:43
bash_example.sh
ctl + a : 行頭移動
ctl + e : 行末移動
esc + b : 一単語左へ移動
esc + f : 一単語右へ移動
ctl + u : カーソルから左をすべて削除
ctl + k : カーソルから右をすべて削除
ctl + d : カーソル文字削除
ctl + h : カーソル前の文字削除