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
function bz { | |
if [ -n "$1" -a -e "$1" ]; then | |
if [ -d "$1" ]; then | |
filename=`echo $1 | sed -e "s/\/$//"` | |
tar jcf "${filename}.tar.bz2" "$1" | |
else | |
bzip2 -zk -9 "$1" | |
fi | |
fi | |
} |
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
function op { | |
if [ -n "$1" -a -e "$1" ]; then | |
open $1 | |
else | |
open . | |
fi | |
} |
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
function vissh { | |
vi ~/.ssh/config.d/$1 | |
cat ~/.ssh/config.d/* > ~/.ssh/config | |
} |
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
function pm { | |
if [ -n "$1" ]; then | |
ps aux | grep $1 | grep -v grep | awk '{printf ("%dK\t%s\n",$6,$11)}' | |
fi | |
} |
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
# coding: utf-8 | |
# | |
# HOW TO USE: | |
# ruby invalidation.rb /index.html /test/index.html | |
# | |
# | |
gem_home = `echo $GEM_HOME` | |
gem_home = gem_home.gsub(/\n$/, '') | |
require "#{gem_home}/gems/cloudfront-invalidator-0.2.0/lib/cloudfront-invalidator.rb" |
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
# coding: utf-8 | |
# | |
# 使用したいモデルでインクルード | |
# ex) include FileRenamer | |
module FileRenamer | |
extend ActiveSupport::Concern | |
module ClassMethods | |
# paperclipのattachmentのファイルをリネームする |
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
# 使用したいモデルでインクルード | |
# ex) include Concerns::ActivityTracker | |
module Concerns::PublicActivityTracker | |
extend ActiveSupport::Concern | |
module ClassMethods | |
# create, update, destroy を監視します。 | |
# 引数に only か except を渡すことで update を監視したいカラムを限定できます。 | |
# |
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
DROP PROCEDURE IF EXISTS insert_data; | |
-- SQLの区切り文字を変更しておく | |
DELIMITER // | |
-- ストアドプロシージャを作成 | |
CREATE PROCEDURE insert_data() | |
BEGIN | |
SET @i:= 1; | |
WHILE(@i <= 10000000) DO |
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
[us-east-1] | |
3661 ms | |
3692 ms | |
3529 ms | |
3172 ms | |
3258 ms | |
3051 ms | |
3386 ms | |
2906 ms | |
4247 ms |
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
#!/usr/local/rvm/rubies/ruby-2.1.1/bin/ruby | |
class Send2s3 | |
require 'aws-sdk-core' | |
REGION = 'ap-northeast-1' | |
BUCKET = 'bucket-name' | |
LOG_DIR = 'staging/' | |
def initialize |
OlderNewer