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 gem myapp; cd myapp | |
$ mkdir bin | |
$ vim bin/myapp | |
#!/usr/bin/env ruby | |
require 'pathname' | |
lib = Pathname.new(__FILE__).dirname.join('..', 'lib').expand_path | |
$LOAD_PATH.unshift lib.to_s | |
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
require 'optparse' | |
opt = OptionParser.new | |
OPTS = {} | |
opt.on('-a') {|v| OPTS[:a] = v } | |
opt.on('-b') {|v| OPTS[:b] = v } | |
opt.parse!(ARGV) | |
p ARGV |
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
### ヘルプメッセージはThorが組み立ててくれる | |
$ ./app.rb | |
Tasks: | |
app.rb greet [NAME] # greet to people | |
app.rb hello # Let's say hello! | |
app.rb help [TASK] # Describe available tasks or one specific task | |
app.rb konichiwa NAME # say hello to NAME san in Japanese | |
$ ./app.rb hello | |
Hello world! |
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
/var/log/myapp/app.log { | |
rotate 30 | |
daily | |
missingok | |
ifempty | |
compress | |
dateext | |
extension .log | |
lastaction | |
/bin/mv /var/log/myapp/app-`date '+%Y%m%d'`.log.gz /var/log/myapp/app-`date '+%Y%m%d' -d '1days ago'`.log.gz |
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
# encoding: utf-8 | |
class Bootstrap # <- example | |
def logger(name, level = 'debug') | |
if development? | |
STDOUT.sync = true | |
Logger.new(STDOUT).tap do |logger| | |
logger.formatter = proc do |level, _, _, message| | |
"[#{level}] #{message}\n" |
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
PKG_CONFIG_PATH=/home/growthforecast/local/lib/pkgconfig/ ./configure --prefix=$HOME/local | |
make | |
make install |
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
yum install pango-devel cairo-devel libxml2-devel |
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
https://github.com/yoppi/fluentd.vim/blob/master/syntax/fluentd.vim | |
を ~/.vim/syntax/において | |
set syntax=fluentd |
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
# encoding: utf-8 | |
#!/bin/sh | |
# | |
# Usage: | |
# | |
# APP_ROOT=/usr/local/app HOME=/home/app_user ./exec script/script.rb [options] | |
# | |
usage() |
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
tcpdump -C 500 -W 5 -w dump.pcap |