: ${PB_INSTANCE:=ptpb.pw} : ${PB_CURL_ARGS:=""} PASTE_LOG_FILE=$HOME/.local/zsh/ptpb.log # pb upload function pbu() { local tmp=$(mktemp) if [ "$#" -eq 0 ]; then # paste from stdin curl $PB_CURL_ARGS -sF c=@- https://$PB_INSTANCE > $tmp else curl $PB_CURL_ARGS -sF c=@$1 https://$PB_INSTANCE > $tmp fi mkdir -p $(dirname $PASTE_LOG_FILE) { cat $tmp; echo; } | tee -a $PASTE_LOG_FILE cat $tmp | awk '/url/ { print $2 }' | tr -d '\n' | xclip -i rm $tmp } # pb delete, takes short id # someone please fix this function pbd() { local short=$(grep -C2 $1 $PASTE_LOG_FILE \ | awk '/uuid/ { print $2 }') curl $PB_CURL_ARGS -X DELETE https://$PB_INSTANCE/$short } function termbin() { nc termbin.com 9999 }