-
Notifications
You must be signed in to change notification settings - Fork 0
/
dot_bash_aliases
71 lines (48 loc) · 2.1 KB
/
dot_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
alias cdp='cd /mnt/c/Users/phuba/Downloads'
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls="ls --color=auto"
alias grep="grep --color=auto"
alias fgrep="fgrep --color=auto"
alias egrep="egrep --color=auto"
fi
alias ll="ls -alF"
alias la="ls -A"
alias l="ls -CF"
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$//'\'')"'
vdiff () {
if [ "${#}" -ne 2 ] ; then
echo "vdiff requires two arguments"
echo " comparing dirs: vdiff dir_a dir_b"
echo " comparing files: vdiff file_a file_b"
return 1
fi
local left="${1}"
local right="${2}"
if [ -d "${left}" ] && [ -d "${right}" ]; then
vim +"DirDiff ${left} ${right}"
else
vim -d "${left}" "${right}"
fi
}
dtags () {
local image="${1}"
wget -q https://registry.hub.docker.com/v1/repositories/"${image}"/tags -O - \
| tr -d '[]" ' | tr '}' '\n' | awk -F: '{print $3}'
}
alias dew="docker-compose exec web"
alias dpsql="docker-compose exec postgres psql"
alias drun='docker run --rm -it -v "${PWD}":/app'
alias rmpyc="find . -type d -name '__pycache__' -exec rm -rf {} \;"
alias jek="RUBYOPT='-W0' bundle exec jekyll serve --config _config.yml,_config.dev.yml --drafts --livereload"
alias ymp3="youtube-dl --extract-audio --audio-format mp3"
alias octal="stat -c '%a %n'"
alias follow="namei -om"
alias diff="diff --color -u"
alias 755d="find . -type d -exec chmod 755 {} \;"
alias 644f="find . -type f -exec chmod 644 {} \;"
alias open="/c/Program\ Files\ \(x86\)/Google/Chrome/Application/chrome.exe"
# This is specific to WSL 2. If the WSL 2 VM goes rogue and decides not to free
# up memory, this command will free your memory after about 20-30 seconds.
# Details: https://github.com/microsoft/WSL/issues/4166#issuecomment-628493643
alias drop_cache="sudo sh -c \"echo 3 >'/proc/sys/vm/drop_caches' && swapoff -a && swapon -a && printf '\n%s\n' 'Ram-cache and Swap Cleared'\""