Skip to content

Instantly share code, notes, and snippets.

View hfm's full-sized avatar

Okumura Takahiro hfm

View GitHub Profile
@kohyama
kohyama / stm.md
Last active February 9, 2023 05:35
Clojure ref, atom, agent の要約
@kitak
kitak / gist:6372481
Last active May 17, 2017 21:54
MySQLのreconnectについて

MySQLのreconnectとは

mysqlクライントでのreconnect

mysqlクライアントがステートメントの送信中にサーバとの接続が遮断された場合、 直ちに自動的に再接続し、ステートメントの送信を試みる(reconnect)。

注意:
再試行時には全セッションオブジェクトと設定(具体的にはテンポラリテーブル、オートコミットモード、ユーザー定義変数、 セッション変数、トランザクションロールバックなど)が失われているので、ステートメントによってはreconnectすることが危険なものもある。

reconnectしないようにmysqlクライアントを利用する場合には、--skip-reconnectオプションをつけてクライアントを立ち上げる。

nnoremap o :<C-u>call append('.', '')<CR>
nnoremap O :normal! O<ESC>j
nnoremap go :normal! o<CR>
nnoremap gO :normal! O<CR>
@rjeczalik
rjeczalik / building-static-nginx.txt
Created October 19, 2013 15:37
Notes on building nginx as a static binary.
# Building static nginx for teh lulz
#
# basic dependencies
sudo apt-get install libxslt1-dev libxml2-dev zlib1g-dev libpcre3-dev libbz2-dev libssl-dev
# download nginx and openssl
wget http://nginx.org/download/nginx-1.5.6.tar.gz
tar xf nginx-1.5.6.tar.gz; cd nginx-1.5.6

http://ameblo.jp/principia-ca/entry-11573342807.html

  1. 復帰した旧masterが新masterになるわけじゃないんで「フェイルバック」 ではない感。
  2. sentinel 1台だと誤検知してもFOしちゃうので怖い。別ラックとかで複数sentinel配置すべきじゃないかなぁ。
  3. alias_ip_change.shは非常にまずい気がして、引数全く見てないのでFOが発動したときと完了したときの2回IP Alias切り替えちゃう。つまり元に戻るので落ちたmasterにVIPが付いちゃうんじゃないかなぁ?
  4. あとip addr del/addしたときって他サーバー/スイッチのarpテーブル/FDB更新されるんだっけ? Gratuitous ARP送ったほうがいいような気がするけどどうだろう?
  5. 注意点1はそんなことはなくて、ちゃんと引数をみてroleがleaderでstateがendのときだけVIPの移動処理すればOK 引数の説明はsentinel.confに書いてある
@hiboma
hiboma / gist:7251089
Last active December 27, 2015 02:19
array_push と [] との比較

array_push と $array[] = $val って何が違うの

  • array_push で配列の要素足すのと、$array[] = $val で配列の要素足すのと何が違うのかわからんので調べた
  • http://pecl.php.net/package/vld を入れると処理系の OPコードを見れる

環境

[vagrant@localhost ~]$ rpm -q php
php-5.3.3-23.el6_4.x86_64
package main
import "fmt"
func main () {
// 見つめ合う
fmt.Println("おっくせんまん!おっくせんまん!!")
defer fmt.Println("ジャパン!!!");
}
@udzura
udzura / LICENSE
Last active May 8, 2021 14:23
やわらかRuby
やわらかRubyはCC BY 4.0 で提供します。
詳細: https://creativecommons.org/licenses/by/4.0/deed.ja
This work is licensed under a Creative Commons Attribution 4.0 International License.
See also: https://creativecommons.org/licenses/by/4.0/deed
@denji
denji / nginx-tuning.md
Last active November 22, 2025 10:47
NGINX tuning for best performance

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.

@udzura
udzura / file1.txt
Created March 6, 2014 04:07
クライアントからやってくる本物のHTTPリクエストをダンプする ref: http://qiita.com/udzura/items/db49fc086cff2a8aaea3
$ ruby http-dumper.rb -p 3002