Last active
January 8, 2021 14:16
-
-
Save jjb/e87b40a99ee12e7c1eda15ac35e30023 to your computer and use it in GitHub Desktop.
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/ruby | |
# save in ~/bin/dns and chmod 755 | |
unless ARGV[0] | |
print `networksetup -getdnsservers Wi-Fi` | |
exit | |
end | |
servers = case ARGV[0] | |
when 'adblock' | |
'176.103.130.130 2a00:5a60::ad1:0ff' | |
when 'fast' | |
'1.1.1.1 2606:4700:4700::1111' | |
when 'default' | |
'empty' | |
else | |
raise ArgumentError, <<~DOCS | |
usage: | |
dns [adblock|fast|default] # change dns of Wi-Fi | |
dns # show current Wi-Fi dns settings | |
DOCS | |
end | |
print `networksetup -setdnsservers Wi-Fi #{servers}` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment