I have this bug, that at least once a day my MacBooks internet will stop working. Disconnecting from and reconnecting to wifi will usually fix this quickly. Therefore I adjusted this script slightly:
on alfred_script(q)
set wifi to (do shell script "networksetup -listallhardwareports | grep -A 1 Wi-Fi | tail -n 1 | cut -b 9-12")
do shell script "networksetup -setairportpower " & wifi & " off"
do shell script "networksetup -setairportpower " & wifi & " on"
end alfred_script
It will now turn off wifi and instantly turn it back on again. Therefore running this workflow fixes my internet within a couple seconds.