Sunday, August 26, 2012

Disappearing SD MMC slot on MacBook Pro

Some upgrade caused the SD MMC slot on my MacBook Pro to no longer be recognized.  Zapping the PRAM (option-command-p-r during boot) brought it back.

Friday, August 3, 2012

Incremental/interruptable Unix/OSX file copy

I wanted to copy a large file to a Unix (OSX) system, and I knew it wouldn't complete before I took my laptop home.  Indeed, it would take a couple of days, so a couple of detaches would be needed.  I couldn't find anything that seemed to do the job I wanted, so I wrote the following script.  It takes two arguments: the from file and the to file.  It examines how large the to file is, and starts the copy from there, using 1 megabyte blocks. It won't work if the file changes during the overall copy operation of course.
#! /bin/bash

output_size=`du -m "$2" | cut -f 1`

if [[ $output_size = "" ]]

dd bs=1m seek=$output_size skip=$output_size if="$1" of="$2"