" /> Michielb.nl: May 2007 Archives

« April 2007 | Main | June 2007 »

May 25, 2007

Update your Skype location automatically

A few weeks ago I set up Skype so that my 'location' (the 'mood text' that you can set yourself) automatically updates when my network location changes. Here's how that looks:

skype_shot.jpg

To do this, I installed the briliant Sleepwatcher application on my Mac. This runs a script whenever the laptop goes to sleep or wakes up. Sleepwatcher allows you to customize your own script, by putting a '.wakeup' and '.sleep' script in your home directory. It will run this script. In my .wakeup script, I detect the network settings. At home I use Wifi, at the office I'm always connected to a fixed network.

Then the script updates the actual 'Location' that the Mac shows in the Apple menu. I'm sure I could change the default printer in this way but haven't figured out how yet. Let me know if you know how to do this.. Since I have an HP Deskjet both at home and at work, printing goes wrong frequently.

Next, I update the Skype mood text by executing osascript from the .wakeup script. Osascript allows you to run Applescript from shellscript, which is very convenient in this case!

Oh yes, I also take a picture with the iSight cam. I've gathered a few hundred pictures of myself in this way. You could use this as a security feature by uploading these pictures to some server automatically..

Here's my full .wakeup script. It takes several things I found on the web together in one script, sorry for not being able to recall the origin of these ideas.. My .sleep script looks similar but much simpler, it only logs to the sleep.log file

#!/bin/sh

date=`date`;

# Generate filename based on date stamp
filedate=$(date +%Y%m%d%H%M%S).jpg;

# Take iSight Photo and store in /tmp with datestamp filename
/bin/isightcapture -w 640 -h 480 -t jpg /Users/myname/Documents/captures/$filedate >& /dev/null

sleep 10    # better for stability

#get the ssid of the network you are on
#shown on two lines; should be one with a space
ssid=`ioreg -l -n AirPortDriver | grep APCurrentSSID | sed 's/^.*= "\(.*\)".*$/\1/; s/ /_/g'`

enetip=`/sbin/ifconfig en0 | grep netmask | awk '{print $6}'`


#fill in your own values for ssid and location below
if [ x$ssid = "xnb" ]; 
then
    location="Thuis"
elif [ x$enetip = "x10.1.1.255" ]
then
    location="Diemen"
else
    location="Automatic"
fi
#echo $location

#update the location
newloc=`/usr/sbin/scselect ${location} | sed 's/^.*(\(.*\)).*$/\1/'`

echo "wakeup: ${newloc} at ${date}" >> sleep.log

osascript -e "tell application \"Skype\"" -e "send command \"SET PROFILE MOOD_TEXT @ ${location}\" script name \"My Script\"" -e 'end tell'

#exit with error if the location didn't match what you expected
if [ ${location} != ${newloc} ]
then
    exit 1
fi

exit 0

May 18, 2007

My route yesterday

route_1705.jpg

Thanks to the pretty cool software Ascent (Mac only), I can make these nice pictures of my cycling route yesterday. Here, the color of the line indicates my heart rate zone. Clearly, I wasn't trying to go very fast yesterday. But then again, I did ride 110km.

May 16, 2007

N95 third impressions

Another nice feature: You can download an application called NokiaPodcasting from Nokia. It's a podcast manager app. Amazingly, it includes a search function so I'm now already subscribed to the Fredcast, my favourite cycling blog. It downloads the podcasts, and can play it using the media player.
No need to download and sync. Just download and play, right away.
Did I mention that the N95 has gps and navigation software pre-installed? I can not imagine that Tomtom and Apple can not see this at least as a small threat.

N95 second impressions

Positive: It has a standard mini USB connector. If I hook it up to my Mac, the phone asks what it should be. One of the options is 'Mass storage'; in that case it appears in the Finder as a drive. Very cool. The music player on the phone then recognizes that there's new content, and it puts it neatly into the library.
I love it.

N95 first impressions

Positive: Syncing with old Nokia works flawlessly. Setup of Internet seems to work great; I get an automatic message from KPN with the settings! How do they do that. Also good: The web browser works fine, and it even autodetects RSS feeds which it places into a separate folder. Pretty cool.
Negative: The color deep plum is not exactly my taste. And the phone doesn't feel very solid.