Skip to content

Instantly share code, notes, and snippets.

@j05h
Created February 5, 2011 16:35
Show Gist options
  • Save j05h/812570 to your computer and use it in GitHub Desktop.
Save j05h/812570 to your computer and use it in GitHub Desktop.

nwcopy/nwpaste

The fool proof network copy & paste program. Well, maybe someday.

Usage

> nwcopy
/Users/josh/Dropbox/nwcopy/f314eee55161b14f140ee07b358ba63ef54112ac
> nwpaste
https://github.com/j05h/nwcopy

> nwcopy /path/to/file
/Users/josh/Dropbox/nwcopy/e1c1675f009e65d8571bbab9243660da20a3b2a2
> nwpaste
Contents of file

> echo 'pipes work' | nwcopy
/Users/josh/Dropbox/nwcopy/5293e79627710caf507fb9b841df51356650c78d
> nwpaste
pipes work

Description

nwcopy takes whatever is in the clipboard (or pipe or filename) and copies it to a file in your Dropbox folder ~/Dropbox/nwcopy/<sha1>

nwpaste takes the contents of the most recent file, prints it to STDIN and puts it in the clipboard.

WTF?

How in the world is this useful?

I constantly want to copy and paste between machines which cannot directly talk to one another. However, they do both have Dropbox installed. My solution was simple, and this is it.

Is that all?

Is that all? Well, yeah, right now. This is the initial version, and it works! However, here are my plans:

  • Write some tests

  • Support multiple files with globbing and whatnot.

  • When files are supplied, they should be pasted back with their original filename (tarball?)

  • Integrate with github/pastebin/skitch/etc so that you don’t need a Dropbox account.

  • Add a server component which can be easily used with curl.

  • Have some delicious brisket.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment