Paste-py is a dead simple paste service written in Python. An instance of the original script is running at http://paste.awesom.eu.
- Don’t protect the full app with a password, only users
The most useful utility is the paste.sh script: save it somewhere in your path and use it as follows:
paste.sh foo
will paste the content of the filefoo
and return the URL of the pastepaste.sh -
will paste what it reads from stdin and the URL of the paste
You can also put the language to highlight with and the user as second and third argument (though the language will be detected from the extension).
You can look at the parameters at the beginning of the script to set a default user or automatically copy the paste URL.
With paste-py, everything happens in the arguments you give in the
URL. Every argument is prepended by a &
. The following arguments
can be used:
ln
: add line numbers to the pastehl=foo
: syntax highlight the paste as languagefoo
raw
: raw paste, to download it; you can also use the prefix/raw/
to have a shell-friendly URL (eg.http://paste.awesom.eu/raw/HiT
)script
: used to paste from a script (will only return the URL, no html)
Users are also supported: enter a username (eg. foobar
) when pasting
something, and you can access all your pastes by browsing
http://paste.awesom.eu/user/foobar
. Note that you cannot delete
your pastes, so think twice before pasting something sensitive. In
case you really need to delete a paste, contact me.
This version of Paste-py is protected by password (ie. you won’t be able to acces the application without going through the login page, which ask you for a password). I create this when I was studying in the IUT of Nantes. With two friends we were using past-awesom.eu a lot to exchange source code, but bad intended peoples used to go check our pastes and re-use them. To avoid this, I’ve reworked a bit this script which is originaly from https://github.com/acieroid/paste-py to add a password protection. Check below to see how to setup the password.
The only dependencies are Tornado and Pygments. If you want to use the script to launch paste-py as a daemon, grizzled is also needed.
There’s two thing to do in order to setup the password.
First, input your password in the global var PASSWORD (located on the top of the paste.py file).
Then, go to the end of the file, in the line cookie_secret
“azertyuiopqsdfghjklmwxcvbn”= and replace the
content with a anything you want. This is the string used to salt the cookie used to check if a user
is authentified.
$ pip install tornado pygments grizzled
You can either launch it as a daemon or not: launch daemonize.py
or
paste.py
. Look at the help (--help
) if you want to change the
listening address. For example:
$ LANG=en_US.UTF-8 python paste.py --addr=0.0.0.0 --port=8080
The design is pretty basic, but some people made improvements to it. If you want a better design, look at http://paste.isomorphis.me/.
WTFPL, ie. do what the fuck you want with it.