Skip to content

Instantly share code, notes, and snippets.



Last active Dec 21, 2015
What would you like to do?
Curl Imgur for valid URLs using random string from /dev/urandom
# Get the string from /dev/urandom (from ~/bin/get_rand)
# The -c flag for head indicates the amount of bytes I want to see returned.
# In this case this correlates to the amount of characters I want returned.
function random {
export rand=$(
LC_CTYPE=C tr -dc a-zA-Z0-9 < /dev/urandom | head -c 7| xargs
echo $rand
# Curl in a loop
# | head -n 1 ensures that I only see the status of the page (i.e., 404, 200)
for i in {1..100}; do rand=$(eval "get_rand"); echo "\n"$rand; curl -Is"$rand" | head -n 1; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment