Have you ever wanted to quickly generate a uuid (universally unique identifier), without leaving the terminal, and without installing any tools?
Now you can 😄
# print to terminal
curl https://new-uuid.com
# copy to clipboard (Windows git-bash or WSL)
curl https://new-uuid.com | clip.exe
# copy to clipboard (Windows PowerShell)
curl.exe https://new-uuid.com | clip.exe
# copy to clipboard (Linux with Wayland)
curl https://new-uuid.com | wl-copy
# etc...
I'm using Rust to create a web assembly (wasm32-wasi) binary, and running it on Cloudflare's serverless platform; Cloudflare workers.
This is inspired by a blogpost by Cloudflare.
Prerequisites: Install rust. Add the wasm32-wasi target with rustup target add wasm32-wasi
. Clone repository.
cargo build --target wasm32-wasi --release
Prerequisites: Install a wasm runtime, e.g. wasmtime. Build a wasm binary (see above).
wasmtime ./target/wasm32-wasi/releases/new-uuid.wasm
Prerequisites: Install node/npm. Create a cloudflare account. Build a wasm binary (see above).
npx wrangler@wasm dev target/wasm32-wasi/release/new-uuid.wasm
# then test it with curl
curl http://localhost:8787
Deployment to Cloudflare is automatic on push to main. See GitHub actions workflow for details.
Manual one-time steps
- Buy new-uuid.com domain
- Add new-uuid.com as a website in Cloudflare with free plan
- Follow the suggested steps for DNS configuration and updating the domain registrar to use Cloudflare's name servers
- Generate API token in Cloudflare
- Add the API token and Account ID to GitHub actions secrets
- Add custom domain for workers through Cloudflare dashboard