A simple zsh function to upload pictures or other files to a free image hosting service.
In example the https://0x0.st pastebin service is used. For syntax example visit the website:
user % lynx https://0x0.st
THE NULL POINTER
================
HTTP POST files here:
curl -F'file=@yourfile.png' http://0x0.st
You can also POST remote URLs:
curl -F'url=http://example.com/image.jpg' http://0x0.st
...
Edit the ~/.zshrc file and a function called 0x0, to upload a file to the picture hosting service.
function 0x0(){
# syntax for calling function without mandatory file
readonly file=${1:?" Syntax: 0x0 picture.png"}
# upload the file
echo "Uploading file to 0x0.st..."
curl -F'file=@'$1'' https://0x0.st
}
After adding the function to the .zshrc file in $HOME, source the .zshrc file to load its new settings:
user % source ~/.zshrc
Testing new function usage by uploading a file called gentoo-larry.png:
user % 0x0 gentoo-larry.png
Uploading picture to 0x0.st... https://0x0.st/oORV.png