-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
wake.sh
executable file
·43 lines (34 loc) · 1.28 KB
/
wake.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/env bash
# you'll need to run this as root to modify the /etc/hosts file
# to test this script using sleepwatcher:
# sudo brew services start sleepwatcher
#
# with verbose logging enabled
# sudo /usr/local/sbin/sleepwatcher --verbose --wakeup .wakeup
#
# You may need to reinstall the sleepwatcher process when upgrading macos:
# brew reinstall sleepwatcher
#
# This process logs to `/var/log/com.apple.xpc.launchd/launchd.log`
# asdf is operating in a different environment, we can't use it directly
# commands to get the node & hostile paths
# - `asdf which node`
# - `asdf which hostile`
source /Users/mike/.asdf/asdf.sh
hostile load /Users/mike/.config/distracting_sites.txt
# https://apple.stackexchange.com/questions/303110/flush-cache-of-dns-on-macos-sierra-high-sierra/303119#303119
sudo dscacheutil -flushcache
sudo killall -HUP mDNSResponder
# Want to check what the system is resolving a host to?
# dscacheutil -q host -a name www.thedomain.com
# safari will often cache DNS, lets clear it to ensure everything is blocked
osascript << EOF
tell application "Safari"
activate
end tell
tell application "System Events"
tell process "Safari"
tell menu bar 1 to tell menu bar item "Develop" to tell menu 1 to tell menu item "Empty Caches" to click
end tell
end tell
EOF