Skip to content

Instantly share code, notes, and snippets.

@ascendbruce
Created June 14, 2014 12:17
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 ascendbruce/c4a823b3202d7ed6f80e to your computer and use it in GitHub Desktop.
Save ascendbruce/c4a823b3202d7ed6f80e to your computer and use it in GitHub Desktop.
Terminal & mac say stopwatch for interval training
class Notifier
def initialize(voice)
@voice
end
def sprint
say "sprint"
puts %(
###### ######## ######## #### ## ## ########
## ## ## ## ## ## ## ### ## ##
## ## ## ## ## ## #### ## ##
###### ######## ######## ## ## ## ## ##
## ## ## ## ## ## #### ##
## ## ## ## ## ## ## ### ##
###### ## ## ## #### ## ## ##
), "\n"*5
end
def relax
say "relax"
puts %(
######## ######## ## ### ## ##
## ## ## ## ## ## ## ##
## ## ## ## ## ## ## ##
######## ###### ## ## ## ###
## ## ## ## ######### ## ##
## ## ## ## ## ## ## ##
## ## ######## ######## ## ## ## ##
), "\n"*5
end
private
def say(message)
if @voice && !@voice.empty?
system("say -v #{@voice} '#{message}' &")
else
system("say '#{message}' &")
end
end
end
# === configs ===
voice = "" # leave blank or nil to use the default
sprint_duration = 30 # in seconds
relax_duration = 4 * 60
# ===============
notifier = Notifier.new(voice)
begin
while true
notifier.relax
sleep relax_duration
notifier.sprint
sleep sprint_duration
end
rescue Interrupt => e
puts "", "bye bye"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment