-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.aliases
executable file
·115 lines (98 loc) · 2.77 KB
/
.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# shellcheck shell=bash
BREW_BINPATH="$(brew --prefix)/bin"
alias grepir='grep -Ir'
alias ssh='TERM=xterm-256color ssh'
alias mkdirs='mkdir -p'
alias cat="${BREW_BINPATH}/bat"
alias pping="${BREW_BINPATH}/prettyping --nolegend"
alias du='ncdu --color dark -rr -x --exclude .git --exclude node_modules'
alias ptpy='ptipython'
function mkcd {
mkdir -p "$@" && cd "$_"
}
# ls
alias ls='gls'
alias l='ls -AFlh --color=auto'
alias ll='ls -aFlh --color=auto'
function ls_bin {
# show the full path of a callable in $PATH
l "$(which ${1})"
}
alias lb=ls_bin
# env
function es {
if [[ -n "$*" ]]; then
env | sort | rg -i "$*"
else
env | sort
fi
}
# beep - plays a sound
# macOS sound files can be found in:
# /System/Library/PrivateFrameworks/ToneLibrary.framework/Resources/AlertTones
function beep {
if [[ -z "$BEEP_SOUND_FILE" || ! -e "$BEEP_SOUND_FILE" ]]; then
BEEP_SOUND_FILE="/System/Library/PrivateFrameworks/ToneLibrary.framework/Resources/AlertTones/PhotosMemoriesNotification.caf"
fi
( afplay "$BEEP_SOUND_FILE" > /dev/null 2>&1 ) &
}
# Restart the docker-for-mac app
function docker-mac {
function ok_msg {
printf "%s[ok]%s\n" "$(tput setaf 2)" "$(tput sgr0)"
}
function fail_msg {
printf "%s[fail]%s\n" "$(tput setaf 1)" "$(tput sgr0)"
}
function d4m_stop {
printf 'Stopping \t'
osascript -e 'quit app "Docker"' \
&& ok_msg \
|| fail_msg
}
function d4m_start {
printf 'Starting \t'
open -a Docker \
&& ok_msg \
|| fail_msg
}
function d4m_restart {
d4m_stop && \
sleep 1 && \
d4m_start
printf 'Waiting \t'
while [ -z "$(docker info 2> /dev/null )" ]; do
printf '%s.%s' "$(tput setaf 3)" "$(tput sgr0)"
sleep 1
done
printf '\r\033[0K' # clear entire line
printf 'Waiting \t' ; ok_msg
}
if [[ "$1" == "stop" || "$1" == "quit" ]] ; then
d4m_stop
elif [[ "$1" == "start" ]] ; then
d4m_start
elif [[ "$1" == "restart" ]] ; then
d4m_restart
else
echo "docker-mac: start | stop | restart"
false
fi
}
# Git
alias gr='git reset'
alias grh='git reset --hard'
alias gf='git fetch --prune'
alias gfa='git fetch --all --prune'
# fast copying files
alias rcopy='rsync -vhxpogiW --progress --stats --numeric-ids'
# rsync --verbose \
# --human-readable \
# --one-file-system \
# --itemize-changes \
# --progress \
# --stats \
# --rsh "ssh -T -c ${ciphers} -o Compression=no -x" \
# source:/path/to/files /path/to/dest [/path/to/other-dest...]
# lookup remote ssh algos using: nmap --script ssh2-enum-algos -sV -p <port> <host>
alias rcopy-remote='rsync -vhxirP --stats --progress -e "ssh -T -o [email protected],[email protected],aes128-ctr,aes192-ctr,aes256-ctr,* -o Compression=no -x"'