-
Notifications
You must be signed in to change notification settings - Fork 0
/
.aliases
98 lines (81 loc) · 2.58 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
# Set Aliases
# --Pertify
alias ls='ls -la --color=auto'
alias grep='grep --color=auto'
alias cat='bat'
# --Efficiency
alias ..='cd ..'
alias ...='cd ../..'
alias mkdir='mkdir -pv'
alias refresh='clear; history -a; source $HOME/.bashrc'
alias ports='ss -tulanp'
alias update='yay -Syyu'
# Safety nets
# --do not delete / or prompt if deleting more than 3 files at a time
alias rm='rm -I --preserve-root'
# --confirmation
alias mv='mv -i'
alias cp='cp -i'
alias ln='ln -i'
# Git
alias gitop='cd `git rev-parse --show-toplevel`'
# Useful misc
function fix-newline() {
sed -i 's/\\n/\'$'\n/g' "$*" # replace all literal \n with a newline
}
alias whois-on-lan='sudo nmap -sP $(ip addr show | grep "wlan0" | grep -E "inet.*brd" | awk "{print $2}" | cut -d "/" -f1 | cut -d "." -f1-3).0/24'
function root-dl { # Copy file from remote server that requires elevated privileges
if [[ $# -ne 3 ]]; then
echo "Usage: root-dl <user@remote> <remote_file> <local_file>"
return 1
fi
local ssh_options=""
if ! ssh -o HostKeyAlgorithms=+ssh-rsa -o BatchMode=yes -o ConnectTimeout=10 "$1" true &>/dev/null; then
ssh_options="-o HostKeyAlgorithms=+ssh-rsa"
fi
ssh -tt $ssh_options "$1" "sudo -S cat '$2'" > "$3"
}
# Media Aliases
alias play951='mpv https://ice64.securenetsystems.net/WAJI?playSessionID=8882F088-FBC7-F008-2C64ACB2C771047E'
alias play1039='mpv https://prod-54-84-80-233.wostreaming.net/adamsradio-wwfwfmaac-ibc1?'
alias play80s='mpv http://streams.80s80s.de/web/mp3-192/streams.80s80s.de/'
alias playnumetal='mpv http://stream.revma.ihrhls.com/zc9483'
function playtube() {
mpv --ytdl-format=bestaudio ytdl://ytsearch10:"$*"
}
# Docker Environments
# -- Vagrant docker
alias vagrant="
mkdir -p ~/.vagrant.d/{boxes,data,tmp}; \
docker run -it --rm \
-e LIBVIRT_DEFAULT_URI \
-v /var/run/libvirt/:/var/run/libvirt/ \
-v ~/.vagrant.d:/.vagrant.d \
-v $(pwd):$(pwd) \
-w $(pwd) \
--network host \
vagrantlibvirt/vagrant-libvirt:latest \
vagrant"
# -- Nixos docker image to emulate Gitlab CI environment
alias ci-env='
clear &&
docker run -it --rm \
--cpus $(nproc) \
-e LIBVIRT_DEFAULT_URI \
-v /var/run/libvirt:/var/run/libvirt \
-v $(readlink -f "${PWD%/*}"):"${PWD%/*}" \
-v "$HOME"/.ci-env:/root \
-w "$PWD" \
--network host \
nixos/nix \
bash'
# -- Centos 7 docker image environment
alias centos7='
docker run -it --rm \
--cpus $(nproc) \
-e LIBVIRT_DEFAULT_URI \
-v $(readlink -f "${PWD%/*}"):"${PWD%/*}" \
-w "$PWD" \
--network host \
centos:7 \
bash'