Skip to content

Instantly share code, notes, and snippets.

######################################
# usage
# mylogin_dumper.pl ~/.mylogin.conf
######################################
use strict;
use warnings;
use Crypt::ECB;
#use Crypt::OpenSSL::AES;
my $my_login_file = shift;
@ijin
ijin / td-agent.logrotate
Created March 26, 2013 03:22
td-agent logrotate setting
/var/log/td-agent/*.log {
daily
rotate 10
compress
delaycompress
notifempty
create 640 td-agent td-agent
sharedscripts
postrotate
pid=/var/run/td-agent/td-agent.pid
@ijin
ijin / rbenv-passenger-memory-stats.sh
Created March 13, 2013 07:53
rbenv enalbed passenger-memory-stats
#!/bin/bash
export PATH=/usr/local/rbenv/shims:/usr/local/rbenv/bin:$PATH
# Passenger needs to find httpd for passenger-memory-stats
export HTTPD=/opt/nginx/sbin/nginx
source /usr/local/rbenv/completions/rbenv.bash
rbenv rehash
passenger-memory-stats $2
@ijin
ijin / munin_passenger_status.rb
Created March 11, 2013 09:05
gets munin stats for passenger using rbenv. requires rbenv-passenger.sh (https://gist.github.com/ijin/5132906)
#!/usr/bin/env ruby
def output_config
puts <<-END
graph_category passenger
graph_title status
graph_vlabel count
graph_info This graph shows how much passenger process are working, available and how much queries are waiting.
max.label max processes
max.draw AREA
@ijin
ijin / rbenv-passenger.sh
Created March 11, 2013 08:59
executes passenger commands through rbenv
#!/bin/bash
export PATH=/usr/local/rbenv/shims:/usr/local/rbenv/bin:$PATH
# Passenger needs to find httpd for passenger-memory-stats
export HTTPD=/opt/nginx/sbin/nginx
source /usr/local/rbenv/completions/rbenv.bash
rbenv rehash
COMMAND_END=${1:-status}
@ijin
ijin / webdis.conf
Created December 19, 2012 06:34
webdis upstart
# webdis
description "webdis control"
author "Michael H. Oshita"
#start on (local-filesystems and net-device-up IFACE=eth0)
start on redis
stop on shutdown
# monit does this
#! /bin/sh
### BEGIN INIT INFO
# Provides: redis-server
# Required-Start: $syslog
# Required-Stop: $syslog
# Should-Start: $local_fs
# Should-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: redis-server - Persistent key-value db
@ijin
ijin / update.conf
Created December 3, 2012 01:10
upstart script to sync deploy from admin node & restart service
description "Update source code"
start on filesystem
stop on shutdown
task
console output
script
time sudo -u deploy rsync -av --delete -e 'ssh -c arcfour -i /home/deploy/.ssh/id_dsa -o StrictHostKeyChecking=no' [email protected]:/usr/local/apps/project/ /usr/local/rails_apps/project >> /mnt/update.log 2>&1
@ijin
ijin / gist:4017170
Created November 5, 2012 13:26
isucon2 errors
{"No one tickets are rendered in /ticket/x":25}
{"No one tickets are rendered in /ticket/x":20}
{"No one tickets are rendered in /ticket/x":24}
{"No one tickets are rendered in /ticket/x":21}
Main Bench:agent bench command execute error, code:1
GET failure response too many, success response: 87%
@ijin
ijin / gist:4017160
Created November 5, 2012 13:23
isucon2 access distribution
$grep "POST" access_log | wc -l
960
$ grep "GET /js/" access_log | wc -l
1663
$ grep "GET /css/" access_log | wc -l
1113
$ grep "GET /images/" access_log | wc -l
539
$ grep "GET /ticket/" access_log | wc -l
1561