+++ /dev/null
-#!/usr/bin/python
-# Ptyhon script to send a notification when an event with an alert occurs
-# Source: http://julien.danjou.info/blog/2012/google-calendar-pynotify
-# By Julien Danjou <julien@danjou.info>
-
-# First, we need to import GTK+ and pynotify, and initialize it.
-import gtk
-import pynotify
-pynotify.init(sys.argv[0])
-
-# Then, we need to import gdata Calendar API and connect to the calendar. I'll
-# use the simple email/password way to login, which is clearly not the best, but
-# it's also the simplest. Feel free to use OAuth 2.0. :-)
-calendar_service = gdata.calendar.service.CalendarService()
-calendar_service.email = 'mygooglelogin'
-calendar_service.password = 'mygooglepassword'
-calendar_service.ProgrammaticLogin()
-
-# Now we're ready to request stuff and notify! First, request the events from
-# the default calendar.
-feed = calendar_service.GetCalendarEventFeed()
-
-# Now we can iterate over feed and do various checks.
-for event in feed.entry:
- # If the event status is not confirmed, go to the next event.
- if event.event_status.value != "CONFIRMED":
- continue
- # Now iterate over all the event dates (usually it has one)
- for when in event.when:
- # Parse start and end time
- try:
- start_time = datetime.datetime.strptime(when.start_time.split(".")[0], "%Y-%m-%dT%H:%M:%S")
- end_time = datetime.datetime.strptime(when.end_time.split(".")[0], "%Y-%m-%dT%H:%M:%S")
- except ValueError:
- # ValueError happens on parsing error. Parsing errors
- # usually happen for "all day" events since they have
- # not time, but we do not care about this events.
- continue
- now = datetime.datetime.now()
- # Check that the event hasn't already ended
- if end_time > now:
- # Check each alert
- for reminder in when.reminder:
- # We handle only reminders with method "alert"
- # and whose start time minus the reminder delay has passed
- if reminder.method == "alert" \
- and start_time - datetime.timedelta(0, 60 * int(reminder.minutes)) < now:
- # Build the notification
- notification = pynotify.Notification(summary=event.title.text,
- message=event.content.text)
- # Set an icon from the GTK+ stock icons
- notification.set_icon_from_pixbuf(gtk.Label().render_icon(gtk.STOCK_DIALOG_INFO,
- gtk.ICON_SIZE_LARGE_TOOLBAR))
- notification.set_timeout(0)
- # Show the notification
- notification.show()
+++ /dev/null
-#!/usr/bin/python
-
-# source: http://blog.schmichael.com/2008/10/30/listing-all-passwords-stored-in-gnome-keyring/
-
-import pygtk
-pygtk.require('2.0')
-import gtk # sets app name
-import gnomekeyring
-
-def hack():
- for keyring in gnomekeyring.list_keyring_names_sync():
- for id in gnomekeyring.list_item_ids_sync(keyring):
- item = gnomekeyring.item_get_info_sync(keyring, id)
- print '[%s] %s = %s' % (
- keyring, item.get_display_name(), item.get_secret())
- else:
- if len(gnomekeyring.list_item_ids_sync(keyring)) == 0:
- print '[%s] --empty--' % keyring
-
-if __name__ == '__main__':
- hack()