-
Notifications
You must be signed in to change notification settings - Fork 1
/
aliases
68 lines (54 loc) · 1.99 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
#!/bin/bash
alias vim=nvim
ctor() {
# Copy all ~/Download/*.torrent files to local or remote watch folder
if ! [[ $(find ~/Downloads/ -name '*.torrent' | wc -l) = 0 ]]; then
if [[ -d "/mnt/media/torrents/watch" ]]; then
mv ~/Downloads/*.torrent /mnt/media/torrents/watch
else
rsync -avhP --no-group ~/Downloads/*.torrent derp.cf:/mnt/fatso/media/torrents/watch && rm ~/Downloads/*.torrent
fi
else
echo "No torrent files to copy"
fi
}
# Remove all stopped containers
alias drm='docker rm $(docker ps -a -q)'
alias lower="tr '[:upper:]' '[:lower:]'"
alias upper="tr '[:lower:]' '[:upper:]'"
latest() {
ls -t | head -n ${1:-10}
}
alias whatismyip="curl httpbin.org/ip 2> /dev/null | jq -r .origin"
# Commonly used rsync arguments, good replacement for `scp`
alias rcp="rsync -avhP --no-group"
alias todo='vim ~/todo'
# Get a single pod match the rest of the usual kubectl arguments, eg:
# $ kubectl describe $(singlepod -l app=frontend,env=production)
# Useful since most deployments will specify more than one replica and
# sometimes you just want to describe or see the logs for any one instance.
singlepod() {
kubectl get pods -o=jsonpath='{.items[0].metadata.name}' "${@}"
}
# Generate a valid, random MAC address for KVM virtual machines
kvm_random_mac() {
python3 -c 'from random import randint; import sys; sys.stdout.write(":".join(["{0:02X}".format(x) for x in [0x00, 0x16, 0x3e, randint(0x00, 0x75), randint(0x00, 0xff), randint(0x00, 0xff),]]))'
}
alias mmpv='mpv --ontop --geometry=0%x10%+100%+100%'
alias k=kubectl
complete -F __start_kubectl k
alias ctx=kubectx
# pipe stdin to nvim quickfix buffer
alias qf="nvim -c 'cbuffer | copen | bdelete! 1'"
# Tmux session helper. t <session> will either attach to the named session or start a new named session.
t() {
case $1 in
"")
tmux ls
;;
*)
tmux new-session -s "${1}" || tmux attach -t "${1}"
;;
esac
}
[[ -f ~/workspace/dotfiles/tcomplete.bash ]] && . ~/workspace/dotfiles/tcomplete.bash