2022-12-06 08:01:44 +01:00
|
|
|
#!/bin/sh
|
|
|
|
. $HOME/.bin/_config
|
|
|
|
|
2023-10-30 20:13:00 +01:00
|
|
|
RPATH=/home/sdk/make-web/src/paste
|
|
|
|
SSH="sdk@home.codevoid.de"
|
2024-01-08 23:06:28 +01:00
|
|
|
WEB="https://ptrace.org"
|
2022-12-06 08:01:44 +01:00
|
|
|
|
|
|
|
f="$1"
|
|
|
|
if [ "$1" = "-h" ]; then
|
|
|
|
printf "Usage:\n"
|
|
|
|
printf " paste < text.txt - read from stdin, generate filename\n"
|
|
|
|
printf " paste new.txt < file.txt - read from stdin with filename\n"
|
|
|
|
printf " paste file.txt - upload file as is\n"
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
if [ -z "$1" ]; then
|
|
|
|
f="$(date +"%Y-%m-%d_%M-%S")-$(pwgen -1 4 -A -0).txt"
|
2023-10-30 20:13:00 +01:00
|
|
|
ssh ${SSH} "printf \"%s\" \"$(cat)\" > ${RPATH}/$f"
|
2022-12-06 08:01:44 +01:00
|
|
|
|
|
|
|
elif [ -f "$f" ]; then
|
2023-10-30 20:13:00 +01:00
|
|
|
scp "$f" ${SSH}:"${RPATH}/${f##*/}"
|
2022-12-06 08:01:44 +01:00
|
|
|
else
|
2023-10-30 20:13:00 +01:00
|
|
|
ssh ${SSH} "printf \"%s\n\" \"$(cat)\" > ${RPATH}/${f##*/}"
|
2022-12-06 08:01:44 +01:00
|
|
|
|
|
|
|
fi
|
|
|
|
|
2024-01-10 07:51:13 +01:00
|
|
|
ssh ${SSH} "cd ~/make-web && make install"
|
2022-12-06 08:01:44 +01:00
|
|
|
|
2023-10-30 20:13:00 +01:00
|
|
|
printf "${WEB}/${f##*/}\n"
|
|
|
|
printf "${WEB}/${f##*/}" | xclip
|
2022-12-06 08:01:44 +01:00
|
|
|
|
|
|
|
[ -z $DISPLAY ] || notify-send "$(xclip -o)"
|