redis = Redis.new(:host => '127.0.0.1', :driver => :ruby)
10000.times { x = (Benchmark.measure { redis.ping }.real * 1000); puts x if x>1 }
34.964799880981445
53.375959396362305
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
APP_ROOT = "/home/developer/exchanger/current" | |
before_exec do |server| | |
# Fixing gemfile not found error | |
# stop, startしてる場合は不要 | |
# USR2 -> WINCH -> QUITで無停止でrestartしてる場合は必要 | |
ENV['BUNDLE_GEMFILE'] = "#{APP_ROOT}/Gemfile" | |
end | |
before_fork do |server, worker| |
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
limit = 200 | |
post_table = Post.arel_table | |
visibility_ids = PostVisibility.select(:post_id).where(user_id: 1).order(id: :desc).limit(limit).arel.as('t') | |
inner_query = Arel::Table.new(:tmp).project(:post_id).from(visibility_ids.to_sql) | |
Post.where(post_table[:is_public].eq(true).or(post_table[:id].in(inner_query))).limit(limit) |
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
[core] | |
pager = "lv -c" | |
editor = vim | |
autocrlf = input #CRLFを自動変換 | |
precomposeunicode = true | |
[alias] | |
s = status | |
st = status | |
ci = commit |
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
# .bashrc | |
# Source global definitions | |
if [ -f /etc/bashrc ]; then | |
. /etc/bashrc | |
fi | |
peco-select-history() { | |
declare l=$(HISTTIMEFORMAT= history | sort -k1,1nr | perl -ne 'BEGIN { my @lines = (); } s/^\s*\d+\s*//; $in=$_; if (!(grep {$in eq $_} @lines)) { push(@lines, $in); print $in; }' | peco --query "$READLINE_LINE") |
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
select | |
trim(pgdb.datname) as Database, | |
trim(pgn.nspname) as Schema, | |
trim(a.name) as Table, | |
b.mbytes, | |
(CAST(b.mbytes as double precision) / 1024) as gbytes, | |
(CAST(b.mbytes as double precision) / 1048576) as tbytes, | |
a.rows, | |
to_char(a.rows, '999,999,999,999,999') as rows_ww, | |
to_char(a.rows, '9999,9999,9999,9999') as rows_jp |
OlderNewer