Skip to content

Instantly share code, notes, and snippets.

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

Hiroshi SHIBATA hsbt

🏠
Working from home
View GitHub Profile
Ruby 2.1.0 in Production: known bugs and patches
Last week, we upgraded the github.com rails app to ruby 2.1.0 in production.
While testing the new build for rollout, we ran into a number of bugs. Most of
these have been fixed on trunk already, but I've documented them below to help
anyone else who might be testing ruby 2.1 in production.
@naruse I think we should backport these patches to the ruby_2_1 branch and
release 2.1.1 sooner rather than later, as some of the bugs are quite critical.
I'm happy to offer any assistance I can to expedite this process.

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に書いてある
#!/bin/bash
# We need the TAB character for SED (Mac OS X sed does not understand \t)
TAB="$(printf '\t')"
function abort {
echo "$(tput setaf 1)$1$(tput sgr0)"
exit 1
}
@bantic
bantic / rails_route_recognizer.rb
Last active September 9, 2022 12:22
Programmatically list all routes (/paths) from within a rails app.
class RouteRecognizer
attr_reader :paths
# To use this inside your app, call:
# `RouteRecognizer.new.initial_path_segments`
# This returns an array, e.g.: ['assets','blog','team','faq','users']
INITIAL_SEGMENT_REGEX = %r{^\/([^\/\(:]+)}
def initialize

2013 年の新卒研修メニュー

Rails Tutorial

目的

  • 2013 年にモダンな方法で一通り Web アプリケーションを自分一人で作れるようになってもらう
  • 作る過程で Web 開発で必要とされるアプリケーションレイヤのスキルセットを身につけてもらう

教科書

@jewel12
jewel12 / dayone.el
Created October 29, 2012 19:42
Create a new entry of DayOne on Emacs.
(defvar path-to-dayone "/usr/local/bin/dayone"
"Executable path to DayOne CLI")
(defun dayone-save-new-entry ()
"Save buffer as a new DayOne entry"
(interactive)
(if (executable-find path-to-dayone)
(call-process-region
1 (point-max) path-to-dayone nil nil nil "new")))
@jugyo
jugyo / gist:3509080
Created August 29, 2012 09:32
とあるプロジェクトで使ったライブラリたち

とある Rails プロジェクトで使ったライブラリたち

  • carrierwave - ファイルアップロードを処理するやつ
  • carrierwave_backgrounder - アップロードされたフィアルの処理(画像のリサイズ等)をバックグラウンドで処理する
  • delayed_job_active_record - バックグラウンド処理
  • fog - AWS との連携に使う。 carrierwave がこれを使って S3 にファイルを保存してくれたりする
  • haml-rails - haml 使いたいねん
  • twitter-bootstrap-rails - あれ
  • will_paginate - ページネーション
  • bootstrap-will_paginate - twitter-bootstrap 的にいい感じのタグを出力してくれる
@hitode909
hitode909 / jenkins_register_branch.rb
Created July 17, 2012 12:34
Jenkinsにブランチを登録するスクリプト
#! /usr/bin/env ruby
# -*- coding: utf-8 -*-
# Jenkinsにブランチを登録するスクリプト
#
# 現在のブランチを追加
# jenkins_register_branch http://jenkins.example.com/job/Project1
# 現在のブランチにstagingブランチを追加
# jenkins_register_branch http://jenkins.example.com/job/Project1 staging
@KitaitiMakoto
KitaitiMakoto / RunningHiki.markdown
Created May 28, 2012 19:20
Running Hiki on Sqale

RunningHiki

Sqale に Hiki をインストールする方法を説明します。

Hikiとは

[Hiki][hiki] とは、軽量でシンプルな Wiki エンジンです。はじめからついてくるプラグインに加え、簡単な Ruby スクリプトを書くことで自分のプラグインを作成することもできます。また、[tDiary][tdiary] の豊富なテーマを流用することができます(後述します)。

以下、Sqale に Hikiを インストールして動かす方法を説明していきます。 「[公開鍵の設定][pubkey]」から、鍵を登録しておいてください。

@taichi
taichi / code_reading.md
Last active April 10, 2024 13:04
太一のコードの読み方メモ

太一のコードの読み方メモ

全体として太一が感覚的に実践している事を論理的に説明しようと試みている為、
説明の粒度が適切でなかったり一貫性が無いように見える部分があるかもしれない。
普段やっているけども書ききれていない事も多分きっとある。

コードを読むとは何か

  • コードを嗜む
  • コードを学ぶ
  • 武器を手に入れる