Skip to content

Instantly share code, notes, and snippets.

@NotMoni
Created October 9, 2019 16:18
Show Gist options
  • Save NotMoni/a9107993f8af02e47a10afc3ca229211 to your computer and use it in GitHub Desktop.
Save NotMoni/a9107993f8af02e47a10afc3ca229211 to your computer and use it in GitHub Desktop.
Check for untaken or 404 GitHub Usernames
#!/usr/bin/env bash
# Exit on error
set -e
# On MacOS, make sure shuf command is available
# All possible combinations of 4 letters,
# each on one line for streaming and in random order
combinations="$(echo {a..z}{a..z}{a..z}{a..z} | tr " " "\n" | shuf)"
echo "possibilities: $(echo "$combinations" | wc -l)"
# Filter to only names that 404 on github.com,
# 10 in parallel (might still take a while),
# and write them to a file
echo "$combinations" | xargs -P10 -I{} sh -c "curl -sfI https://github.com/{} > /dev/null || echo {}" > github.txt
echo "available on Github: $(wc -l github.txt)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment