It depends on networkmanger , If you are using other networking interface , change command accordingly.Change PASSWD string to your password. If you don't mind script asking your password every time it's run remove "sudo - c passwd |" this part.
It provides to change DNS from following services go ahead add more and share too :)
1:Restore To Defaults
1)If you are on Ubuntu based distors , change /etc/rc.d to /etc/init.d
No need to change anything on arch based distros.
2) sudo chmod 777 DNS_changer.sh