Skip to content

Instantly share code, notes, and snippets.

@takus
takus / slow_query_log_dump.pl
Created March 27, 2012 23:34
Fetches slow query logs from slow_log table of Amazon RDS
#!/usr/bin/env perl
=pod
Fetches slow query logs from slow_log table of Amazon RDS.
Things to change in this script for your own setup:
<root_user> to your rds root user (e.g. "root")
<root_pass> to your rds root password (e.g. "password")
<host_domain> to your rds host domain (e.g. "hoge.ap-northeast-1.rds.amazonaws.com")
@takus
takus / mongo-purge.pl
Created April 1, 2012 16:12
Purge unnecessary logs from MongoDB
#!/usr/bin/env perl
=pod
purge unnecessary logs from MongoDB
=cut
use strict;
use warnings;
use MongoDB;
@takus
takus / .perltidyrc
Created April 10, 2012 11:15
.perltidyrc described in "Perl Best Practice"
# Max line width is 78 cols
-l=78
# Indent level is 4 cols
-i=4
# Continuation indent is 4 cols
-ci=4
# Output to STDOUT
@takus
takus / install-rails.sh
Created May 6, 2012 13:29
setup new rails project with rbenv & bundler
#!/bin/sh
PROJECT_NAME=$1
if [ $# -ne 1 ]; then
echo "usage: install-rails.sh [RAILS_PROJECT_NAME]" 1>&2
exit 1
fi
cat << EOS > Gemfile
@takus
takus / gist:2625288
Created May 7, 2012 01:22
check executing as root
chomp(my $user = `/usr/bin/whoami`);
unless ($user eq 'root') {
print "cannot exec by $user user.\nyou can execute this script by root only.\n";
exit;
}
@takus
takus / install-homebrew.sh
Created May 16, 2012 16:02
Install Homebrew & Some Terminal Applications
#!/bin/sh
# Install Homebrew
ruby -e "$(curl -fksSL https://raw.github.com/mxcl/homebrew/master/Library/Contributions/install_homebrew.rb)"
brew install \
lv \
git \
tig \
@takus
takus / install-dotfiles.sh
Created May 16, 2012 16:06
setup my dotfiles
#!/bin/sh
chsh -s /bin/zsh
# setup my dotfiles & oh-my-zsh
git clone git://github.com/takus/dotfiles.git ~/.dotfiles
~/.dotfiles/install/install.sh
# Install Vim Plugins with vundle
~/.dotfiles/install/vim-bundle.sh
@takus
takus / install-s3fs.sh
Created July 31, 2012 13:30
install s3fs
#!/bin/sh
## Description:
## install script of s3fs
##
## Usage:
## install-s3fs.sh [mountpoint] [bucketName] [accessKeyId] [secretAccessKey]
MOUNT_POINT=$1
BUCKET_NAME=$2
@takus
takus / redmine2dailyreport.pl
Created November 30, 2012 18:11
generates daily report from redmine issues
#!/usr/bin/env perl
use strict;
use warnings;
use utf8;
binmode STDOUT, ":utf8";
use Config::Pit;
use Redmine::API;
use Encode;
@takus
takus / mq_install.sh
Created December 3, 2012 21:52 — forked from iwata/mqh_install.sh
Installing MySQL5.1 & Q4M on MacOSX Lion
#!/bin/zsh
MYSQL_VERSION=5.1.65
if [ `which perl` = "/usr/bin/perl" ]; then
echo -n -e "\e[1;31mUSING SYSTEM PERL OK? [y/n]\e[m: "
read ANSWER
if [ "$ANSWER" != "y" ]; then
exit 255
fi