Skip to content

Instantly share code, notes, and snippets.

@granolocks
Last active December 15, 2015 05:59
Show Gist options
  • Select an option

  • Save granolocks/5213165 to your computer and use it in GitHub Desktop.

Select an option

Save granolocks/5213165 to your computer and use it in GitHub Desktop.
motivational timer
#!/usr/bin/env ruby
# I use this on Crunchbang and xubuntu systems.
# May need to be modified depending on availability of notify-send as well as icons
def time
sleep 300
end
def notify(urgency, icon, title, message)
`notify-send -u #{urgency} -i #{icon} '#{title}' '#{message}'`
end
pid = fork {
while true
time
notify("critical", "face-devilish","WORK OUT NOW", "work out work out work out")
time
notify("critical", "face-cool", "STRETCH!!", "stretch stretch stretch stretch stretch stretch ")
end
}
# Might need to set up permissions for /var/run/timer.pid
File.open("/var/run/timer.pid", "w"){|f|f.write(pid); f.close}
@granolocks

Copy link
Copy Markdown
Author

Ya, i just wanna capture the pid so i can kill it later
been leaving this running all day...

@LeelooBeans

Copy link
Copy Markdown

Don't forget to STRETCH!

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