I've been having a few wifi drops and then the pi doesn't reconnect until I reboot it manually. This script solves that.
First, add a new sudo cron
sudo crontab -e
Then adapt and paste the following, change the IP to that of your router or something you expect to be always up