Mount OSX SMB Share From Linux

A small reminder for all the options:
mount.cifs // /mnt/public -o user=myusername,password=mypassword,nounix,sec=ntlmssp,noperm,rw

Time Machine & Local Snapshots

Time machine can keep local snapshots. While this feature is useful if you travel and don’t have access to your Time Capsule, the local snapshots can consume a lot of the local disk space in /.MobileBackups. There is a complex Removal Algorithm for old local snapshots based on the remaining free disk space.

To find out how much space your local snapshots consume (Local Snapshots):

  • Apple-Logo → About This Mac → Further Information → Storage: Backup == Local Snapshot Space
  • Alternatively from commandline:
    test -d /.MobileBackups && du -hcs /.MobileBackups

It is useful to control the behavior of the local snapshots yourself (Controlling Local Snapshots) using tmutil disablelocal and tmutil enablelocal.

Start VNC Server on OSX from Commandline

The builtin VNC server can be started using commandline (i.e. with ssh). As root do:

cd /Library/Preferences
echo enabled >
touch /etc/ScreenSharing.launchd

Movie Import Problem iTunes 11 – Workaround

In iTunes 11.0.11 (12) 64-Bit there is a bug, which prevents movie import. Once a movie is imported (Drag & Drop or manually) it does not show up in iTunes. Nevertheless the file is copied to the iTunes directory Home Videos and is inserted into the library file iTunes Library.xml. If you wait a while the movies will show up (at least some in my case…).

This is a workaround:

  1. Click on Movies
  2. Click on Home Videos
  3. Right-Click on any movie here:
    1. Get Info
    2. Options tab
    3. Change media kind to movie

Your movies will start to show up slowly…

Creating an Envelope from Commandline Using LaTeX

This small piece of code will create an envelope from commandline…


MYADDRESS = “Mr X // Street 1 // ZIP”

usage() {
   echo “$0 – print envelopes using LaTeX”
   echo ”   address:   Mr. A // Street 123 // ZIP City, State // Country”
   echo ”   -f <a4,c4,c5,c6,dl> default: $fomat”
   echo ”         a4: a4              “
   echo ”         c4: a4              “
   echo ”         c5: a4 folded in 1/2″
   echo ”         c6: a4 folded in 1/4″
   echo ”         dl: a4 folded in 1/3″
   exit 0

while getopts “f:h” opt; do
   case $opt in
      f) format=$OPTARG; ;;
      h) usage; ;;
shift $(($OPTIND -1))

if [[ $format == c6 ]]; then
elif [[ $format == c5 ]]; then
elif [[ $format == a4 ]]; then
elif [[ $format == c4 ]]; then
elif [[ $format == dl ]]; then
   exit 1


[[ -z $ADDRESS ]] && usage

TMP=$(mktemp -d /tmp/envelope-XXXXXX)
cd $TMP

cat << eof > envelope.tex




pdflatex envelope.tex
lpr -o Duplex=None -o Manualfeed=On -o InputSlot=Envelope -o PageSize=Custom.${lx/mm/}x${ly} -o PageRegion=Custom.${lx/mm/}x${ly} -Penvelope envelope.pdf
rm -rf $TMP

Make an Image with Email Address

This is a small piece of code to create an image from your Email address:

echo $0 Name Emailaddress
[[ -z $2 ]] && exit 2
convert -size 250×30 xc:transparent -font Verdana -fill “#003399” -pointsize 16 -draw “text 5,15 ‘Email: $@'” $NAME-mail.png

Scan PDF from Commandline

In the following I show a small piece of code to scan PDF files from commandline:

cat << EOF 
— $0 — Scan Images -> PNG-Archive & PDF
   (1) Name
   -> Scanning: counter_start counter_increment
   -> Postprocessing: 
      -rotate (by 90 deg)
      -gray (keep it grayscale)

function DIE { echo “$@”>&2; exit -1; }
function is_installed {
   while [[ -n $1 ]]; do
      [[ -z $( type -p $1  ) ]] && DIE “missing: $1”
#is_installed convert pdftk scanimage

[[ -z $1 ]] && DIE “missing name”

if [[ -n $2 ]]; then
   shift 2

   echo “Scanning images”
   scanimage –batch=$NAME”_%d”.tif –batch-increment $CNT_INC –batch-start $CNT –source ADF –mode $MODE –resolution $RES -x 210 -y 297 -v

#unpaper –layout double –output-pages 2

GRAY=”-threshold 50%”
while [[ -n $1 ]]; do
   case $1 in 
      -rotate) ROTATE=”-rotate 90″; shift; ;;
      -gray) GRAY=””; shift; ;;
      *) shift; ;;
echo “Processing images:”
for FILE in $NAME*tif; do
   echo “Processing “$FILE”:”
   PREFIX=`echo $FILE | sed ‘s/.tif//g’`
   LIMITS=”-limit memory 512 -limit map 512″
   PAGE=”$ROTATE -page a4 +repage”
   COMPRESSION=”-compress Group4″
   #[[ ! -e $PREFIX.png ]] && convert $LIMITS $GRAY -monitor $FILE $PREFIX.png
   [[ ! -e $PREFIX.pdf ]] && convert $LIMITS $PAGE $GRAY $COMPRESSION -monitor $FILE $PREFIX.pdf
echo “Creating PDF”
CNT_MAX=`find -name “$NAME*pdf” | tr -cd 0-9″\n” | awk ‘$1>max{max=$1}END{print max}’`
for I in `seq 1 $CNT_MAX`; do FILES=$FILES” ${NAME}_$I.pdf”; done;
pdftk $FILES cat output $NAME.pdf
echo “Creating archive”
#tar cvjf ${NAME}_png.tar.bz2 ${NAME}*png
tar cvjf ${NAME}_tif.tar.bz2 ${NAME}*tif
echo “Cleanup”
rm ${NAME}_*.pdf *tif #*png