pub / pastesrv

Paste service setup for paste.jayvii.de
git clone https://https://src.jayvii.de/pub/pastesrv.git
Home | Log | Files | Exports | Refs | README | RSS

commit d6e899426684bea7ef613f35c59e08943cc0df58
parent 98628aed6c8b17dd082379b7f8742c6b22592177
Author: JayVii <jayvii[AT]posteo[DOT]de>
Date:   Sat, 29 Jun 2024 21:07:11 +0200

feat: transform readme to markdown

Diffstat:
DREADME | 62--------------------------------------------------------------
AREADME.md | 70++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 70 insertions(+), 62 deletions(-)

diff --git a/README b/README @@ -1,62 +0,0 @@ -pastesrv -======== - -Please send patches or remarks to <jayvii[AT]posteo[DOT]de> - -Super simple selfhosted paste server inspired / copy-cat'ed from: -https://www.codemadness.org/paste-service.html - -Setup ------ - -Let's assume you are running Debian on your server, OpenSSH is already setup -and you are using Apache as your webserver with "paste.example.com". - -Create a new user for the paste service on your server: - - useradd -d /var/www/pastesrv -G www-data -m paste - mkdir -p /var/www/pastesrv/paste - chown paste:www-data -R /var/www/pastesrv - chmod 770 -R /var/www/pastesrv - -Optionally, set a password for the "paste" user. Or, better yet use an SSH-key. -See: https://wiki.archlinux.org/title/SSH_keys - -Copy the apache-config and edit it accordingly - - cp pastesrv-apache.conf /etc/apache2/sites-available/ - # now edit it accordingly - a2ensite pastesrv-apache - -Copy the index and 404 page to the web-root: - - cp index.html /var/www/pastesrv/paste/index.html - cp 404.html /var/www/pastesrv/paste/404.html - -The service is ready now. Next, setup your client accordingly. The codemadness -blog has a nifty bash-function (https://www.codemadness.org/paste-service.html), -which I adapted a little bit. You can also find it in this repository as -"pastesrv.sh": - - pastesrv() { - # set default file name if none is given - HASH=$(date +%s | sha256sum | awk '{ print $1 }') - # forward stdin to the server - ssh paste[AT]paste[DOT]example.com "cat > ~/paste/${1:-$HASH}" - # output for user - echo "https://paste.example.com/${1:-$HASH}" - } - -The function reads from stdin, so whatever you pipe to it, will be send to the -paste-service: - - # sending the current date to the server as unnamed paste - date | pastesrv - - # sending some script file to the server as named paste - cat my_script.sh | pastesrv "check_out_my_script.sh" - - # make a screenshot (wayland) and upload it immediately - grim - | pastesrv - - diff --git a/README.md b/README.md @@ -0,0 +1,70 @@ +# pastesrv + +Please send patches or remarks to +[jayvii[AT]posteo[DOT]de](mailto:jayvii[AT]posteo[DOT]de) + +Super simple selfhosted paste server inspired / copy-cat'ed from: +[codemadness](https://www.codemadness.org/paste-service.html) + +## Setup + +Let's assume you are running Debian on your server, OpenSSH is already setup +and you are using Apache as your webserver with "paste.example.com". + +Create a new user for the paste service on your server: + +```bash +useradd -d /var/www/pastesrv -G www-data -m paste +mkdir -p /var/www/pastesrv/paste +chown paste:www-data -R /var/www/pastesrv +chmod 770 -R /var/www/pastesrv +``` + +Optionally, set a password for the "paste" user. Or, better yet use an SSH-key. +See: [Arch Wiki: SSH keys](https://wiki.archlinux.org/title/SSH_keys) + +Copy the apache-config and edit it accordingly + +```bash +cp pastesrv-apache.conf /etc/apache2/sites-available/ +# now edit it accordingly +a2ensite pastesrv-apache +``` + +Copy the index and 404 page to the web-root: + +```bash +cp index.html /var/www/pastesrv/paste/index.html +cp 404.html /var/www/pastesrv/paste/404.html +``` + +The service is ready now. Next, setup your client accordingly. The codemadness +blog has a [nifty bash-function](https://www.codemadness.org/paste-service.html), +which I adapted a little bit. You can also find it in this repository as +`pastesrv.sh`: + +```bash +pastesrv() { + # set default file name if none is given + HASH=$(date +%s | sha256sum | awk '{ print $1 }') + # forward stdin to the server + ssh paste[AT]paste[DOT]example.com "cat > ~/paste/${1:-$HASH}" + # output for user + echo "https://paste.example.com/${1:-$HASH}" +} +``` + +The function reads from stdin, so whatever you pipe to it, will be send to the +paste-service: + +```bash + # sending the current date to the server as unnamed paste + date | pastesrv + + # sending some script file to the server as named paste + cat my_script.sh | pastesrv "check_out_my_script.sh" + + # make a screenshot (wayland) and upload it immediately + grim - | pastesrv +``` +