Skip to content

Instantly share code, notes, and snippets.

@asflash8
asflash8 / legend-source.md
Last active October 18, 2023 06:35
ISUCON秘伝のタレ

bash

# change login shell
chsh
# => Login Shell [/bin/sh]: /bin/bash

# bash completion
sudo apt-get install bash-completion
@asflash8
asflash8 / far_world_math.rb
Created January 17, 2015 06:20
神奈川Ruby会議01 ペアプロ課題
# 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
@asflash8
asflash8 / .env
Last active August 29, 2015 14:05
ハミダセでデモしたtwitterとhue連携プログラム
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"
@asflash8
asflash8 / amida.rb
Created June 2, 2012 10:09
みなとRuby会議01 ソーシャルコーディング あみだくじ
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
@asflash8
asflash8 / english_numerals.rb
Created June 2, 2012 08:59
みなとRuby会議01 ソーシャルコーディング EnglishNumerals
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