Last active
March 27, 2020 06:10
-
-
Save chunkhang/ba5a0004fb8e8efb83b46c77c8ef262d to your computer and use it in GitHub Desktop.
Revisions
-
chunkhang renamed this gist
Mar 27, 2020 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
chunkhang created this gist
Mar 27, 2020 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,18 @@ #!/usr/bin/env bash function show-help() { echo "usage: picsum <width> [height]" } function download-image() { curl --location "https://picsum.photos/${1}/${2}" --output "$3" 2>/dev/null echo "$3" } if [[ "$#" = 0 ]]; then show-help elif [[ "$#" = 1 ]]; then download-image "$1" "$1" "${RANDOM}-${1}-${1}.jpg" else download-image "$1" "$2" "${RANDOM}-${1}-${2}.jpg" fi