Scratching an itch: Cocaine

Published on .

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

Senior full-stack engineer with 5 years of experience building web applications for clients all over the world.

Interested in working together?

Find out what I can do for you or get in touch!

Like this? Sign up to get regular updates