Last active
May 31, 2024 09:05
-
-
Save iworks/9130ca71ef9a7ad6cc5899a3db05889e to your computer and use it in GitHub Desktop.
WordCamp Kraków 2024 get.gravatars.sh
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 characters
#!/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