Category Archives: code

Theme update

Found a site on one of my rss feeds flavors.me and really like the concept that they have.
Hence, updated the theme on my site (shamelessly copied the idea) but did learn some cool new tricks while doing so. (Notice the background image automatically stretches while maintaining its aspect ratio on different browser sizes on [...]

Auto mount drives on Leopard with AppleScript

tell application “Finder”
if exists disk “Shared_Vol” then
else
mount volume “afp://user@myserver.com/Shared_Vol”
end if
if exists disk “input” then
else
mount volume “smb://user:passw0rd@mywindowsbox.com/input”
end if
end tell

To run it from command line or crontab:

osascript theAppleScript.scpt

Expect to the rescue!

When you can’t pipe an input file to automate a process, especially when you need to enter a password such as ftp-ing to some server e.g.:

ftp user@ftp.myhost.com < myFTPCommands.txt

The above fails when ftp asks for a password. This is where expect comes to the rescue! e.g.:

#myExpectFile.exp

#Disable’s expect’s default 10 seconds timeout
set timeout -1

spawn ftp user@ftp.myhost.com
expect [...]