MATE_HOST=corey@127.0.0.1

TMP_DIR=`ssh $MATE_HOST mktemp -d /tmp/remote_mate.XXXXXX`

scp "$@" $MATE_HOST:$TMP_DIR
#ssh $MATE_HOST mate -nw $TMP_DIR
ssh $MATE_HOST mate -nw $TMP_DIR
scp "$MATE_HOST:$TMP_DIR/*" .

# This could be pretty dangerous, and I haven't tested it.
# Delete temporary files.
#ssh $MATE_HOST rm -rf $TMP_DIR