Skip to content

Instantly share code, notes, and snippets.

@codyhanson
Created January 3, 2014 14:54
Show Gist options
  • Save codyhanson/8239158 to your computer and use it in GitHub Desktop.
Save codyhanson/8239158 to your computer and use it in GitHub Desktop.
old script I made to have an IronMan style Jarvis alarm clock with the old iMac. uses the OSX talk say command.
#! /usr/bin/perl
#Turn your mac into your (not) so humble servant, Jarvis!
#Version 1.0 5/12/2010 Cody Hanson
#Macintosh only, sorry!
#Dedicated to Mr Tony Stark, who is a badass.
use strict;
use warnings;
my @months = qw( January February March April May June July August September October November December);
my @days = qw( Sunday Monday Tuesday Wednesday Thursday Friday Saturday );
my @mdays = qw( zeroth first second third fourth fifth sixth seventh eighth ninth tenth eleventh twelth thirteenth fourteenth fifteenth sixteenth seventeenth eighteenth nineteenth twentieth
twentyfirst twentysecond twentythird twentyfourth twentyfifth twentysixth twentyeighth twentyninth thirtieth thirtyfirst);
#foreach (@months, @days, @mdays) {
#system("say $_");
#}
my @time_info = localtime(time);
#my $year = $time_info[5] + 1900;
my $month = $months[$time_info[4]];
my $name = "Stark"; # the default
my $salutation = "Mr"; #the default
my $salutation2 = "sir"; #the default
my $morning = '"Good morning '. $salutation . ' ' . $name . ', the time is ' . $time_info[2] . ' hours and '. $time_info[1] .
' minutes, '. $days[$time_info[6]] . ', the '. $mdays[$time_info[3]] . ' of '. $months[$time_info[4]] . ' "';
my $car = '"which Shall I prepare for you today '. $salutation2 .' , the Ferrari or the Lamborgheeni?"';
my $excellent = '"Excellent choice."';
system("say $morning");
sleep(1);
system("say $car");
# YOU RESPOND HERE
sleep(4);
system("say $excellent");
sleep(1);
#also possibility
#exec( COMMAND TO PlAY MUSIC GOES HERE );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment