ubuntu remind me in ten minutes ###background
Very useful voice commands for cortana on windows phone: wake me up in ten minutes. Remind me to do XXX in an hour.
### ideas
Speech recognition under ubuntu is difficult to do, so I had to do something on the command line to remind me of such a thing after a few minutes.
What to do in a few minutes is easy to program. golang's time.after_func is fine. Then the bell rang. I didn't understand how the beep command was used, but I found the espeak command again.
espeak is a text-to-speech program, commonly known as TTS.
sudo apt-get install espeak
espeak "it's time to get up"
###golang code is as follows:
package main
import (
"flag"
"os/exec"
"time"
)
var n_secs int
var n_mins int
var n_hours int
var words string
func init() {
flag.IntVar(&n_secs, "s", 0, "remind me after n seonds")
flag.IntVar(&n_mins, "m", 0, "remind me after n minutes")
flag.IntVar(&n_hours, "h", 0, "remind me after n hours")
flag.StringVar(&words, "w", "ling ling ling", "the words to speak when time is up")
}
func main() {
var c = make(chan int)
var d time.Duration = 0
flag.Parse()
switch {
case n_secs != 0:
d += time.Duration(n_secs) * time.Second
case n_mins != 0:
d += time.Duration(n_mins) * time.Minute
case n_hours != 0:
d += time.Duration(n_hours) * time.Hour
}
time.AfterFunc(d, func() {
exec.Command("espeak", words).Run()
c <- 1
})
<-c
}
###usage:
remindme -m 5
remindme -m 30 -w "homework homework"
remindme -h 1 -m 30 -w "clean the room, clean the room"
{{o.name}}
{{m.name}}