Pb
pb is a lightweight pastebin and URL shortener built, written in Python using Flask. The official instance is https://ptpb.pw/.
Installation
Server
Install the nodejs-gruntAUR and pb-gitAUR packages, and enable pb.service
.
To configure the server, edit the /etc/uwsgi/pb.ini
file.
Client
Any download manager supporting HTTP POST requests may be used, such as curl. Alternatively, a native client may be used:
- pbpst — https://github.com/HalosGhost/pbpst pbqst
Usage
A paste may be created with a POST request as follows: [1] [2]
curl -F c=@- https://ptpb.pw < file
See https://ptpb.pw and API specification for more information.
/f
path, for example https://ptpb.pw/f.pbpst
See pbpst(1) and pbpst_db(5) for usage details.
- When taking standard input from a terminal, press
Ctrl+D
twice to process the data. [3] - The provider may be configured with
--provider
. (defaults to https://ptpb.pw) - By default pbpst only prints the URL at which the paste is available. The full output may be retrieved with
--verbose
.
Expiration
By default pastes are created with no expiration time. They'll last as long as the service's operator let them. -x
option may be used to set the number of seconds after which a paste should be removed:
$ thePaste="$(cat /dev/urandom | tr -cd [:print:] | head -c 32)" $ echo "$thePaste" cnf[HiC%Ybe't]4aSeIruw5hkB.h~i^B $ echo "$thePaste" | pbpst -S -m 'A test message that expires after 60s' -x 60 https://ptpb.pw/scrubbed $ date; curl 'https://ptpb.pw/scrubbed' Tue Apr 12 19:11:41 CEST 2016 cnf[HiC%Ybe't]4aSeIruw5hkB.h~i^B $ date; curl 'https://ptpb.pw/scrubbed' Tue Apr 12 19:13:06 CEST 2016 status: not found
The expired pastes, while no longer available from the remote service, are still listed in the local database:
$ pbpst -Dq expires deadbeef-dead-beef-dead-1111111111 https://ptpb.pw/scrubbed A test message that expires after 60s 1460481140
To prune them -Dy
should be used:
$ pbpst -Dy $ pbpst -Dq expires