Speed Listening With Rockbox

In this clip from Lotta Linux Links episode 133 Dave Yates shares a Rockbox tip. To fly through podcasts without making it sound like Chipmunks increase the speed to 150% and lower the pitch to 96%.

Audio clip

Advertisements

Josh Pollard Likes Linux

Alton Marschall Dissing Linux on HTPCentric Episode 9

Audio snippet from HTPCentric podcast episode 9 – Alton Marschall Dissing Linux on HTPCentric Episode 9

IdenticaMap.com

I created a web app to display the Identi.ca public timeline on a Google Map with live updates. Check out IdenticaMap.com.

Wake on LAN with 3 MythTV Frontends

I have 3 MythTV frontends scattered throughout my house. I put together a script using wakeonlan and ssh to power the frontends on and off. Here is a video demonstration.

Email Notification of Twitter Mentions

I prefer Identi.ca for microblogging but not everyone has an Identi.ca account, yet. I have a Twitter account too. Unlike Identi.ca, Twitter does not offer email notification when you are mentioned in a message. I hacked together some Python code to make up for Twitter’s deficiency. The following code will check Twitter every 10 minutes for mentions. If any new mentions are found it sends me an email message. It writes new mentions to a MySQL database table so that you are not notified multiple times for the same message.

Update Nov 20, 2010: Added oAuth support using tweepy python library.

Download the code below.


#! /usr/bin/python
#
# Email new Twitter mentions.
# Prerequisites: Mysql, Tweepy.
# Version 2.0 November 20, 2010
#
#

import time

import MySQLdb
from email.MIMEMultipart import MIMEMultipart
from email.MIMEText import MIMEText
import smtplib
import tweepy

def sendMail(subject, text):
  gmailUser = '**YourGmailUserNameHere@gmail.com**'
  gmailPassword = '**YourGmailPasswordHere**'
  recipient = '**YourGmailUserNameHere@gmail.com**'
  msg = MIMEMultipart()
  msg['From'] = gmailUser
  msg['To'] = recipient
  msg['Subject'] = subject
  msg.attach(MIMEText(text))
  mailServer = smtplib.SMTP('smtp.gmail.com', 587)
  mailServer.ehlo()
  mailServer.starttls()
  mailServer.ehlo()
  mailServer.login(gmailUser, gmailPassword)
  mailServer.sendmail(gmailUser, recipient, msg.as_string())
  mailServer.close()
  print('Sent email to %s' % recipient)
def oauthRoutine():
  auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)
  auth_url = auth.get_authorization_url()
  print 'Please authorize: ' + auth_url
  verifier = raw_input('PIN: ').strip()
  auth.get_access_token(verifier)
  cursor = conn.cursor()
  sql = "insert into oauth (oauthkey, oauthsecret, logtime) values('%s', '%s', current_timestamp())" % (auth.access_token.key, auth.access_token.secret)
  cursor.execute(sql)
  cursor.close()
  global oauthKey
  global oauthSecret
  oauthKey = auth.access_token.key
  oauthSecret = auth.access_token.secret
def readOauth():
  cursor = conn.cursor()
  cursor.execute("Select oauthkey, oauthsecret from oauth")
  row = cursor.fetchone()
  if row == None:
    print("oAuth key and secret not found in database table. Will get them now.")
    oauthRoutine()
    return
  global oauthKey
  global oauthSecret
  oauthKey = row[0]
  oauthSecret = row[1]
  cursor.close()
def createDatabaseTables():
  SQL_CREATE_MENTIONS_TABLE = "create table if not exists mentions ( id mediumint not null auto_increment, msg char(200) not null, logtime datetime not null,  primary key(id));"
  SQL_CREATE_OAUTH_TABLE = "create table if not exists oauth ( oauthkey varchar(100) not null, oauthsecret varchar(100) not null, logtime datetime not null,  primary key(oauthkey, oauthsecret));"
  cursor = conn.cursor()
  cursor.execute(SQL_CREATE_MENTIONS_TABLE)
  cursor.execute(SQL_CREATE_OAUTH_TABLE)
  cursor.close()
def write2DB(msg):
  msg = msg.encode('utf-8')
  cursor = conn.cursor()
  cursor.execute("""Select id from mentions where msg = %s""", msg)
  row = cursor.fetchone()
  if row == None:
    print(msg)
    cursor.execute("""insert into mentions (msg, logtime) value(%s,current_timestamp())""", msg)
    sendMail("Twitter mention - " + msg, msg + " http://twitter.com/replies");
  cursor.close()
CONSUMER_KEY = 'Lo2csqv5LY8fxxAIFEPSjA'
CONSUMER_SECRET = 'pBYdypkbaxV4VpaB84SfoyUjvOZOfSEaanpClLeAg'
conn = MySQLdb.connect (host="localhost", user="**YourDBUserNameHere**", passwd="**YourDBPasswordHere**", db="**DBUserNameHere**")
createDatabaseTables();
readOauth()
auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)
auth.set_access_token(oauthKey, oauthSecret)
api = tweepy.API(auth)
while (True):
  list = api.mentions()
  for status in list:
    write2DB(status.text.replace("'", "\""))
  print("Sleeping")
  time.sleep(60 * 10)
  print("Awake")

Here is a screenshot of the email notification:

Twitter Mention Email Screenshot

Twitter Mention Email Screenshot

Categories: Technology Tags: , , ,

Tweets and Dents on TV

MythTV is a free open source home entertainment system. MythTV provides a hook to the On-Screen Display (OSD). With a little Python scripting you can display tweets and dents on the screen while your are watching recordings or live tv. It is interesting to read what the rest of the world thinks while you are watching an event on TV. Here are some use-cases for the microblogging On-Screen Display:

  • Election return twitter feed
  • Popular TV show twitter feed
  • Sporting event twitter feed (see demo below)
  • Stock ticker
  • Weather alerts

Below are two video demonstrations of displaying microblog messages on my TV. The first video is during the 2010 NASCAR Coca-Cola 600 race with the search term “NASCAR”. It displays search results from Identi.ca and Twitter. The second video is just displaying my personal Identi.ca and Twitter messages while watching an episode of SNL.

 

 

Tweets and Dents while watching NASCAR Racing: Coca-Cola 600 2010

 

Tweets and Dents while watching SNL