CodeOfficer (owner)

Revisions

gist: 128120 Download_button fork
public
Public Clone URL: git://gist.github.com/128120.git
Embed All Files: show embed
Text #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
require 'tempfile'
 
def say(cmd, voice='Fred')
  temp_file = Tempfile.new('sayfile')
  tf = File.new(temp_file.path, "w+")
  tf.puts(cmd)
  tf.close
  `cat #{temp_file.path} | /usr/bin/say -v #{voice}`
  temp_file.unlink
end
 
def ding_dong
  say("Ding dong!", 'Bells')
end
 
def echo_date
  t = Time.now
  say(t.strftime("The time is now %I %p"))
end
 
ding_dong
sleep 1
echo_date