Skip to content

Instantly share code, notes, and snippets.

@syamgot
Last active April 26, 2017 02:13
Show Gist options
  • Save syamgot/310b96b0aee1c3b5aca4fa017af22365 to your computer and use it in GitHub Desktop.
Save syamgot/310b96b0aee1c3b5aca4fa017af22365 to your computer and use it in GitHub Desktop.
ケイジかセガールか子猫のJPGを縦横サイズを指定してランダムで作成する
#!/bin/bash
URLS=("http://www.stevensegallery.com" "http://www.placecage.com" "http://placekitten.com")
DIR="."
# ----------------------------------------
if [ $# -lt 2 ]; then
echo "usage: demoimg.sh witdh height" 1>&2
exit 1
fi
W=$1
H=$2
if [ $# -eq 3 ]; then
O=$3
else
T=`date '+%Y%m%d%H%M%S'`
O=${DIR}/${T}_${W}_${H}.jpg
fi
R=$(($RANDOM % ${#URLS[@]}))
URL=${URLS[${R}]}
curl -so $O ${URL}/${W}/${H}
exit 0
@syamgot
Copy link
Author

syamgot commented Feb 9, 2017

placeholder.sh width height [output_path]

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