Created
November 8, 2011 10:12
-
-
Save commuterjoy/1347412 to your computer and use it in GitHub Desktop.
Dropbox
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Add this to /etc/profile and source it, then you can type `drop [file|folder]` to transfer | |
# files to some remote host, or 'drops' to list all drops, or 'undrop [file] | |
export DROPHOST=example.com | |
export DROPUSER=username | |
export DROPPATH=/home/path/to/folder | |
export DROPWEBROOT=/drop | |
# drop a file or folder & copy the resulting url to your clipboard | |
function drop() { | |
echo "copying $1 to remote"; | |
scp -r -P 86 $1 ${DROPUSER}@${DROPHOST}:${DROPPATH}; | |
echo "http://${DROPHOST}/${DROPWEBROOT}/$1" | pbcopy; | |
pbpaste; | |
} | |
# list current drops | |
function drops() { | |
ssh -p 86 -l ${DROPUSER} ${DROPHOST} "ls -1 ${DROPPATH}"; | |
} | |
# undrop (delete a drop) | |
function undrop() { | |
ssh -p 86 -l ${DROPUSER} ${DROPHOST} "rm -iR ${DROPPATH}/$1"; | |
} | |
# tar & gz a before it's dropped | |
function dropgz() { | |
tar -cvzf "/tmp/$1.tar.gz" "$1"; | |
cd /tmp; | |
drop "$1.tar.gz"; | |
cd -; | |
} | |
Author
commuterjoy
commented
Nov 8, 2011
- tarbal/gz is easy enough as we can carry that out in the /tmp folder
- invite only drops we can do by generating a random string and scp'ing to that folder
- private drops we can drop in to a /private folder that's not in web space or has http auth on it
- scp has built in bandwidth limiting, specified in Kbit/s, so that will do for "Dropbox won't hog your connection"
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment