Skip to content

Instantly share code, notes, and snippets.

@jamesduncombe
Last active September 16, 2020 01:08
Show Gist options
  • Save jamesduncombe/bbf87122ee31067a8ccb8783f3c871f8 to your computer and use it in GitHub Desktop.
Save jamesduncombe/bbf87122ee31067a8ccb8783f3c871f8 to your computer and use it in GitHub Desktop.
Amnesia.io bash alias
amn() {
if [ $# -ge 1 -a ! -f $1 ]; then
input=$(cat -)
temp=$(mktemp)
echo $input > $temp
curl -sF "file=@$temp;filename=xyz.$1" https://amnesia.io
rm $temp
elif [ $# -ge 1 -a -f $1 ]; then
curl -sF "file=@$1" https://amnesia.io
else
echo "No filename provided (amn [filename])"
echo "Try:"
echo "amn [filename]"
echo "or"
echo "pbpaste | amn [filetype]"
echo "More info: https://amnesia.io"
return 1
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment