Developer Area

From Semantic Squirrel

The squirrels are structured by Operating System and then application.

In due course this page will need to be split up.


Contents

MacOS

Squirrel drivers

rollover.sh

DIR=`date "+/Larder/%Y-%m-%d"`
$HOME/bin/Safari.sh
$HOME/bin/iTunes.sh
$HOME/bin/Mail.sh
$HOME/bin/Weather.sh
$HOME/bin/filecp.sh
mv /Larder/Today $DIR
mkdir /Larder/Today
mkdir /Larder/Today/Files
mkdir /Larder/Today/Diary
mkdir /Larder/Today/Mail

crontab

55 23 * * *       $HOME/bin/rollover.sh >> /Larder/log 2>&1
0-59/5 * * * *  $HOME/bin/net.sh >> /Larder/log 2>&1
0 0-23/6 * * * $HOME/bin/Weather.sh >> /Larder/log 2>&1

Mail

Mail.sh

# Get the mail from Mail.
# There is a mailbox called Today, that I created, that gets copies of all incoming and outgoing mail.
# I also have the same thing in Entourage, but have to move that mailbox by hand.
mv /Users/hg/Library/Mail/Mailboxes/Today.mbox/Messages/* /Larder/Today/Mail

Safari

Safari.sh

# Grab Safari bookmarks and history
# Uses plutil to convert to normal xml
cp /Users/hg/Library/Safari/Bookmarks.plist /Users/hg/Library/Safari/History.plist /Larder/Today/
plutil -convert xml1 -- /Larder/Today/*.plist

iTunes

iTunes.sh

# Get the iTunes library.
# Would have liked to just get the items played today, but too hard, and the whole library has last played date.
# Can be quite a bit of data, so worth compressing.
cat $HOME/Music/iTunes/iTunes\ Music\ Library.xml | gzip > /Larder/Today/iTunes.xml.gz

Address Book

AddressBook.sh

# Grabs your current contact list. Not in a very readable format though.
cp $HOME/Library/Application\ Support/AddressBook/AddressBook.data /Larder/Today/

Delicious Library

DeliciousLibrary.sh

# Grabs your current media library. Note that people are referenced by their IDs in Address Book.
cp $HOME/Library/Application\ Support/Delicious\ Library/Library\ Media\ Data.xml /Larder/Today/

Non-Application

filecp

cd /Users/hg/My\ Documents/ 
find . -mtime -1 -exec cp {} /Larder/Today/Files \;

net.sh

perl $HOME/bin/netlog.pl >> /Larder/Today/WiFi

netlog.pl is a perl script.
You may need to install LWP::UserAgent using cpan.

Weather.sh

# I know I want the weather data (and probably forecasts).
# For the moment, I gather for the places I care about.
mkdir /Larder/Today/Weather
/sw/bin/wget http://weather.noaa.gov/weather/current/EGHI.html -O /Larder/Today/Weather/EGHI-weather.html
/sw/bin/wget http://weather.noaa.gov/weather/current/EGLL.html -O /Larder/Today/Weather/EGLL-weather.html
/sw/bin/wget http://weather.noaa.gov/weather/current/EINN.html -O /Larder/Today/Weather/EINN-weather.html
/sw/bin/wget http://weather.noaa.gov/weather/current/EIDW.html -O /Larder/Today/Weather/EIDW-weather.html
mv /Larder/Today/Weather `date "+/Larder/Today/T%H-%M-%S-Weather"`

motion.pl

Logs the status of Macbook/PowerBook movement sensors. Requires unimotion to be installed.

#!/usr/bin/perl -w
use strict;
while(1)
{
        my @ip_check = grep( /152\.78/, `ifconfig` );
        if( scalar @ip_check > 0 )
        {
                print time()." ".`motion`;
                sleep 10;
        }
}

(remove the ipcheck lines if you want to log motion all the time)

Windows

Squirrel drivers

Windows Media Player: I've written a .Net application that'll export the metadata from the Windows Media Player library as an XML file. I'm also writing a plugin for WMP that'll log the tracks played. When I've finished I'll put them somewhere accessible to all. Jamie 10:40, 19 May 2006 (BST)

Linux

Squirrel drivers

Non-Application

last.fm

# last.fm popular tracks squirrel by Ash
# replace 'madhousebeyond' with your last.fm user name
wget http://ws.audioscrobbler.com/1.0/user/madhousebeyond/weeklytrackchart.xml -O /Larder/Today/last.fm.tracks.xml

Mobile Phone

Squirrel drivers

I've written a Java application for PC's that'll repeatedly scan the local area using Bluetooth, and log the addresses of all devices found (to console, XML, CSV etc). This should work on Windows, Mac or Linux but it relies on a JSR-82 compatible stack being available. I've tested the avetana library on Windows using my laptop's inbuilt Bluetooth (based on a Widcomm chip). This library is also the only(?) one available for Macs but it's also commercial :-(. A 3 machine licence cost €2 and for €400 I've been offered an unlimited machine, 1 yr licence, for service discovery and inquiry functions. A free version of this library exists for Linux users in cooperation with the BlueZ stack. For Windows users with a Bluetooth chip supported by the Bluetooth stack in Windows XP SP2 (i.e., not a widcomm chip), there's also the Bluecove library.

If you're interested in a mobile Bluetooth-logger, the application used by the Reality Mining project at MIT is available to download for Symbian Series 60 phones. Jamie 10:39, 19 May 2006 (BST)

Hugh Glaser 21:16, 22 November 2005 (GMT)