-
Notifications
You must be signed in to change notification settings - Fork 0
/
.bash_aliases
executable file
·71 lines (59 loc) · 2.9 KB
/
.bash_aliases
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
#!/bin/bash
# Easier navigation: .., ..., ...., ....., ~ and -
alias ..="cd .."
alias ...="cd ../.."
alias ....="cd ../../.."
# Recursively delete `.DS_Store` files
alias ds_store_cleanup="find . -type f -name '*.DS_Store' -ls -delete"
# URL-encode strings
alias urlencode='python -c "import sys, urllib as ul; print ul.quote_plus(sys.argv[1]);"'
# some more ls aliases
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'
# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
#alias dir='dir --color=auto'
#alias vdir='vdir --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
fi
function vmware-sign-drivers() {
echo "Failed to load vmmon kernel module - https://kb.vmware.com/s/article/2146460"
mkdir ~/vmnet-fix
cd ~/vmnet-fix
sudo vmware-modconfig --console --install-all
openssl req -new -x509 -newkey rsa:2048 -keyout MOK.priv -outform DER -out MOK.der -nodes -days 36500 -subj "/CN=VMware/"
sudo /usr/src/linux-headers-`uname -r`/scripts/sign-file sha256 ./MOK.priv ./MOK.der $(modinfo -n vmmon)
sudo /usr/src/linux-headers-`uname -r`/scripts/sign-file sha256 ./MOK.priv ./MOK.der $(modinfo -n vmnet)
sudo mokutil --import MOK.der
cd $HOME
echo "Reboot your machine. Follow the instructions to complete the enrollment from the UEFI console."
}
case $OS_NAME in
Darwin)
# Get OS X Software Updates, and update installed Ruby gems, Homebrew, npm, and their installed packages
alias update='sudo softwareupdate -i -a; brew update; brew upgrade; brew cleanup'
# Show/hide hidden files in Finder
alias show_all_files="defaults write com.apple.finder AppleShowAllFiles -bool true && killall Finder"
alias hide_all_files="defaults write com.apple.finder AppleShowAllFiles -bool false && killall Finder"
# Hide/show all desktop icons (useful when presenting)
alias hide_desktop_icon="defaults write com.apple.finder CreateDesktop -bool false && killall Finder"
alias show_desktop_icon="defaults write com.apple.finder CreateDesktop -bool true && killall Finder"
# PlistBuddy alias, because sometimes `defaults` just doesn’t cut it
alias plistbuddy="/usr/libexec/PlistBuddy"
;;
Linux)
if [ -x "$(command -v openfortivpn)" ]; then
alias fiftytwo_vpn="sudo bash -c 'openfortivpn -c $HOME/.fiftytwo_forti_config &'"
fi
# Add an "alert" alias for long running commands. Use like so:
# sleep 10; alert
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
;;
*)
echo "${OS_NAME} is unsupported" >&2;;
esac