Skip to content

Instantly share code, notes, and snippets.

@btbytes
Created December 18, 2020 01:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save btbytes/06e3645dd2ebc005162011a00956dbb0 to your computer and use it in GitHub Desktop.
Save btbytes/06e3645dd2ebc005162011a00956dbb0 to your computer and use it in GitHub Desktop.
Generate a Random HTML Anchor. Useful for linking to specific paragraphs in a HTML or markdown page
set aid to do shell script "/bin/bash -s <<'EOF'
randid=$(cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 6 | head -n 1)
echo \"<a id='\"${randid}\"' href='\"#${randid}\"'>¶</a>\"
EOF"
set the clipboard to aid
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment