Paste by bea.sh ↗
New GitHub

bea.sh Paste · v0.2.0

Based on mkaczanowski/pastebin. Passwords encrypt pastes in your browser.

About Contact IPinfo Plain-text usage API

Usage

Create pastes from your terminal or code. Each request returns the new paste's link. The same guide is available as plain text: curl https://paste.bea.sh/usage

Quick start

$ echo 'hello' | curl -q -fsSL -w '\n' --data-binary @- 'https://paste.bea.sh/'
https://paste.bea.sh/aBcD3fGh1jKlMn0pQrStU

$ curl -q -fsSL -w '\n' --data-binary @notes.txt 'https://paste.bea.sh/'

Shell function and code

Add a pastebin command that uploads stdin, or a file when one is given: cat notes.txt | pastebin or pastebin notes.txt.

Run once in fish; funcsave keeps it for new sessions.

function pastebin --description 'Upload stdin or a file to Paste'
    set -l source -
    set -q argv[1]; and set source $argv[1]
    curl -q -fsSL -w '\n' --data-binary "@$source" 'https://paste.bea.sh/'
end
funcsave pastebin

Add to ~/.zshrc, then open a new terminal.

pastebin() {
  curl -q -fsSL -w '\n' --data-binary "@${1:--}" 'https://paste.bea.sh/'
}

Add to ~/.bashrc, then open a new terminal.

pastebin() {
  curl -q -fsSL -w '\n' --data-binary "@${1:--}" 'https://paste.bea.sh/'
}

Standard library only; no packages to install.

import urllib.parse, urllib.request

def paste(text, ttl=None, burn=False, lang="markup"):
    params = {"burn": str(burn).lower(), "lang": lang}
    if ttl is not None:  # None keeps the server default; 0 never expires
        params["ttl"] = ttl
    query = urllib.parse.urlencode(params)
    request = urllib.request.Request(
        "https://paste.bea.sh/?" + query, data=text.encode(), method="POST",
        headers={"Content-Type": "text/plain"})
    with urllib.request.urlopen(request) as response:
        return response.read().decode().strip()

print(paste("hello from Python", ttl=3600, lang="python"))

Options

ttl=<seconds>Expire after this many seconds. 0 never expires. Default when ttl is omitted: 30 days.
burn=trueDelete the paste after it is read once.
lang=<language>Syntax highlighting in the web view, such as bash, python, or json.
$ cat deploy.log | curl -q -fsSL -w '\n' --data-binary @- \
    'https://paste.bea.sh/?ttl=3600&burn=true&lang=bash'

Read and delete

$ curl -fsS 'https://paste.bea.sh/raw/<id>'
$ curl -fsS -o paste.bin 'https://paste.bea.sh/download/<id>'
$ curl -fsS -X DELETE 'https://paste.bea.sh/<id>'

Notes

-q ignores ~/.curlrc, -f fails on HTTP errors, -sS hides progress but keeps errors, and -w '\n' ends the link with a newline.

Pastes are limited to 8 MiB. Anyone with a paste link can read or delete it. Password encryption happens in the browser, so pastes sent from the command line are stored as plain text. The creating IP address is kept with each paste for abuse handling and is deleted with it.