Skip to content

Instantly share code, notes, and snippets.

@st-f
Last active December 6, 2019 09:36
Show Gist options
  • Star 10 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save st-f/22fe7f3cca8f21641c85 to your computer and use it in GitHub Desktop.
Save st-f/22fe7f3cca8f21641c85 to your computer and use it in GitHub Desktop.
Download X random images from lorempixel.com
# usage : sh download.sh 100
# will download 100 pics
START=1
for i in $(eval echo "{$START..$1}")
do
curl "http://lorempixel.com/index.php?generator=1&x=640&y=480&cat=" -o temp.html && cat temp.html | sed -n 's/.*<img src="\([^" ]*\)".*/\1/p' | awk '{print "http://lorempixel.com/"$1}' | xargs curl -o $i.jpg
done
@adimallikarjunareddy
Copy link

if some one wants to have some random word appended to the filename instead of numbers just use the following one on Linux

random_word=shuf -n1 /usr/share/dict/words

and replace $i with $random_word$i

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment