uima's site

publish: 2026-01-11

update: 2026-01-11

commit: 2b9f203 - publish

tags: #zh #cli

0x0.st

有時候一個東西的概念簡單到你會想:為什麼其他所有東西都不像這樣呢?

0x0.st 是一個文件臨時分享服務,使用方法如下:

curl -F'file=@yourfile.png' https://0x0.st

基本上就是上傳檔案到 0x0.st,然後它會回覆你一個短鏈結如 https://0x0.st/xxxx.png,然後你就可以拿這個鏈接分享、下載檔案。

no AI, no Ad, no bullshit

上傳,鏈接,Done。

0x0.st 最大只能上傳 512 MB 的檔案,最少會保持 30 天,更多資訊在 0x0.st 有寫。

也有其他類似的臨時分享服務,如 https://bashupload.com,或是自架,如 MicroBin 等。

How I Use It

我有寫一個簡單的 wrapper script,它可以接受指定路徑的方式,也可以用 pipe 的方式上傳:

#!/usr/bin/env sh

if [ ! -t 0 ]; then
    curl -sS -F "file=@-" https://0x0.st
elif [ -f "''${1:-}" ]; then
    curl -sS -F "file=@$1" https://0x0.st
else
    echo "Usage: $0 [filename]" >&2
    exit 1
fi

用法:

# upload the file
0x0 yourfile.png

# upload the service log
journalctl -u yourservice | 0x0

Warning

注意不要沒加密就上傳 private 的資訊

Working with 0x0.st

接下來就是為什麼這個 API 這麼棒,因為它回傳的東西是簡單的純文字 url,所以我們可以 pipe 那個 url 到任何地方。

如簡單的自動複製 url:

# x11
cat yourfile.png | 0x0 | tee /dev/tty | xclip -selection clipboard

# wayland
cat yourfile.png | 0x0 | tee /dev/tty | wl-copy

或是生成 QR Code:

cat yourfile.png | 0x0 | tee /dev/tty | qrencode -s8 -m2 -t UTF8
# https://0x0.st/xxxx.png
# █████████████████████████████
# ██ ▄▄▄▄▄ █ ▀▀▄  ▄███ ▄▄▄▄▄ ██
# ██ █   █ ███ ▄▄ ▀▀██ █   █ ██
# ██ █▄▄▄█ █ ▄▄ █▀ █ █ █▄▄▄█ ██
# ██▄▄▄▄▄▄▄█ █ ▀ █ ▀ █▄▄▄▄▄▄▄██
# ██ ▄ ▀▀▄▄█   ██▀█▀ ▄  ▄▀█  ██
# ██▀█▄█▀█▄█▄▀█▄█▄▀ █ █▀▄ ▄█▄██
# ██▄▀▀ ▄█▄▀█ █▄  ▄ ▀█ ▀███▀ ██
# ██▄▄▄█ ▀▄██▄█▀ █▄▄█▀█▀▀ ▄█▄██
# ██▄▄█▄█▄▄█   ██ ▄▄ ▄▄▄ ██▄▀██
# ██ ▄▄▄▄▄ █▀ █▄█▀█▀ █▄█ ██▀▄██
# ██ █   █ ██▀ ▄ ▄█▄▄ ▄▄ █▀▀▄██
# ██ █▄▄▄█ █ ▄ ▀ ▄ ▀ ▄█  ▄█▄▄██
# ██▄▄▄▄▄▄▄█▄████▄▄█▄█▄██▄██▄██
# █████████████████████████████

或是生成 QR Code 後自動複製:

cat yourfile.png \
    | 0x0 \
    | tee >( qrencode -s8 -m2 -t UTF8 ) \
    | tee /dev/tty \
    | wl-copy

好啦,我承認我的創意有限,就留給讀者自己運用了。

Misc

我記得在一兩年前,我收集了蠻多有趣的小程式、服務的,但現在記得的很少了。像這個也是之前看到的,但是前一陣子都沒有需要分享檔案的場景,之前寫的腳本也在 distro hopping 到 NixOS 的時候沒有一起轉過來,就被我慢慢的遺忘了,果然人腦是不能相信的。