Scratching an itch: Cocaine

Published on 26 Jan 2008

Cocaine Context Menu

Ever have a file you need to quickly upload to a remote location so that you can share it with others? I have. For example, some photo I want to show someone, real quick.

So I wrote a script to do just that. It uploads a file to a previously specified location, and then puts the URL to that file in the clipboard, for easy pasting in whatever esoteric communication device you’re using, like IRC, IM, or E-mail. In fact, it copies the URL first, and then uploads the file, so you can paste the URL even before the file has uploaded.

Get it here: Cocaine v1.0

It’s a python script with about 30 functional lines. It requires pyGTK to interact with the clipboard. Edit the file and insert your ftp-server, username, password, and HTTP-subpath. I recommend using Nautilus-actions for Gnome users to add Cocaine to your context-menu, so you can easily right-click->upload any file straight out of nautilus.

(Both pygtk and nautilus-actions are in Ubuntu repositories)

David Verhasselt

I’m a consultant & entrepreneur. I build webapps and optimize Minimal Viable Products for clients all over the world. If you'd like to chat, hit me up on

Like this? Sign up to get regular updates