This file contains hidden or 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
#-*- coding: utf-8 -*- | |
#-*- mode: ruby-mode;-*- | |
$out_dir = 'build' | |
def run_test | |
system("cd #{$out_dir}; make all && ./a.out -vmodule='hoge=0,foo=2' -logtostderr=1") | |
end | |
watch('CMakeLists.txt'){|md| | |
run_test |
This file contains hidden or 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
ruby -e "puts STDIN.map{|line| line.split(/ /)}.select{|log| log[-1].to_f > 5.0 }.map{|log| log.join(' ')}" < access.log | |
#色付き | |
ruby -e "puts STDIN.map{|line| line.chomp.split(/ /)}.select{|log| log[-1].to_f > 5.0 }.map{|log| log[-1]=\"\e[31m\"+log[-1]+\"\e[0m\"; log.join(' ')}" < access.log |
This file contains hidden or 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 | |
// htaccessのかわり | |
$real_file = $_SERVER['DOCUMENT_ROOT'] . $_SERVER['REQUEST_URI']; | |
if (file_exists($real_file)) { | |
return false; | |
} | |
if (!preg_match('/^\/(?:index\.php|images|robots\.txt)/', $_SERVER['REQUEST_URI'])) { |
This file contains hidden or 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/sh | |
BACKUP_DIR="${HOME}/backup" | |
TMPFILE="/tmp/backup_xtra.tmp" | |
MY_CONF="/etc/my.cnf" | |
XTRABACKUP="/usr/bin/innobackupex" | |
USER="root" | |
PASSWORD="--password=ぱすわーど" | |
LOCKFILE=`basename $0`.lock | |
ON_SLAVE='--slave-info --safe-slave-backup' |
This file contains hidden or 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
#!/usr/bin/env ruby | |
# -*- coding: utf-8 -*- | |
require 'cool.io' | |
class Handler < Coolio::Socket | |
def initialize(io, on_message) | |
super(io) | |
if io.is_a?(TCPSocket) | |
opt = [1, @timeout.to_i].pack('I!I!') # { int l_onoff; int l_linger; } |
This file contains hidden or 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
# -*- coding: utf-8 -*- | |
require 'benchmark' | |
require "securerandom" | |
namespace :dev do | |
desc "benchmark mem vs redis" | |
task :benchmark => :environment do | |
dev_server = '172.19.60.176' | |
n = 10000 |
This file contains hidden or 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
{ | |
"keys": ["ctrl+="], | |
"command": "repl_open", | |
"args" : { | |
"type":"subprocess", | |
"external_id":"ruby", | |
"encoding":"utf8", | |
"soft_quit":"\nexit\n", | |
"cwd":"$file_path", | |
"cmd_postfix":"\n", |
This file contains hidden or 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/sh | |
# enable debug mode | |
if [ "$DEBUG" = "yes" ]; then | |
set -x | |
fi | |
usage() { | |
echo "usage: git merge-master <release_version>" | |
echo |
This file contains hidden or 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 | |
CONTAINERS=(app mysql redis memcached) | |
for container in ${CONTAINERS[@]}; do | |
container_id=$(sudo docker run -d -dns 172.17.42.1 tabito/centos_base) | |
echo "$(sudo docker inspect ${container_id} | grep IPAddress | cut -d '"' -f 4) ${container}.local" | sudo tee -a /etc/hosts | |
done |
This file contains hidden or 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/sh | |
# | |
# newrelic-sysmond <summary> | |
# | |
# chkconfig: 2345 80 20 | |
# description: Starts and stops the New Relic Server Monitor Daemon. | |
# processname: nrsysmond | |
# config: /etc/newrelic/nrsysmond.cfg | |
LANG=C |