1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
ezpaste
-------

A public pastebin service by Dash Eclipse
A fiche instance with source code highlighting and social preview

netcat-based command line pastebin

Telegram Bot: https://t.me/ezpastebot


Try out
-------

        $ echo foo | ncat ezup.dev 9999
        $ cat file.txt | ncat ezup.dev 9999

Note: use -N option with BSD netcat, or just use ncat (nmap).
https://github.com/solusipse/fiche/issues/66#issuecomment-730558672


Pure bash/zsh
-------------

The pure bash/zsh approach is slow than {openbsd,libressl}-bsd with -N or ncat (nmap),
because it waits for timeout (5s) to close connection.

bash

        alias tb="(exec 3<>/dev/tcp/ezup.dev/9999; cat >&3; cat <&3; exec 3<&-)"

zsh

        tb() { zmodload zsh/net/tcp; ztcp ezup.dev 9999; cat >&$REPLY; cat <&$REPLY; ztcp -c $REPLY }

zsh, copy link to clipboard

        tb() { zmodload zsh/net/tcp; ztcp ezup.dev 9999; cat >&$REPLY; cat <&$REPLY | tee >(xclip -selection clipboard); ztcp -c $REPLY }


/etc/cron.daily/fiche
---------------------

Life span of single paste is one month, older pastes are deleted. IP Addresses are logged and logs are deleted daily.

	#!/bin/sh
	: >/var/log/fiche/log
	OLD_PASTES=$(find /var/data/fiche/ -mindepth 1 -maxdepth 1 -type d -ctime +30)
	if [ ! -z "${OLD_PASTES}" ]; then
		stat -c "%y" $OLD_PASTES | cut -d' ' -f1 | sort -h >>/var/data/fiche-dates.txt
		rm -rf $OLD_PASTES
		NUM=$(echo "$OLD_PASTES" | wc -l)
		echo "Removed $NUM pastes"
	else
		echo "Nothing to remove"
	fi