Skip to content

Instantly share code, notes, and snippets.

View koko1000ban's full-sized avatar
🏠
Working from home

たびと koko1000ban

🏠
Working from home
View GitHub Profile
@koko1000ban
koko1000ban / overflow_job_requirements.md
Last active January 16, 2020 01:45
overflow 採用

overflow 採用

概要

弊社サービス全般の新規サービス開発、既存サービスの機能改善、新規機能開発、設計・開発・運用など全般をお任せします。 CTOと共に今後もなくならないサービスを開発したいというエンジニアの方を募集しています。

overflowにおけるプロダクト開発とは

弊社は、「時間をつくる」というビジョンの元、

@koko1000ban
koko1000ban / show_table_size.sql
Created December 11, 2014 01:42
Redshift容量確認
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
@koko1000ban
koko1000ban / .bashrc
Last active August 29, 2015 14:06
ISUCON用のdotfiles
# .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")
@koko1000ban
koko1000ban / .gitconfig
Created September 16, 2014 05:06
gitconfig
[core]
pager = "lv -c"
editor = vim
autocrlf = input #CRLFを自動変換
precomposeunicode = true
[alias]
s = status
st = status
ci = commit
@koko1000ban
koko1000ban / redis_on_ruby.md
Created August 14, 2014 08:06
Redis on ruby tunning

Redis Tunning

use hiredis

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
@koko1000ban
koko1000ban / nested_query_in_arel.rb
Last active August 29, 2015 13:58
Nested query in Arel
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)
@koko1000ban
koko1000ban / unicorn_example.rb
Last active August 29, 2015 13:55
unicorn config example
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|
@koko1000ban
koko1000ban / newrelic-sysmond
Created January 9, 2014 05:11
newrelic_nrsysmond
#!/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
@koko1000ban
koko1000ban / setup_docker_containers.sh
Created August 23, 2013 02:14
docker lunch on private
#!/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
#!/bin/sh
# enable debug mode
if [ "$DEBUG" = "yes" ]; then
set -x
fi
usage() {
echo "usage: git merge-master <release_version>"
echo