Import photos – bash script

#!/bin/bash
#/usr/local/bin/auto-import-images
# Script auto-import images from folder(usb-attached camera)
camera_path=/media/camera
storage_path=/home/user/Pictures
regex='.*.(jpg|jpeg|bmp)'
date=`date +%Y`/`date +"%d. %B"`

#set display for messages
export DISPLAY=:0.0

# exit if I am already running
RUNNING=`ps --no-headers -C auto-import-images | wc -l`
if [ ${RUNNING} -gt 2 ]; then
  echo "Already running"
  exit 1
fi

# check if camera storage is mounted
mountpoint $camera_path > /dev/null
if [ "$?" == "0" ]; then
  images=`find $camera_path -iregex $regex | wc -l`
  if [ $images != 0 ]; then
    zenity --info --title 'Importing images' --text 'Importing images. Do not disconnect camera!'
    if [ ! -d "$storage_path$date" ]; then
      mkdir -p "$storage_path$date"; fi
    find $camera_path -iregex $regex | xargs -I file mv file "$storage_path$date"
    if [ "$?" != "0" ]; then
      zenity --info --title 'Import failed' --text 'Something went wrong, importing photos failed!';
    else
      sync
      umount $camera_path
      zenity --info --title 'Importing done' --text 'All photos where imported. You may disconnect the camera.'
      gnome-open "$storage_path$date"
    fi
  fi
fi

Enable java6 for chrome in osx

Upgrading to 10.8.2 will install java7 and disable java6. Java7 is only 64 bit, chrome is 32 bit.

Fix:

sudo mkdir -p /Library/Internet Plug-Ins/disabled
sudo mv /Library/Internet Plug-Ins/JavaAppletPlugin.plugin /Library/Internet Plug-Ins/disabled
sudo ln -sf /System/Library/Java/Support/Deploy.bundle/Contents/Resources/JavaPlugin2_NPAPI.plugin /Library/Internet Plug-Ins/JavaAppletPlugin.plugin
sudo ln -sf /System/Library/Frameworks/JavaVM.framework/Commands/javaws /usr/bin/javaws

NOTE: Enabling java6 might introduce security holes.
Reference: http://support.apple.com/kb/HT5559