Skip to content

Instantly share code, notes, and snippets.

@parrot-studio
Last active December 28, 2015 02:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parrot-studio/7426569 to your computer and use it in GitHub Desktop.
Save parrot-studio/7426569 to your computer and use it in GitHub Desktop.
miniが待てないんだよщ(゚Д゚щ)
# encoding: utf-8
require 'mail'
MAIL_ENCODING = 'ISO-2022-JP'
MYADDR = "hogehoge"
def send_message
mes = "mini来た!!"
m = Mail.new
m.charset = MAIL_ENCODING
m.body.charset = MAIL_ENCODING
m.from = MYADDR
m.to = MYADDR
m.subject = mes
m.body = mes.encode(MAIL_ENCODING, :invalid => :replace, :undef => :replace).force_encoding('binary')
m.deliver!
end
loop do
ret = `curl -I http://store.apple.com/jp`
exit unless ret
fl = ret.lines.first.chomp
m = fl.match(/(\d\d\d)/)
exit unless m
case m[1].to_i
when 0
exit
when 200..299
send_message
exit
else
sleep 300
next
end
end
@parrot-studio
Copy link
Author

このスクリプトのおかげで、miniを即座に注文できましたよヽ(`・ω・´)ノ

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment