# change login shell
chsh
# => Login Shell [/bin/sh]: /bin/bash
# bash completion
sudo apt-get install bash-completion
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
num = ("%04d" % ARGV[0]).split(//).map(&:to_i) | |
num_singles = %W(zero one two three four five six seven eight nine) | |
num_teens = %W(ten eleven twelve thirteen fouteen fifteen sixteen seventeen eiteen nineteen) | |
num_tys = %W('' '' twenty thirty fourty fifty sixty seventy eighty ninety) | |
result = [] | |
result << num_singles[num[0]] + ' thousand and' if num[0] > 0 | |
result << num_singles[num[1]] + ' hundred and' if num[1] > 0 | |
result << num_tys[num[2]] if num[2] > 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
person_num = ARGV.first.to_i | |
person_names = ('A'..'Z').to_a | |
height = 10 | |
person_num.times do |p| | |
print "#{person_names[p]} " | |
end | |
puts |
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
CONSUMER_KEY="YOUR TWITTER APP CONSUMER KEY" | |
CONSUMER_SECRET="YOUR TWITTER APP CONSUMER SECRET" | |
ACCESS_TOKEN="YOUR TWITTER APP ACCESS TOKEN" | |
ACCESS_TOKEN_SECRET="YOUR TWITTER APP ACCESS TOKEN SECRET" | |
HUE_BRIDGE_HOST="YOUR_HUE_BRIDGE_HOST" | |
HUE_USERNAME="YOUR_HUE_USER_NAME" |
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
# http://nabetani.sakura.ne.jp/kanagawa.rb/evalex/ | |
def solve(str) | |
# "4*5+6&7|8" => ["4", "*", "5", "+", "6", "&", "7", "|", "8"] | |
input = str.split(/\b/) | |
%W(| & + *).each do |op| | |
while true | |
index = input.index(op) | |
break if index.nil? | |
target = input[(index-1)..(index+1)].join |