Entries from 2014-04-01 to 1 month

ruby upgrade rubies (i did ruby-1.9.3-p374 =>ruby-1.9.3-p545)

rbenv$ rbenv install --list $ rbenv install 1.9.3-p545 $ rbenv rehash $ rbenv global 1.9.3-p545rvm# NOTE: you probably want to upgrade your rvm first, as the list of known rubies seems to be coupled to the rvm version. $ rvm get stable $ r…

ruby-1.9.3-p374 =>ruby-1.9.3-p545 *** buffer overflow detected ***: ruby terminated

mechanizeを使いマルチスレッドで同時に複数のページにアクセスするプログラムを使っていた。mechanizeでDNS 解決(gethostbyname)などのタイムアウトを制御するためrequire 'em-resolv-replace' または require 'resolv-replace' (参照: http://seesaawi…

Ruby 実行ファイルの名前を取得

http://d.hatena.ne.jp/yoshidaa/20120718/1342614445p File.expand_path($0) p $PROGRAM_NAME $0 は、ruby に引数として渡された実行中のスクリプトファイル名を表す組み込み変数で、ちょっとしたライブラリを作る際に以下のような感じでよく使います。# ho…

lsof open files and sockets with users “Too many open files” ulimit -n,#

http://www.tecmint.com/10-lsof-command-examples-in-linux/http://stackoverflow.com/questions/106234/lsof-survival-guidehttp://www.thegeekstuff.com/2012/08/lsof-command-examples/ulimit -n Linux でプロセスが開けるファイルディスクリプタの上限 …

byobu ubuntu以外

ステータスバーが無限に表示される場合 http://gihyo.jp/admin/serial/01/ubuntu-recipe/0291?page=2http://techracho.bpsinc.jp/kazumasa-ogawa/2013_09_05/13493設定の確認・変更 http://shim0mura.hatenadiary.jp/entry/20111005/1317819710

ruby === case中で使う

http://qiita.com/Linda_pp/items/53a527721d932b8ecccecsae b-a when 50...Float::INFINITY #これはb-a>=50と同じ range = 1.0...10.0range === 1.0 # => truerange === 10.0 # => false

DNS

http://askubuntu.com/questions/22750/best-way-to-set-up-dns-caching

mechanize open_timeout,keep_alive(),idle_timeout()

http://mechanize.rubyforge.org/Mechanize.htmlidle_timeout() Connections that have not been used in this many seconds will be reset. idle_timeout=(idle_timeout) Sets the idle timeout to idle_timeout. The default timeout is 5 seconds. If you…

ActiveSupport Time リファレンス

http://qiita.com/shu_0115/items/b490bd3de6bc4d5e43a5 http://railsdoc.com/active_supporthttp://qiita.com/joker1007/items/2c277cca5bd50e4cce5e

HAML ruby Markdownパーサー Redcarpet

http://mukaer.com/archives/2013/06/03/rubymarkdownred/ http://d.hatena.ne.jp/kasei_san/20130713/p1 http://qiita.com/ka_/items/ac3082890bf90a6df0c5 http://www.jpfleury.net/en/software/gedit-markdown.php

clockwork プロセス zombie orphan 子プロセス 標準出力

http://d.hatena.ne.jp/MKMK/20100118 http://zetcode.com/lang/rubytutorial/io/ http://hibariya.github.io/entries/20120326/a0.html http://qiita.com/ogomr/items/27e9fc7af5b978b5ced6 http://www.fireproject.jp/feature/c-language/process/fork-wai…

spawn 外部コマンド `...`

http://www.masudak.net/blog/2013/05/30/201305302308/ http://blog.0xc.info/2012/09/processspawnpid.html

チュートリアル・IO pipe

http://www.fincher.org/tips/Languages/Ruby/ http://ruby.bastardsbook.com/chapters/external-programs/

ruby output sidetiq

http://zetcode.com/lang/rubytutorial/io/http://michael.vanrooijen.io/posts/2013/09/28/using-sidekiq-and-clockwork-try-sidetiq/

Redis Sidekiq・Resque God・Demonise

Redis オンメモリ・DB、multiThreadのLogSidekiq・Resque Redisと自身のworkerを使い、バックグランドで処理を行う。Threadとおなじ感覚だが、要するにThreadをforkした後、Sidekiqを動かしたメイン・プログラムに制御が戻ってくる。ResqueはSidekiqのシング…

Ruby God プロセス監視・再起動

http://qiita.com/sawanoboly/items/0c9202d447ec67402a0f http://aligach.net/diary/20090817.html http://takuya-1st.hatenablog.jp/entry/20110918/1316365681 http://qiita.com/sawanoboly/items/0c9202d447ec67402a0f

Kill byobu session

単純にtmuxセッションを殺すだけなら tmux kill-session [-t session_name]ps aux | grep byobu

clockwork multi-thred background job

http://xoyip.hatenablog.com/entry/2014/02/17/222721 http://qiita.com/ogomr/items/27e9fc7af5b978b5ced6 http://d.hatena.ne.jp/riocampos+tech/20130625/p1http://www.ownway.info/Ruby/index.php?clockwork%2Fabout https://adam.heroku.com/past/2010…

Ruby Server Git Deploy Unicorn nginx passenger

https://www.digitalocean.com/community/articles/a-comparison-of-rack-web-servers-for-ruby-web-applications http://spring-mt.tumblr.com/post/19282358465/apache-nginx-x-passenger-unicorn http://blog.s21g.com/articles/2346 http://qiita.com/ko…