-
Notifications
You must be signed in to change notification settings - Fork 0
/
readme.md
72 lines (58 loc) · 2.17 KB
/
readme.md
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/bin/bash
SECONDS=0
#Check if running as root and if not elevate
amiroot=$(sudo -n uptime 2>&1| grep -c "load")
if [ "$amiroot" -eq 0 ]
then
printf "Maid Service Require Root Access. Please Enter Your Password.\n"
sudo -v
printf "\n"
fi
#Delete Saved SSIDs For Security
#Be Sure To Set Home And Work SSID for ease of use.
printf "Deleting saved wireless networks.\n"
homessid="AddMe"
workssid="AddMe"
IFS=$'\n'
for ssid in $(networksetup -listpreferredwirelessnetworks en0 | grep -v "Preferred networks on en0:" | grep -v $homessid | grep -v $workssid | sed "s/[\ ]//g")
do
networksetup -removepreferredwirelessnetwork en0 "$ssid" > /dev/null 2>&1
done
#Install Updates.
printf "Installing needed updates.\n"
softwareupdate -i -a > /dev/null 2>&1
#Taking out the trash.
printf "Emptying the trash.\n"
sudo rm -rfv /Volumes/*/.Trashes > /dev/null 2>&1
sudo rm -rfv ~/.Trash > /dev/null 2>&1
#Clean the logs.
printf "Emptying the system log files.\n"
sudo rm -rfv /private/var/log/* > /dev/null 2>&1
sudo rm -rfv /Library/Logs/DiagnosticReports/* > /dev/null 2>&1
printf "Deleting the quicklook files.\n"
sudo rm -rf /private/var/folders/ > /dev/null 2>&1
#Cleaning Up Homebrew.
printf "Cleaning up Homebrew.\n"
brew cleanup --force -s > /dev/null 2>&1
brew cask cleanup > /dev/null 2>&1
rm -rfv /Library/Caches/Homebrew/* > /dev/null 2>&1
brew tap --repair > /dev/null 2>&1
#Cleaning Up Ruby.
printf "Cleanup up Ruby.\n"
gem cleanup > /dev/null 2>&1
#Cleaning Up Docker.
#You May Not Want To Do This.
printf "Removing all Docker containers.\n"
docker rmi -f "$(docker images -q --filter 'dangling=true')" > /dev/null 2>&1
#Purging Memory.
printf "Purging memory.\n"
sudo purge > /dev/null 2>&1
#Removing Known SSH Hosts
printf "Removing known ssh hosts.\n"
sudo rm -f /Users/"$(whoami)"/.ssh/known_hosts > /dev/null 2>&1
#Securly Erasing Data.
printf "Securely erasing free space (This will take a while). \n"
diskutil secureErase freespace 0 "$( df -h / | tail -n 1 | awk '{print $1}')" > /dev/null 2>&1
#Finishing Up.
timed="$((SECONDS / 3600)) Hours $(((SECONDS / 60) % 60)) Minutes $((SECONDS % 60)) seconds"
printf "Maid Service Took %s this time. Dont Forget To Tip!\n" "$timed"