This file contains 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
readelf -a hoge.elf |
This file contains 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
see http://guides.rubyonrails.org/3_2_release_notes.html | |
This makes it possible to write the following: | |
class Order < ActiveRecord::Base | |
def cancel! | |
transaction do | |
lock! | |
# ... cancelling logic |
This file contains 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
### 2TB以上のHDDを使う場合。partedコマンドでMBRではなくGPTを利用するようにする。 | |
ex) 3TBのディスクの場合 | |
# parted /dev/XXX | |
(parted) mklabel gpt | |
(parted) mkpart | |
Partition name? []? | |
File system type? [ext2]? ext4 | |
Start? 1 | |
End? 3001GB |
This file contains 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
### デフォルトで使えるパラメータ | |
node['platform'] - The node's platform. This determines what Providers are used by Resources. | |
node['platform_version'] - The node's platform version. This may be used in determining Providers as well. | |
node['ipaddress'] - The node's ipaddress is IPV4 address of the interface that has the default route. If the node does not have a default route, this attribute will be nil. Using the IP of the interface with the default route is deemed the most sane default. | |
node['macaddress'] - The node's macaddress, from the interface detected for ipaddress above. | |
node['fqdn'] - The fully qualified domain name, for example from hostname -f on Unix/Linux systems. This is also used as the node name unless otherwise set. | |
node['hostname'] - The hostname is the first field from splitting the FQDN on "." (dot). | |
node['domain'] - The domain is the rest of the FQDN after splitting on "." (dot). | |
node['recipes'] - The node's Run List is expanded for roles and recipes, and recipes are stored in this attribute. | |
node['rol |
This file contains 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
#////////// Arel /////////// | |
### whereを使って完全一致の比較を行う ### | |
Model.where(:column => param) | |
### Arelは常に結果を配列で返すようなので一つだけとりだしたい場合(ユニークキーで検索する時とか)は.firstを使うと良い ### | |
Model.where(:column => param).first | |
### whereを使って大小の比較を行う ### | |
Model.where('column > param') |
This file contains 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
### 配列の中身を個々の変数に分割して代入 | |
test = ['a', 'b', 'c'] | |
test << 'd' | |
p test # => ["a", "b", "c", "d"] | |
### ファイルからの相対パスでライブラリを読み込むためのイディオム | |
# $:は$LOAD_PATHと等価 | |
$:.unshift(File.dirname(__FILE__)) | |
$:.unshift(File.dirname(__FILE__) + "/lib") |
This file contains 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
##### nginxでリバースプロキシして後段でエラーが発生した場合にnginx側でエラーページの制御をしたい時の設定 ##### | |
proxy_intercept_errors on; # errorをproxy側で肩代わりする設定 | |
error_page 403 404 500 502 503 504 /error.html; # /var/www/html/error.htmlを置いておく | |
location /error.html { | |
root /var/www/html/; | |
} | |
#### headerの値を参照する #### | |
$http_フィールド名 |