Skip to content

Instantly share code, notes, and snippets.

@rkennesson
Last active July 26, 2017 01:57
Show Gist options
  • Save rkennesson/635bc2c4bb14015a428edfaed87bdddd to your computer and use it in GitHub Desktop.
Save rkennesson/635bc2c4bb14015a428edfaed87bdddd to your computer and use it in GitHub Desktop.
sprunge paste
#!/bin/bash
# requires xclip to paste into xsession clipboard otherwise
# print to terminal
if hash xclip 2>/dev/null; then
echo "sending url to clipboard";
curl -s -F 'sprunge=<-' http://sprunge.us | xclip -selection c;
else
curl -s -F 'sprunge=<-' http://sprunge.us;
fi
# original from
# https://www.reddit.com/r/linux/comments/5zqku2/list_of_command_line_curl_tools_like_ixio_0x0st/df1lpr8/
# tmpfile=$( mktemp -t paste.XXXXXXXXXX );
# curl -s -F 'sprunge=<-' http://sprunge.us >> "$tmpfile";
# cat "$tmpfile";
# echo "putting it in the clipboard";
# cat "$tmpfile" | xclip -selection c;
# rm -f "$tmpfile";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment