@line_magic<EOL><INDENT>def pastebin(self, parameter_s='<STR_LIT>'):<DEDENT>
opts, args = self.parse_options(parameter_s, '<STR_LIT>')<EOL>try:<EOL><INDENT>code = self.shell.find_user_code(args)<EOL><DEDENT>except (ValueError, TypeError) as e:<EOL><INDENT>print(e.args[<NUM_LIT:0>])<EOL>return<EOL><DEDENT>post_data = json.dumps({<EOL>"<STR_LIT:description>": opts.get('<STR_LIT:d>', "<STR_LIT>"),<EOL>"<STR_LIT>": True,<EOL>"<STR_LIT>": {<EOL>"<STR_LIT>": {<EOL>"<STR_LIT:content>": code<EOL>}<EOL>}<EOL>}).encode('<STR_LIT:utf-8>')<EOL>response = urlopen("<STR_LIT>", post_data)<EOL>response_data = json.loads(response.read().decode('<STR_LIT:utf-8>'))<EOL>return response_data['<STR_LIT>']<EOL>
Upload code to Github's Gist paste bin, returning the URL.

        Usage:\\
          %pastebin [-d "Custom description"] 1-7

        The argument can be an input history range, a filename, or the name of a
        string or macro.

        Options:

          -d: Pass a custom description for the gist. The default will say
              "Pasted from IPython".