Posts Tagged ‘latitude’

Latitude where am I 2 electric boogaloo!

Wednesday, February 3rd, 2010

I decided having it post to my blog wasnt just enough.  Why not track myself via google constantly.  below is the bash script i have running in cron minutely to record my coordinates.  Enjoy.

#!/bin/bash

#License GPLv3
ID=""
Points=/home/mog/docs/whereiam/points
cd $Points
if [ `ls .|wc -l` -eq 0 ]; then
wget -q "http://www.google.com/latitude/apps/badge/api?user=${ID}&type=json" -O new
mv new `date +%s`
else
File=`ls |tail -n1`
Last_Time_Stamp=`grep timeStamp $File|cut -f2 -d':'|cut -f1 -d','`
wget -q "http://www.google.com/latitude/apps/badge/api?user=${ID}&type=json" -O new
if grep -q $Last_Time_Stamp new ; then
rm new
else
mv new `date +%s`
fi
fi

Latitude where am i?

Wednesday, February 3rd, 2010

Recently I have been playing around with google latitude.  The footer below is a wordpress plugin I made that echos out my current location to the city level at the base of the blog.   enjoy

/*
Plugin Name: Hello Latitude
Plugin URI: http://wordpress.org/#
Description: working on it
Author: Matthew O'Gorman
Version: 0.1
Author URI: http://rldn.net/

License :AGPLv3
*/

function hello_latitude() {
$googleLatID=”"; //find this at http://www.google.com/latitude/apps/badge
$url =”http://www.google.com/latitude/apps/badge/api?user=”.$googleLatID.”&type=json”;
try{
$contents = file_get_contents($url);
$contents = utf8_encode($contents);
$results = json_decode($contents, true);
$loc=”I am in “.$results['features'][0]['properties']['reverseGeocode'];
echo $loc;
}
catch (Exception $e){
echo ‘LOCATION NOT FOUND!’;
}
}
add_action(’wp_footer’, ‘hello_latitude’);
?>