Skip to content

Instantly share code, notes, and snippets.

@maman
Created May 26, 2011 12:31
Show Gist options
  • Save maman/993040 to your computer and use it in GitHub Desktop.
Save maman/993040 to your computer and use it in GitHub Desktop.
Samurize python & ruby notification
import imaplib, re
conn = imaplib.IMAP4_SSL("imap.gmail.com", 993)
conn.login("#yourusername@gmail.com#", "#yourpassword#")
unreadCount = re.search("UNSEEN (\d+)", conn.status("INBOX", "(UNSEEN)")[1][0]).group(1)
if unreadCount == "0":
unreadCount = "No"
print unreadCount + " New Mail"
#!/usr/bin/env ruby
require 'rubygems'
require 'librmpd'
mpd = MPD.new '#address#', #port#
mpd.connect()
artist = mpd.current_song.artist
title = mpd.current_song.title
puts artist + "\n" + title
import pywapi
import string
yahoo_result = pywapi.get_weather_from_yahoo('#yahooareacode#','metric')
print yahoo_result['condition']['temp'] + "C " + yahoo_result['condition']['text']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment