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
irb(main):004:0> require 'mechanize' | |
irb(main):005:0> agent = Mechanize.new | |
irb(main):006:0> p agent.get('google.co.jp') | |
ArgumentError: absolute URL needed (not google.co.jp) | |
from /home/hogeuser/.rbenv/versions/2.2.0-rc1/lib/ruby/gems/2.2.0/gems/mechanize-2.7.3/lib/mechanize/http/agent.rb:651:in `resolve' | |
from /home/hogeuser/.rbenv/versions/2.2.0-rc1/lib/ruby/gems/2.2.0/gems/mechanize-2.7.3/lib/mechanize/http/agent.rb:223:in `fetch' | |
from /home/hogeuser/.rbenv/versions/2.2.0-rc1/lib/ruby/gems/2.2.0/gems/mechanize-2.7.3/lib/mechanize.rb:440:in `get' | |
from (irb):6 | |
from /home/hogeuser/.rbenv/versions/2.2.0-rc1/bin/irb:11:in `<main>' |
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
cat <<EOF > test.txt | |
a b c | |
d e f | |
EOF | |
# cutを使う場合 | |
cat test.txt | cut -d ' ' -f 1,3 | |
#=> a c | |
#=> d f |
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
k-gosho@kgosho-ubuntu ~ % cat languages.txt | |
id,name | |
1,"Ruby" | |
2,"Perl" | |
3,"PHP" |
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
require_relative './secure_password' | |
class ActiveRecord | |
extend SecurePassword | |
end |
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
gem 'sinatra' , '1.4.6' | |
group :production do | |
gem 'thin' | |
end |
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
mkdir /tmp/a | |
cd /tmp/a |
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
# この関数を~/.bash_aliasesなどに書いておく | |
alarm(){ | |
echo "echo $1 | cowsay | wall" | at $2 | |
} |
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
alarm(){ | |
echo "tmux detach-client; sleep 2; cowsay_to_single_pts $1" | at $2 | |
} |
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
sudo npm install -g markdown-styles |
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
# Render a template file | |
# | |
# $ cat template.txt | |
# ========================== | |
# Hello, I'm {{ name }}. | |
# It's {{ wheather }} wheather today. | |
# ========================== | |
# | |
# $ util::render_template template.txt 'name=bashist&wheather=good' | |
# ========================== |
OlderNewer