Your task is to create a program or function that creates a paste on sprunge.us. Your program/function must receive the text to sprunge from your language's usual input mechanism, such as standard in; or in the case of a function, it can be a string or whatever makes the most sense to you. Your program will POST the text from input to http://sprunge.us/ as multipart/form-data with the form field name of sprunge. Finally, your program will output/return the URL sent back in the reply from the POST.

This is a code golf, so shortest answer (in bytes) wins.

Here is an example solution using bash and curl taken directly from the sprunge.us website. Feel free to use it in your own golf:

curl -F 'sprunge=<-' http://sprunge.us

Which returns the URL to the paste, which looks like http://sprunge.us/aXZI, where the aXZI is the ID of the sprunge.

This is my first code golfing challenge, please let me know if this is too easy or not creative enough

  • \$\begingroup\$ So, you're not allowed to write a function? Nice challenge, by the way. \$\endgroup\$
    – user62802
    Dec 25, 2016 at 18:44
  • \$\begingroup\$ Correct, it must be a complete program. Thanks by the way. I have a feeling there might not be much room for improvement from the curl example... I could make this a popularity contest if that's the case. \$\endgroup\$
    – Winny
    Dec 25, 2016 at 19:20
  • 2
    \$\begingroup\$ sprunge seems to be down (503)? \$\endgroup\$
    – devRicher
    Dec 25, 2016 at 22:41
  • \$\begingroup\$ Bummer! :( Maybe I should remake this question to use ptpb.pw... \$\endgroup\$
    – Winny
    Dec 26, 2016 at 2:37
  • \$\begingroup\$ @devRicher looks like it's back up, sorry about that. I have no control over sprunge.us. \$\endgroup\$
    – Winny
    Dec 26, 2016 at 5:43

3 Answers 3


HTML, 88 bytes

<form action="http:sprunge.us" method="POST"><textarea></textarea><button type="submit">

To test this easily, prepend data:text/html, to the code and paste it into your address bar (works for me on chrome).

Full (easily) testable code:

data:text/html,<form action="http:sprunge.us" method="POST"><textarea></textarea><button type="submit">
  • \$\begingroup\$ You ought to be able to replace http: with //. \$\endgroup\$
    – Jordan
    Jan 5, 2017 at 3:03
  • \$\begingroup\$ @Jordan not for me? I think that looks for a file, not a http:// address. \$\endgroup\$
    – Riker
    Jan 5, 2017 at 3:48
  • \$\begingroup\$ //sprunge.us is a protocol-relative URL, so if it appears on an HTTPS site it'll resolve to https://sprunge.us and if it appears on an HTTP site it'll resolve to http://sprunge.us, so it might not work if you're trying it on an HTTPS site and sprunge.us only works with HTTP. Barring that, I dunno, and I'm not at a computer so it's impractical for me to test. Sorry! \$\endgroup\$
    – Jordan
    Jan 5, 2017 at 3:52
  • \$\begingroup\$ @Jordan it doesn't work, that's all I know. \$\endgroup\$
    – Riker
    Jan 5, 2017 at 14:34

Bash, 30 bytes

curl -F'sprunge=<-' sprunge.us

Just removed the unneeded space in -F 'sprunge=<-' and the http:// from the sprunge.us url. OP gave me explicit permission to golf his reference solution.


Bash, 29 25 bytes

curl -F sprunge{=\<-,.us}

Thanks to @Score_Under for providing this awesome solution!

Old solution:

curl -Fsprunge=\<- sprunge.us

Quotes around 'sprunge=<-' are unnecessary, as long as the < is escaped.

EDIT: Interestingly, this alternative way has the exact same length:

curl -F$a=\<- $a.us
  • 1
    \$\begingroup\$ Can be shorter with careful use of brace expansion: curl -F sprunge{=\<-,.us} \$\endgroup\$ Jul 5, 2017 at 1:23
  • \$\begingroup\$ @Score_Under Thanks! updated \$\endgroup\$ Jul 15, 2017 at 16:38
  • \$\begingroup\$ @Markasoftware The space between F and s is important. \$\endgroup\$ Jul 16, 2017 at 0:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.