-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshared_aliases.sh
More file actions
81 lines (65 loc) · 1.79 KB
/
Copy pathshared_aliases.sh
File metadata and controls
81 lines (65 loc) · 1.79 KB
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
# shellcheck disable=SC2046 shell=bash
################################### My aliases #################################
alias kill_firefox='\
pkill -f /usr/lib/firefox/firefox && (firefox &> /dev/null &)'
alias ping_test='ping 9.9.9.9'
alias test_hdmi='speaker-test -c 2 -r 48000 -D hw:0,3'
alias grep='grep \
-I \
--color=auto \
--exclude-dir={.git,build,.mypy_cache,.nox,.pytest_cache,.tox} \
--exclude=tags'
alias open_ports='netstat -tulpn | grep LISTEN'
alias used_ports='sudo lsof -i -P -n | grep LISTEN'
alias vless='vim -R -'
alias vi='vim'
alias ..='cd ..'
alias ...='cd ../..'
alias ....='cd ../../..'
alias .....='cd ../../../..'
alias docker_kill_all='docker kill $(docker ps -q)'
if [ -e /usr/bin/batcat ]; then
alias cat='/usr/bin/batcat'
fi
################################ My alias functions ############################
pgrep() {
find "$2" -type f | parallel -k -j150% -n 1000 -m grep -H -n "$1" {}
}
mkcd() {
mkdir "$1" && cd "$1" || exit
}
gpd() {
cd $(bd -s "$1") || exit
}
md2html() {
markdownfile=$1
htmlfile=${markdownfile%".md"}".html"
pandoc \
--from gfm \
--to html \
--standalone "$markdownfile" \
--output "$htmlfile"
}
cless() {
pygmentize -f terminal "$1" | less -R
}
list_dirty_gits() {
local is_git_dirty="git diff --quiet --ignore-submodules --exit-code"
# editorconfig-checker-disable
find ./ \
-type d \
-name '.git' \
-exec sh -c "cd '$1/..' && $is_git_dirty || echo 'Dirty: $1'" shell {} \;
# editorconfig-checker-enable
}
datetime_to_unix() {
date -u -d "${1}" +%s
}
get_gitlab_link_for_commit_id() {
local ref=${1}
local commit_id
commit_id=$(git rev-parse "${ref}")
echo "$(git remote get-url origin \
| sed 's#\.git$##' \
| sed 's#git@#https://#; s#com:#com/#')/-/commit/${commit_id}"
}