{% extends "base.html" %} {% block headline %}
#!/usr/bin/env python import urllib import urllib2 import sys def paste_code(): request = urllib2.Request( 'http://dpaste.de/api/', urllib.urlencode([('content', sys.stdin.read())]), ) response = urllib2.urlopen(request) # Strip surrounding quotes (NB: response has no trailing newline) print response.read()[1:-1] if __name__ == '__main__': paste_code()
Save this script in /usr/local/bin/dpaste
and chmod +x ..filepath
.
Usage: cat foo.txt | dpaste
Or you could use curl
:
alias dpaste="curl -F 'content=<-' http://dpaste.de/api/
Address
Martin Mahner
Lauterbacher Str. 4
DE-18581 Putbus
Germany
Jabber/E-Mail:
Phone:
+49 38301 890(770+8)1
1 Yes, that's math!