ZSH OXO
Maybe you know about The Null Pointer, maybe you don't. It's a project run by the enigmatic Mia. Maybe they're not that enigmatic, but I don't care enough to research them. Their project, The Null Pointer, is a web service that allows for simple file uploads through HTTP POST. This is a great resource for quickly uploading reasonably-sized files to share with other people, and they even autodelete. And if that's not enough, it's all open source.
To post to The Pointer, which is accessible at 0x0.st, you have to make a request. You can use your favourite client to do it, but I use the terminal, using curl
.
The syntax couldn't be easier - simply curl -F and append your file name as a parameter. It returns the uploaded file at its URL, and even auto-checksums so you can't upload the same file more than once.
Unfortunately, I am a bit of an idiot and am bad at remembering the syntax every time I need to share a file. So, I wrote a Bash function you can just append to your bashrc
or zshrc
. It's called oxo
and you can copy it here:
oxo() {
local file="$1"
local secret="$2"
# Check for correct usage.
if [[ -z "$file" ]]; then
echo "Usage: oxo <file|URL> [secret]"
echo "<file>: Path to the file to upload, or URL of the remote file"
echo "[secret]: Optional. Specify 'secret' to make the upload less guessable"
return 1
fi
# Check if the argument is a URL or a file.
if [[ "$file" =~ ^https?:// ]]; then
# Argument is a URL, prepare to upload the URL
local upload_field="url=$file"
elif [[ -f "$file" ]]; then
# Argument is a file, prepare to upload the file
local upload_field="file=@$file"
else
echo "Error: file '$file' does not exist and it's not a valid URL."
return 1
fi
# Check for secret upload.
local secret_field=""
if [[ "$secret" == "secret" ]]; then
secret_field="-Fsecret="
fi
# Perform the upload.
curl -F "$upload_field" $secret_field https://0x0.st
}
Bonus function: If you have LargeType2 installed, which you can get here, here's a bonus command to invoke it from terminal.
lty() {
open -a LargeType2 --args -s "$1"
}
Hope this helps. And Mia, if you ever read this, thanks for the service.
Proof that it works:
