2019-10-26 20:05:31 +03:00
|
|
|
|
# git shorthands
|
2020-01-13 11:03:59 +02:00
|
|
|
|
alias gc='git commit'
|
|
|
|
|
alias gac='ga && gc'
|
|
|
|
|
alias gpull='git pull'
|
|
|
|
|
alias gpush='git push'
|
2019-10-26 20:05:31 +03:00
|
|
|
|
|
2020-11-25 10:06:19 +02:00
|
|
|
|
alias mutt='neomutt'
|
2020-07-11 14:15:50 +03:00
|
|
|
|
|
2020-04-27 12:16:02 +03:00
|
|
|
|
# Syntax highlighting cat if output is a terminal
|
|
|
|
|
cat() {
|
|
|
|
|
# Check if output is a terminal, else use regular cat
|
|
|
|
|
if [ -t 1 ]; then
|
2020-09-18 23:26:58 +03:00
|
|
|
|
nvimpager $@
|
2020-04-27 12:16:02 +03:00
|
|
|
|
else
|
|
|
|
|
/usr/bin/cat $@
|
|
|
|
|
fi
|
|
|
|
|
}
|
2019-10-26 20:05:31 +03:00
|
|
|
|
|
|
|
|
|
rip() {
|
|
|
|
|
abcde
|
|
|
|
|
printf "Ripping done. Importing to library"
|
|
|
|
|
beet import ~/Documents/Rip/flac/*
|
|
|
|
|
}
|
|
|
|
|
|
2020-01-09 22:30:32 +02:00
|
|
|
|
# make fzf zsh plugin use ripgrep
|
|
|
|
|
_fzf_compgen_dir() {
|
|
|
|
|
rg --hidden --files --null --sort path "$1" 2>/dev/null | xargs -0 dirname | uniq
|
|
|
|
|
}
|
|
|
|
|
_fzf_compgen_path() {
|
|
|
|
|
rg --files --hidden "$1" 2>/dev/null
|
|
|
|
|
}
|
|
|
|
|
|
2019-10-26 20:05:31 +03:00
|
|
|
|
# search and install packages with fzf
|
2020-11-20 00:23:02 +02:00
|
|
|
|
pi() {
|
|
|
|
|
SELECTED_PKGS="$(paru -Slq | fzf --header='Install packages' -m --preview 'paru -Si {1}')"
|
2019-10-26 20:05:31 +03:00
|
|
|
|
if [ -n "$SELECTED_PKGS" ]; then
|
2020-11-20 00:23:02 +02:00
|
|
|
|
paru -S $(echo $SELECTED_PKGS)
|
2019-10-26 20:05:31 +03:00
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# search and remove packages with fzf
|
2020-11-20 00:23:02 +02:00
|
|
|
|
pr() {
|
|
|
|
|
SELECTED_PKGS="$(paru -Qsq | fzf --header='Remove packages' -m --preview 'paru -Si {1}')"
|
2019-10-26 20:05:31 +03:00
|
|
|
|
if [ -n "$SELECTED_PKGS" ]; then
|
2020-11-20 00:23:02 +02:00
|
|
|
|
paru -Rns $(echo $SELECTED_PKGS)
|
2019-10-26 20:05:31 +03:00
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# find and open man pages with fzf
|
|
|
|
|
fman() {
|
|
|
|
|
man -k . | fzf --prompt='Man> ' | awk '{print $1}' | xargs -r man
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# I'm retarded so I need this
|
2020-01-13 11:03:59 +02:00
|
|
|
|
alias :q='exit'
|
|
|
|
|
alias :wq='exit'
|
2019-10-26 20:05:31 +03:00
|
|
|
|
|
2020-03-30 18:21:00 +03:00
|
|
|
|
alias reboot-kodi='systemctl reboot --boot-loader-entry=kodi.conf'
|
|
|
|
|
|
2019-10-26 20:05:31 +03:00
|
|
|
|
# zbar output only data
|
2020-01-13 11:03:59 +02:00
|
|
|
|
alias zbarimg='zbarimg -q --raw'
|
|
|
|
|
alias zbarcam='zbarcam -q --raw'
|
2020-01-12 15:37:15 +02:00
|
|
|
|
|
2020-04-18 13:41:00 +03:00
|
|
|
|
# shorten systemctl and journalctl
|
|
|
|
|
alias sc='systemctl'
|
2020-01-13 11:03:59 +02:00
|
|
|
|
alias scu='systemctl --user'
|
2020-04-18 13:41:00 +03:00
|
|
|
|
alias jc='journalctl'
|
|
|
|
|
alias jcu='journalctl --user'
|
2019-10-26 20:05:31 +03:00
|
|
|
|
|
|
|
|
|
# switch to desktop mode
|
2020-01-13 11:03:59 +02:00
|
|
|
|
alias dock='swaymsg output eDP-1 disable'
|
2019-10-26 20:05:31 +03:00
|
|
|
|
|
|
|
|
|
# move to trash instead of remove
|
2020-01-13 11:03:59 +02:00
|
|
|
|
alias rm='trash'
|
2019-10-26 20:05:31 +03:00
|
|
|
|
|
|
|
|
|
# clean stuff
|
|
|
|
|
clean() {
|
|
|
|
|
DFCMD="df -h / | tail -n 1 | cut -d' ' -f8- | cut -d' ' -f1 | sed 's/[^0-9]*//g'"
|
|
|
|
|
SPACEBEFORE=$(eval "$DFCMD")
|
|
|
|
|
trash-empty 10
|
|
|
|
|
sudo journalctl --vacuum-size=500M
|
2020-11-20 00:23:02 +02:00
|
|
|
|
paru -Sc
|
2019-10-26 20:05:31 +03:00
|
|
|
|
SPACEAFTER=$(eval "$DFCMD")
|
|
|
|
|
echo "Saved $(calc $SPACEAFTER - $SPACEBEFORE)G of space"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# connect to wireguard
|
2020-01-13 11:03:59 +02:00
|
|
|
|
alias startvpn='sudo systemctl start wg-quick@wg0.service'
|
|
|
|
|
alias stopvpn='sudo systemctl stop wg-quick@wg0.service'
|
2019-10-26 20:05:31 +03:00
|
|
|
|
|
|
|
|
|
# connect to metropolia vpn
|
2020-01-13 11:03:59 +02:00
|
|
|
|
alias metropoliavpn='sudo openconnect -u markoak --passwd-on-stdin vpn.metropolia.fi'
|
2019-10-26 20:05:31 +03:00
|
|
|
|
|
|
|
|
|
# read qrcode from selection
|
|
|
|
|
qr() { grim -g "$(slurp -d)" - | zbarimg PNG:- }
|
|
|
|
|
|
|
|
|
|
# generate qr code in terminal
|
2020-01-13 11:03:59 +02:00
|
|
|
|
alias qrencode='qrencode -t ansiutf8'
|
2019-10-26 20:05:31 +03:00
|
|
|
|
|
|
|
|
|
# color picker
|
|
|
|
|
cpick() { grim -g "$(slurp -p)" -t ppm - | convert - -format "%[pixel:p{0,0}]" txt:- }
|
|
|
|
|
|
|
|
|
|
#iwctl aliases
|
2020-01-13 11:03:59 +02:00
|
|
|
|
alias i='iwctl station wlan0'
|
2019-10-26 20:05:31 +03:00
|
|
|
|
|
|
|
|
|
# change cpu power settings
|
2020-04-13 13:24:20 +03:00
|
|
|
|
gpulow() {
|
2020-01-14 15:11:11 +02:00
|
|
|
|
echo low | sudo tee /sys/class/drm/card0/device/power_dpm_force_performance_level
|
|
|
|
|
}
|
2020-04-13 13:24:20 +03:00
|
|
|
|
gpuauto() {
|
2020-01-14 15:11:11 +02:00
|
|
|
|
echo auto | sudo tee /sys/class/drm/card0/device/power_dpm_force_performance_level
|
|
|
|
|
}
|
2019-10-26 20:05:31 +03:00
|
|
|
|
|
|
|
|
|
# monitor cpu freq
|
2020-01-13 11:03:59 +02:00
|
|
|
|
cpufreq() { watch -n 1 eval "cat /proc/cpuinfo | grep MHz" }
|
2019-10-26 20:05:31 +03:00
|
|
|
|
|
|
|
|
|
# dotdrop
|
2019-11-02 08:56:41 +02:00
|
|
|
|
updatesecrets() { bash $DOTREPO/secrets/secrets.sh; chmod 600 $DOTREPO/secrets/secrets }
|
2020-11-21 17:41:44 +02:00
|
|
|
|
dotdrop() { source $DOTREPO/secrets/secrets && $DOTREPO/dotdrop.sh $@ }
|
2020-11-21 15:37:58 +02:00
|
|
|
|
sdotdrop() { source $DOTREPO/secrets/secrets && sudo -E $DOTREPO/dotdrop.sh --cfg=$DOTREPO/config-root.yaml $@ }
|
2020-01-13 11:03:59 +02:00
|
|
|
|
compdef _dotdrop-completion.zsh sdotdrop
|
|
|
|
|
alias dotgit='git -C $DOTREPO'
|
2019-10-26 20:05:31 +03:00
|
|
|
|
dotsync() { cd $DOTREPO && gpull && ga && gc && gpush && cd $OLDPWD }
|
|
|
|
|
|
2020-04-14 14:03:21 +03:00
|
|
|
|
|
2019-10-26 20:05:31 +03:00
|
|
|
|
# sync password manager
|
|
|
|
|
passync() { pass git pull && pass git push && updatesecrets }
|
|
|
|
|
|
2020-04-14 14:38:51 +03:00
|
|
|
|
update() {
|
|
|
|
|
all() {
|
2020-12-25 11:11:53 +02:00
|
|
|
|
paru
|
2020-04-14 14:38:51 +03:00
|
|
|
|
plugins
|
|
|
|
|
{%@@ if profile == "Moria" @@%}
|
2020-12-25 10:59:03 +02:00
|
|
|
|
repo
|
2020-04-15 13:09:11 +03:00
|
|
|
|
docker-update
|
2020-05-31 13:12:44 +03:00
|
|
|
|
docker system prune --volumes
|
2020-04-14 14:38:51 +03:00
|
|
|
|
{%@@ endif @@%}
|
2020-12-25 11:11:53 +02:00
|
|
|
|
sudo flatpak update
|
2020-04-14 14:38:51 +03:00
|
|
|
|
sudo awman-update
|
|
|
|
|
}
|
|
|
|
|
|
2020-12-25 10:59:03 +02:00
|
|
|
|
repo() {
|
2021-01-16 12:07:38 +02:00
|
|
|
|
aur sync -Su --margs --noconfirm
|
2021-01-19 18:40:44 +02:00
|
|
|
|
firefox
|
2021-01-16 12:07:38 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
firefox() {
|
2021-01-16 12:10:24 +02:00
|
|
|
|
aur sync -S --rebuild firefox-nightly --margs --noconfirm
|
2020-04-14 14:38:51 +03:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
plugins() {
|
|
|
|
|
vim +PlugUpgrade +PlugUpdate +CocUpdate +qa
|
|
|
|
|
zinit self-update
|
|
|
|
|
zinit update -p
|
|
|
|
|
$HOME/.tmux/plugins/tpm/bin/update_plugins all
|
|
|
|
|
}
|
|
|
|
|
|
2020-04-15 13:09:11 +03:00
|
|
|
|
docker-update() {
|
2020-11-21 15:37:58 +02:00
|
|
|
|
for dir in $HOME/git/dotfiles/docker/*; do
|
2020-04-14 14:38:51 +03:00
|
|
|
|
cd $dir
|
|
|
|
|
docker-compose pull
|
|
|
|
|
docker-compose up -d
|
|
|
|
|
cd ..
|
|
|
|
|
done
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if [ $# -eq 0 ]; then
|
|
|
|
|
1=base
|
|
|
|
|
fi
|
2020-04-14 14:03:21 +03:00
|
|
|
|
|
2020-04-14 14:38:51 +03:00
|
|
|
|
case "$1" in
|
|
|
|
|
all)
|
|
|
|
|
all
|
|
|
|
|
;;
|
|
|
|
|
plugins)
|
|
|
|
|
plugins
|
|
|
|
|
;;
|
|
|
|
|
docker)
|
2020-04-15 13:09:11 +03:00
|
|
|
|
docker-update
|
2020-04-14 14:38:51 +03:00
|
|
|
|
;;
|
2020-12-25 11:11:53 +02:00
|
|
|
|
repo)
|
|
|
|
|
repo
|
|
|
|
|
;;
|
2021-01-16 12:13:33 +02:00
|
|
|
|
firefox)
|
|
|
|
|
firefox
|
|
|
|
|
;;
|
2020-04-14 14:38:51 +03:00
|
|
|
|
*)
|
2020-12-25 10:59:03 +02:00
|
|
|
|
paru
|
2020-04-14 14:38:51 +03:00
|
|
|
|
;;
|
|
|
|
|
esac
|
2020-04-14 14:03:21 +03:00
|
|
|
|
}
|
2019-10-26 20:05:31 +03:00
|
|
|
|
|
|
|
|
|
# remove unneeded packages
|
2020-03-24 10:43:19 +02:00
|
|
|
|
autoremove() { sudo pacman -Rns $(pacman -Qdtq) }
|
2019-10-26 20:05:31 +03:00
|
|
|
|
|
|
|
|
|
# turn on usb tethering on my android phone
|
|
|
|
|
tether() { adb shell su -c "service call connectivity 33 i32 1 s16 me" > /dev/null }
|
|
|
|
|
|
|
|
|
|
# update arch mirrorlist
|
2020-01-13 11:03:59 +02:00
|
|
|
|
alias reflect='sudo reflector --latest 200 --threads 8 --verbose --protocol http --protocol https --sort rate --save /etc/pacman.d/mirrorlist'
|
2019-10-26 20:05:31 +03:00
|
|
|
|
|
|
|
|
|
# better ls
|
2020-04-17 10:36:41 +03:00
|
|
|
|
alias ls='ls_extended -Ih'
|
2019-10-26 20:05:31 +03:00
|
|
|
|
|
|
|
|
|
# default icon for notify-send
|
2020-01-13 11:03:59 +02:00
|
|
|
|
alias notify-send='notify-send --icon=alarm'
|
2019-10-30 00:43:03 +02:00
|
|
|
|
|
2020-03-03 16:54:32 +02:00
|
|
|
|
# download archiso
|
|
|
|
|
alias archiso='curl "http://mirror.rackspace.com/archlinux/iso/$(date +%Y.%m).01/archlinux-$(date +%Y.%m).01-x86_64.iso"'
|
|
|
|
|
|
2020-12-20 15:34:07 +02:00
|
|
|
|
# Update repository
|
|
|
|
|
|
2019-12-12 14:50:06 +02:00
|
|
|
|
|
|
|
|
|
# encrypted tar's with zstd compression
|
|
|
|
|
cgpgtar() { tar cf - --zstd $1 | gpg -e -z 0 > $1.tar.zst.gpg }
|
|
|
|
|
xgpgtar() { gpg -d $1 | tar x --zstd }
|
2019-11-11 08:32:25 +02:00
|
|
|
|
|
2019-10-30 00:43:03 +02:00
|
|
|
|
# colorise output
|
|
|
|
|
cvs() { grc cvs $@ }
|
|
|
|
|
df() { grc df $@ }
|
|
|
|
|
digg() { grc digg $@ }
|
|
|
|
|
gcc() { grc gcc $@ }
|
|
|
|
|
g++() { grc g++ $@ }
|
|
|
|
|
ifconfig() { grc ifconfig $@ }
|
|
|
|
|
make() { grc make $@ }
|
|
|
|
|
mount() { grc mount $@ }
|
|
|
|
|
mtr() { grc mtr $@ }
|
|
|
|
|
netstat() { grc mount $@ }
|
|
|
|
|
ping() { grc ping $@ }
|
|
|
|
|
ps() { grc ps $@ }
|
2019-10-30 22:38:53 +02:00
|
|
|
|
tail() { grc tail $@ }
|
2019-10-30 00:43:03 +02:00
|
|
|
|
traceroute() { grc traceroute $@ }
|
|
|
|
|
wdiff() { grc wdiff $@ }
|
|
|
|
|
blkid() { grc blkid $@ }
|
|
|
|
|
du() { grc du $@ }
|
|
|
|
|
dnf() { grc dnf $@ }
|
|
|
|
|
docker() { grc docker $@ }
|
2020-02-29 13:44:39 +02:00
|
|
|
|
docker-machine() { grc docker-machine $@ }
|
2019-10-30 00:43:03 +02:00
|
|
|
|
env() { grc env $@ }
|
|
|
|
|
id() { grc id $@ }
|
|
|
|
|
ip() { grc ip $@ }
|
|
|
|
|
iostat() { grc iostat $@ }
|
|
|
|
|
last() { grc last $@ }
|
|
|
|
|
lsattr() { grc lsattr $@ }
|
|
|
|
|
lsblk() { grc lsblk $@ }
|
|
|
|
|
lspci() { grc lspci $@ }
|
|
|
|
|
lsmod() { grc lsmod $@ }
|
|
|
|
|
lsof() { grc lsof $@ }
|
|
|
|
|
getfacl() { grc getfacl $@ }
|
|
|
|
|
getsebool() { grc getsebool $@ }
|
|
|
|
|
ulimit() { grc ulimit $@ }
|
|
|
|
|
uptime() { grc uptime $@ }
|
|
|
|
|
nmap() { grc nmap $@ }
|
|
|
|
|
fdisk() { grc fdisk $@ }
|
|
|
|
|
findmnt() { grc findmnt $@ }
|
|
|
|
|
free() { grc free $@ }
|
|
|
|
|
semanage() { grc semanage $@ }
|
|
|
|
|
sar() { grc sar $@ }
|
|
|
|
|
ss() { grc ss $@ }
|
|
|
|
|
sysctl() { grc sysctl $@ }
|
|
|
|
|
systemctl() { grc systemctl $@ }
|
|
|
|
|
stat() { grc stat $@ }
|
|
|
|
|
showmount() { grc showmount $@ }
|
|
|
|
|
tune2fs() { grc tune2fs $@ }
|
|
|
|
|
tcpdum() { grc tcpdum $@ }
|
2020-04-27 13:22:08 +03:00
|
|
|
|
|
|
|
|
|
btw, () {
|
|
|
|
|
echo " I use"
|
|
|
|
|
echo "[38;2;23;147;209m ▄
|
|
|
|
|
▟█▙
|
|
|
|
|
▟███▙
|
|
|
|
|
▟█████▙
|
|
|
|
|
▟███████▙
|
|
|
|
|
▂▔▀▜██████▙
|
|
|
|
|
▟██▅▂▝▜█████▙
|
|
|
|
|
▟█████████████▙
|
|
|
|
|
▟███████████████▙
|
|
|
|
|
▟█████████████████▙
|
|
|
|
|
▟███████████████████▙
|
|
|
|
|
▟█████████▛▀▀▜████████▙
|
|
|
|
|
▟████████▛ ▜███████▙
|
|
|
|
|
▟█████████ ████████▙
|
|
|
|
|
▟██████████ █████▆▅▄▃▂
|
|
|
|
|
▟██████████▛ ▜█████████▙
|
|
|
|
|
▟██████▀▀▀ ▀▀██████▙
|
|
|
|
|
▟███▀▘ ▝▀███▙
|
|
|
|
|
▟▛▀ ▀▜▙"
|
|
|
|
|
}
|