This is a proof-of-concept using Pastebin. It's a utility function that you can put in your init.m to always have available in case you need to upload a list (or another string).
How to install it
- Create a user account at Pastebin.com.
- Log in and copy your dev key from this page.
- Go to this page and generate a user key.
- Modify the function below with your own dev key and user key, and put the function where you want it (init.m for example.)
Function
Pastebin[expr_, OptionsPattern[{
DevKey -> "<your dev key here>",
UserKey -> "<your user key here>",
PastePrivate -> "0",
PasteName -> "",
PasteExpireDate -> "N",
}]] := With[{url = URLFetch[
"http://pastebin.com/api/api_post.php",
"Method" -> "POST",
"Parameters" -> {
"api_option" -> "paste",
"api_dev_key" -> OptionValue[DevKey],
"api_user_key" -> OptionValue[UserKey],
"api_paste_private" -> OptionValue[PastePrivate],
"api_paste_name" -> OptionValue[PasteName],
"api_paste_expire_date" -> OptionValue[PasteExpireDate],
"api_paste_code" -> expr
}
]},
CopyToClipboard[
StandardForm[
Defer[Import][
"http://pastebin.com/raw.php?i=" <> StringReplace[url, "http://pastebin.com/" -> ""]]
]
];
Hyperlink[url]
]
How to use it
The only required argument is the string you want to upload. If the upload is successful a link is returned to the frontend and the corresponding Import
statement is copied to the clipboard.
Pastebin[ToString@Range[10], PasteName -> "Test", PasteExpireDate -> "1W"]
(* Out: http://pastebin.com/postID *)
The clipboard now holds Import["http://pastebin.com/raw.php?i=postID"]
.
There are are three options:
- PastePrivate
0
= public, 1
= unlisted and 2
= private
- PasteExpireDate
N
= Never, 10M
= 10 Minutes, 1H
= 1 Hour, 1D
= 1 Day, 1W
= 1 Week, 2W
= 2 Weeks, 1M
= 1 Month
- PasteName Each post can have a name.
Screencast
