-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.aliases
164 lines (123 loc) · 4.79 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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
#############################################################################################
# POSIX-compatible shell agnostic aliases
# (either useful for day-to-day usage or just some cool tricks)
#############################################################################################
alias sudo='sudo '
alias aliases='vim ~/.aliases; source ~/.aliases'
alias bashrc='vim ~/.bashrc'
alias zshrc='vim ~/.zshrc'
alias vimrc='vim ~/.vimrc'
alias xconfig='vim ~/.xmonad/xmonad.hs'
#############################################################################################
## Git
#############################################################################################
alias gap='git add --patch'
alias config='git --git-dir=$HOME/.dotfiles.git/ --work-tree=$HOME'
alias conf='git --git-dir=$HOME/.dotfiles.git/ --work-tree=$HOME'
alias open=xdg-open # macOS has it right
# XFCE4 Terminal already does this with Ctrl+Shift+N
alias x='xfce4-terminal --working-directory="$(pwd)"'
alias razer="xinput set-prop 'pointer:Razer Razer DeathAdder Chroma' 'libinput Accel Speed'"
alias record-small='ffmpeg -video_size 1366x768 -framerate 10 -f x11grab -i :0.0 VIDEO.mp4'
alias record-big='ffmpeg -video_size 1920x1080 -framerate 10 -f x11grab -i :0.0+0,0 test.mp4'
alias cls='tput reset'
# alias ls='ls --color=auto'
# alias ll='ls --color=auto -lF'
alias ls='exa -F'
alias ll='exa -lF --git --header'
alias du='du -h'
alias lesse='less +G -eX'
alias lecat='less -EX +G'
alias df='dfc'
alias dfcr='dfc -c always 2>/dev/null | grep --colo=never /dev/sda7'
alias xclip="xclip -selection clipbooard"
alias pp='ping -c 4 1.1.1.1'
alias cu='nmcli connection up'
##################################################################
## Good to have:
##################################################################
function copy-image-as-base64() {
base64 -w0 "$1" | \
sed 's|^|data:image/png;base64,|' | \
tee >(xclip -selection CLIPBOARD) && \
notify-send \
'Copied "'"$1"'" as base64 to clipboard' \
$'It looks like this:\n'"$(xclip -selection CLIPBOARD -out)"
}
# App specific aliases
# Simplified docker ps that fits in half my screen
alias dps="docker ps --format 'table {{.Names}} {{.Ports}} {{.Status}}'"
# alias webcam='mplayer tv://device=/dev/video01' # least delay?
alias webcam='mpv --demuxer-lavf-format=video4linux2 --demuxer-lavf-o-set=input_format=mjpeg av://v4l2:/dev/video0'
# or 'mpv /dev/video0'
# or 'ffplay /dev/video0'
# or just use guvcview - It features a standalone video window and
# a configuration window to tweak exposure, gain, brightness, etc.
alias wdmycloud='smbclient -N -U tito% //wdmycloud/tito'
# watchexec, fast, with my favourite flags
function we() {
watchexec --clear --shell=bash "$@"
}
# Todo.txt
function t() {
if [[ $# -eq 0 ]]; then
todo.sh ls
seq $COLUMNS | tr -d '[[:digit:]]' | tr '[[:space:]]' '-'
t -h | sed -En 's/^ (\w+)\|?(\w+)?.*/\1\n\2/p' | column
else
todo.sh "$@"
fi
}
alias tm='todo.sh ls @ModEst'
# PDF viewer
alias zathura='zathura --fork'
alias clips='rlwrap clips'
alias impressive='impressive --cache=memory'
# Navigate the filesystem with Ranger instead of boring cd
# Complements well with:
# fasd's "z" command
# launching $TERMINAL from a graphical file manager with a keyboard shortcut
function rr() {
local RANGERDIR=/tmp/.rangerdir
ranger --choosedir=$RANGERDIR $@
cd "$(cat $RANGERDIR)"
rm $RANGERDIR
}
# I have to try broot
function ytv() {
mpv --ytdl-format="bestvideo[height<=?1080]+bestaudio/best" ytdl://ytsearch:"$*"
}
# Lazily load Node Version Manager
function nvm() {
unset -f nvm
source /usr/share/nvm/init-nvm.sh
nvm "$@"
}
# Arch linux specific aliases
alias pacsizes="expac -H M --timefmt='%Y-%m-%d' '%m\t%l\t%-30v%n' | sort -rn | less"
alias yay=paru
alias yolo="paru --noconfirm"
alias pacram="mkdir -p /tmp/pkg && sudo pacman --cachedir /tmp/pkg"
alias pacro='sudo pacman -Rns $(pacman -Qtdq)' # Remove orphan packages
# Flags:
# -R, --remove
## -n, --nosave delete files instead of renaming with a .pacsave extension
## -s, --recursive remove dependencies that are not required by other packages
# -Q, --query
## -t, --unrequired packages not [optionally] required by any installed package
## -d, --deps packages installed as dependencies (-t + -d = orphans)
## -q, --quiet show less information
function pacbins() {
pacman -Ql "$1" | grep /bin/
}
alias bins=pacbins
# Workflow specific aliases
function fcul-fetch() {
# I don't want to keep a VPN connection alive because if I forget to
# disconnect from it before I shutdown systemd hangs for 90 seconds
# and it drives me mad!
nmcli connection up VPN_ciencias
git remote update
nmcli connection down VPN_ciencias
}
# vim: syntax=sh