Mac Sleep Timer

I often wanted to leave my computer on when I go to bed but don’t want it running all night – when downloading a torrent for example.

Here is a quick Automator script to use on your mac to do so.

I have used Growl for a couple of notifications. If you don’t have Growl installed you can just delete these actions.

The script is basic in that it doesn’t have any sort of validation of the user entered values.

Run the script and it will ask you to enter a sleep time in minutes. Hit enter and it will then wait to that time before it puts your mac to sleep. Simple eh?

Just open this up with Automator to check it out. It is easy to understand.

SleepInTime

Posted in Uncategorized | Leave a comment

Eclipse Settings for Mac

I’ve found Eclipse (3.5) runs really slow on Mac in recent releases.

These settings seem to help somewhat. Add/Update them in the eclipse.ini file which can be found in the eclipse package on your mac.

-Dosgi.requiredJavaVersion=1.6
-Xms512m
-Xmx512m

The ‘Dosgi.requiredJavaVersion’ property (set to 1.5 by default), make sure Java 1.6 is used. The other settings set the memory allocation – make these more if Eclipse is still running slow.

Posted in Uncategorized | Leave a comment

Embed Google Waves

Embed Google Wave posts with the new google tool at: http://www.google.com/webelements/wave/

example below:


Posted in Uncategorized | Leave a comment

Time Machine on a Linux Share

Some time back I went through the process of configuring the Apple Time Machine backup system with my Linux based network file share.

Unfortunately it is not a straight forward process but as is often the case I found a great post to show me how.

I just happen to need to go through the process again so this time thought I’d post a reference so at least I remember next time.

Here it is, great work Matthias Kretschmann:

http://www.kremalicious.com/2008/06/ubuntu-as-mac-file-server-and-time-machine-volume/

Posted in Uncategorized | Tagged , , | Leave a comment

iSight Snapshot and DropBox

Ever thought it handy to be able to take a picture of whoever is using your computer?  Great for security, particularly if your laptop gets flogged.

Well I’ve just uncovered a neat solution for my MacBookPro and Mac Air using DropBox (which incidentally I am in love with!), the built-in iSight Cam and a little command line app called iSightCapture.

iSightCapture is simply called from the command line to take a snapshot photo using the iSight cam and saves the image as a file.  This makes automation easy.  I did the following (assuming you are a DropBox user, if you are not you should be!):

1. Download iSightCapture and stick it in the folder in /sbin.

2.  Create a basic perl script to call the iSightCapture app (see below).

3.  Create a launchd plist to call this script at login time, plus at 4 hour intervals thereafter (see below).

I chose perl for no reason other than I had another script that I could quickly modify to suit – you can use anything, obviously.

The perl script does two main things.

1.  Creates a file name for the image using the current date and time, so it is unique (unique enough anyway).

2.  Specifies the path that the image will be saved.  In my case a DropBox photos folder.

The great thing about DropBox is it automatically copies any new/modified files in it’s patch up to the cloud, almost instantly.  This is perfect for this application.

The two scripts are as follows:

Perl (save as iSightSnapshot.pl):

#!/usr/bin/env perl
 
# get date/time
my ($sec,$min,$hour,$mday,$mon,$year,
$wday,$yday,$isdst) = localtime();
 
# tweek the date/time
my $month = $mon + 1;	#Jan = 0 for $mon
my $fullyear = $year + 1900; #year offset by 1900
if ($month < 10) { $month = "0$month"; }
if ($mday < 10) { $mday = "0$mday"; }
 
# generate the command including the image filename and path, customise the path to suit your system
$command = 'isightcapture /Users/ben/Dropbox/Photos/Snaps/mbp/snaps_'.$fullyear.$month.$mday.'_'.$hour.$min.$sec.'.jpg';
 
#run backup command
system ("$command");

Launchd:

(saved in /Library/LaunchAgents and customise the path to your perl script)

 
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>Label</key>
	<string>ShapshotAtStart</string>
	<key>ProgramArguments</key>
	<array>
		<string>/Users/ben/Documents/iSightSnapshot.pl</string>
	</array>
	<key>RunAtLoad</key>
	<true/>
	<key>StartInterval</key>
	<integer>14400</integer>
</dict>
</plist>

So there you have it, a very quick and easy way to add some security to your system.

Posted in Uncategorized | Leave a comment

Install AdHoc iPhone Distribution

Instructions for installing an iPhone App as an AdHoc Distribution (ie. without the App Store).  Same goes for iTouch etc.

This assumes the developer has created a Provisioning Profle which the UDID of the iPhone on to which the App is to be installed.  It also assumes a binary of the App has been built which is signed with this profile.

To install an AdHoc distribution you need 2 things.

  1. The Application binary file (ie. the actual application).  If it is zipped up, unzip.
  2. The Provisioning Profile.  This file has a bunch of key/encription type info so Apple can be sure this AdHoc distribution is ok to install on your phone.  You have probably previously provided the Phone UDID which would have gone into this file.  The file will probably have a extension “.mobilepovision”.

Install the Provisioning Profile:

  1. Plug in your iPhone
  2. Drag the Provisioning Profile over to iTunes and drop in on the Library group.  The library group should go blue when it is ready to drop.
  3. Done…

Install the App:

  1. With you iPhone still plugged in
  2. Drag the App binary file onto the Library group, as per the Provisioning Profile.
  3. Click on the Application icon in iTunes, you should see your app listed.
  4. Sync your iPhone and your App will be installed.

The App should now be installed.

Posted in Development | Tagged | Leave a comment