Skip to content

Instantly share code, notes, and snippets.

@iworks
Last active May 31, 2024 09:05
Show Gist options
  • Save iworks/9130ca71ef9a7ad6cc5899a3db05889e to your computer and use it in GitHub Desktop.
Save iworks/9130ca71ef9a7ad6cc5899a3db05889e to your computer and use it in GitHub Desktop.
WordCamp Kraków 2024 get.gravatars.sh
#!/usr/bin/env bash
#
# emails list, one per line
#
list=./list.txt
#
# gravatar size
#
size=2500
#
mkdir gravatars
#
# get
#
cat list | while read i
do
a=$(echo -n $i | md5sum|awk {"print \$1"})
filename=$(echo $i|tr "@" "-"|tr "." "_")
wget https://gravatar.com/avatar/$a?s=${size} -O gravatars/$i
done
#
# add proper extensions
#
cd gravatars
file --mime-type *|grep image/jpeg|tr ":" " "|awk '{print $1}'|grep -v "jpg$"|while read i
do
mv $i $i.jpg
done
file --mime-type *|grep image/png|tr ":" " "|awk '{print $1}'|grep -v "png$"|while read i
do
mv $i $i.png
done
cd -
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment