diff --git a/.gitignore b/.gitignore index c00df13..ca8a121 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ *.deb +a.out +dist/usr diff --git a/Makefile b/Makefile index 79f3412..f305825 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,13 @@ all: djl-utils.deb -dist: sign suptime timestamp +dist: sign pasta suptime timestamp sign: src/sign cp src/sign dist/usr/bin +pasta: src/pasta + cp src/pasta dist/usr/bin + suptime: src/suptime.c cc -o dist/usr/bin/suptime src/suptime.c diff --git a/src/pasta b/src/pasta new file mode 100755 index 0000000..c0f7713 --- /dev/null +++ b/src/pasta @@ -0,0 +1,28 @@ +#!/usr/bin/env sh +# +# pasta: simple ssh-based paste bin +# author: Hiltjo Posthuma , Dylan Lom +# see-also: https://codemadness.org/paste-service.html + +argv0="$0" + +usage() { + echo "usage: $argv0 [-p] filename" + exit 1 +} + +pasta() { + ssh djl@p.dlom.cc "cat > /usr/local/www/p.dlom.cc/$1" + echo "http://p.dlom.cc/$1" +} + +[ "$#" -lt 1 ] && usage + +png="$([ "$1" = '-p' ] && echo 'true')" +[ ! -z "$png" ] && shift + +title="$1" +[ -z "$title" ] && usage + +([ ! -z "$png" ] && import png:- || cat) | pasta "$title" +