22 lines
467 B
Bash
Executable file
22 lines
467 B
Bash
Executable file
#!/bin/bash
|
|
|
|
# Install by:
|
|
# $ curl -o pst https://bin.nora.codes/client && chmod +x pst
|
|
#
|
|
# Usage:
|
|
# $ pst somefile.txt
|
|
# $ cat someimage.png | pst
|
|
|
|
# Change the url accordingly
|
|
URL="https://bin.nora.codes"
|
|
|
|
FILEPATH="$1"
|
|
FILENAME=$(basename -- "$FILEPATH")
|
|
EXTENSION="${FILENAME##*.}"
|
|
|
|
RESPONSE=$(curl --data-binary @${FILEPATH:-/dev/stdin} --url $URL)
|
|
PASTELINK="$URL$RESPONSE"
|
|
|
|
[ -z "$EXTENSION" ] && \
|
|
echo "$PASTELINK" || \
|
|
echo "$PASTELINK.$EXTENSION"
|