Skip to content

Instantly share code, notes, and snippets.

@muness
Last active December 18, 2015 11:49
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 muness/5778339 to your computer and use it in GitHub Desktop.
Save muness/5778339 to your computer and use it in GitHub Desktop.
#!/bin/sh
# wire this in cron with something like this:
# 13,57,43,27 * * * * ~/bin/cal_im_reminder
export PATH="$HOME/.rbenv/bin:$PATH" ; eval "$(rbenv init -)";
export TZ='America/New_York' # adjust to your timezone!
~/bin/gcalcli agenda --calendar <calendars from which you want IM reminders> --tsv | ~/bin/gcalcli_parse_tsv 10 | sendxmpp <personal gmail> -t <xmpp account you're logged into normally. for me that's my work account>
#!/bin/env ruby
if RUBY_VERSION =~ /1.9/
Encoding.default_external = Encoding::UTF_8
Encoding.default_internal = Encoding::UTF_8
end
require 'time'
minutes=ARGV[0].to_i || 5
STDIN.read.split("\n").each do |line|
row = line.split("\t")
start_time = Time.parse(row[0] +" " + row[1])
end_time = Time.parse(row[2] +" " + row[3])
cal_link = row[4]
hangout_link = row[5]
title = row[6]
str = hangout_link.length > 0 ? "Hangout at #{hangout_link}" : "More at #{cal_link}"
if (start_time >= Time.now && start_time <= (Time.now + (60 * minutes)))
puts "#{title} at #{start_time.strftime('%l:%M')} - #{str}"
end
end
# Add this to the top of your sendxmpp script, just after the #!/...perl directive
use IO::Socket::SSL;
{
no warnings 'redefine';
my $old_connect_SSL = \&IO::Socket::SSL::connect_SSL;
*IO::Socket::SSL::connect_SSL = sub {
my $sock = $_[0];
${*$sock}{_SSL_arguments}{SSL_cipher_list} = 'RC4-MD5';
goto $old_connect_SSL;
};
}
gcalcli agenda --calendar Muness `date +"%R"` `date +"%R" --date='4 hours'` --details all
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment