Skip to content

Instantly share code, notes, and snippets.

@cho45
Created September 15, 2008 13:27
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cho45/10851 to your computer and use it in GitHub Desktop.
Save cho45/10851 to your computer and use it in GitHub Desktop.
エリン時間予告
#!/usr/bin/env ruby
require "rubygems"
require "snarl"
def message(str)
Snarl.show_message("mabinogi", str, nil, 10) # 日本語で最後の1文字がおかしい。snarl sucks
end
message "エリン時間予告を起動しました。"
error = ARGV[0] || 10
$stdout.sync = true
loop do
time = Time.now.to_f + ( error * 1.5 )
min = time % (36 * 60) / 1.5
hour, min = min.divmod(60)
time = "%02d:%02d" % [hour, min]
print "ET #{time}\r"
case time
when "05:40"
message "もうすぐイウェカが沈みます。変身し忘れていませんか?"
when "11:40"
message "もうすぐ12時です。"
when "23:40"
message "もうすぐ0時です。"
end
sleep 1.5
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment