sudo cpanm install Sys::PageCache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ssh $HOSTNAME "ps -e -o comm= | sort | uniq" > /tmp/processlist | |
diff -u <(ps -e -o comm= | sort | uniq) /tmp/processlist | egrep "^[-+]" | |
rm /tmp/processlist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo sh -c "cd /usr/local/src/ruby-build && git pull origin master && ./install.sh && cd /usr/local/rbenv && git pull origin master && source /etc/profile && eval $(rbenv init -) && rbenv install 2.2.3 && rbenv shell 2.2.3 && gem install bundler --no-ri --no-rdoc && rbenv rehash" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
apt-get update | |
apt-get -y install autoconf automake build-essential libass-dev libfreetype6-dev libgpac-dev \ | |
libtheora-dev libtool libvorbis-dev pkg-config texi2html zlib1g-dev | |
apt-get install -y yasm | |
## install lame | |
apt-get install -y libmp3lame-dev | |
apt-get install -y unzip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ionice | |
sudo ionice -c2 -n7 nice -n19 du -sh * | |
# check current running unicorn ruby version | |
pgrep -f unicorn -l | grep master | cut -d' ' -f1 | sudo xargs -I{} readlink -f /proc/{}/exe | xargs -I{} sh -c "{} -v" | |
# curl view header (not HEAD) | |
curl -D - -s -o /dev/null "http://google.com" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git push origin `git rev-parse --abbrev-ref HEAD` | |
git branch --merged | egrep -v 'master|\*' | xargs -n1 git branch -d |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'timeout' | |
require 'shellwords' | |
cmd = "foo" | |
out = "bar.out" | |
cmd = "#{cmd} -o #{Shellwords.escape(out)}" | |
timeout = 1 | |
# puts cmd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.level = WARNING | |
handlers= java.util.logging.FileHandler | |
java.util.logging.FileHandler.pattern = client_log_%u.log | |
java.util.logging.FileHandler.limit = 50000 | |
java.util.logging.FileHandler.count = 1 | |
java.util.logging.FileHandler.append = true | |
java.util.logging.FileHandler.formatter = java.util.logging.SimpleFormatter | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$db = new PDO("sqlite:test.db") | |
$fpdo = new FluentPDO($db); | |
$fpdo->from('hogehoge_table') | |
->where(['id >= ?' => $id]) | |
->select(null) | |
->select('column, value'); | |
// SELECT column, value FROM hogehoge_table WHERE id >= ?; | |
$data = $fpdo->fetchAll(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
header('Content-type: application/json'); | |
$klein->respond('GET', '/users/[:id].[json:format]?', function ($req, $res, $serv, $app) { | |
$id = $req->param('id'); | |
return json_encode(['id' => $id]); | |
}); |