A little applescript to toggle the Show Hidden Files setting for Finder.
-- Toggle Show Hidden Folders On Off
set showHiddenStatus to last word of (do shell script "defaults read com.apple.finder | grep AppleShowAllFiles")
if showHiddenStatus is "False" then
do shell script "defaults write com.apple.finder AppleShowAllFiles True"
else
do shell script "defaults write com.apple.finder AppleShowAllFiles False"
end if
-- kill Finder to make the changes active
do shell script "killall Finder"