This file contains hidden or 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
sudo yum install daemontools daemontools-toaster | |
# SV:12345:respawn:/usr/local/bin/svscanboot を /etc/inittab についか | |
kill -HUP 1 |
This file contains hidden or 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
invalid_utf8 = "\xff" | |
invalid_utf8.force_encoding('UTF-8') | |
begin | |
invalid_utf8 =~ /hoge/ | |
rescue => e | |
p e # <ArgumentError: invalid byte sequence in UTF-8> | |
end | |
invalid_utf8 = invalid_utf8.encode("UTF-8", "UTF-8") |
This file contains hidden or 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
# An example to create complex graphs | |
# require anyway | |
require 'growthforecast-client' | |
# Create a GrowthForecast Client, given he base URI of GrowthForecast | |
client = GrowthForecast::Client.new('http://localhost:5125') | |
service_name = 'a_service_name' | |
section_name = 'a_section_name' | |
graph_names = %w(<1sec_count <2sec_count <3sec_count <4sec_count >=4sec_count) |
This file contains hidden or 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
# An example to edit properties of graphs such as color, unit. | |
# require anyway | |
require'growthforecast-client' | |
# Create a GrowthForecast Client, given he base URI of GrowthForecast | |
client = GrowthForecast::Client.new('http://localhost:5125') | |
# Graph properties to overwrite | |
params = { |
This file contains hidden or 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
#!/bin/sh | |
stdin=$(cat /dev/stdin) | |
[ -n "$stdin" ] && /usr/bin/logger -t $1 -p user.info $stdin | |
# Usage | |
# {something} | silent_logger.sh something |
This file contains hidden or 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
# Preparation: assume rbenv and ruby-build is already installed. | |
curl https://raw.github.com/hsbt/ruby-build/3c94f7f696d51d96223ce64d3760d25d3b6a0b68/share/ruby-build/2.0.0-p0 -o ~/.rbenv/plugins/ruby-build/share/ruby-build/2.0.0-p0 | |
rbenv install 2.0.0-p0 | |
rbenv local 2.0.0-p0 | |
rbenv rehash | |
# bundler must be 1.3.x for 2.0.0 | |
gem install bundler --version 1.3.0.pre.8 | |
# http://railsapps.github.com/openssl-certificate-verify-failed.html | |
wget http://curl.haxx.se/ca/cacert.pem -O /usr/local/etc/openssl/certs/cert.pem | |
export SSL_CERT_FILE=/usr/local/etc/openssl/certs/cert.pem |
This file contains hidden or 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
class Hoge < Moge | |
def moge1_with_hoge | |
moge1_without_hoge | |
moge2_without_hoge | |
end | |
alias_method_chain :moge1, :hoge | |
def moge2_with_hoge | |
moge2_without_hoge | |
end |
This file contains hidden or 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
bundle install --gemfile Gemfile --path vendor/bundle --deployment --without development test |
This file contains hidden or 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
# Gemfile | |
# gem 'passenger', 'git: https://github.com/FooBarWidget/passenger' | |
bundle install | |
sudo yum install pcre-devel curl-devel | |
sudo bundle exec passenger start | |
Installing Phusion Passenger Standalone... | |
[*********************************************] Copying files... | |
All done! |
This file contains hidden or 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
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND | |
6157 root 15 0 241m 113m 1604 S 99.9 11.4 1:19.93 fluentd | |
3715 root 16 0 545m 438m 2276 S 7.0 43.8 0:10.78 perl |