2019-10-26 17:05:31 +00:00
|
|
|
# signoff every commit
|
|
|
|
git() {
|
|
|
|
if [[ "$1" == "commit" && $# -eq 1 ]]; then
|
|
|
|
/usr/bin/git commit -S -s
|
|
|
|
else
|
|
|
|
/usr/bin/git $@
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
# git shorthands
|
|
|
|
gc() { git commit $@ }
|
2019-11-06 06:38:28 +00:00
|
|
|
gac() { ga && gc }
|
2019-10-26 17:05:31 +00:00
|
|
|
gpull() { git pull $@ }
|
|
|
|
gpush() { git push $@ }
|
|
|
|
|
|
|
|
# Syntax highlighting cat
|
|
|
|
cat() { nvimpager -c $@ }
|
|
|
|
|
|
|
|
rip() {
|
|
|
|
abcde
|
|
|
|
printf "Ripping done. Importing to library"
|
|
|
|
beet import ~/Documents/Rip/flac/*
|
|
|
|
}
|
|
|
|
|
2020-01-09 20:30:32 +00: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 17:05:31 +00:00
|
|
|
# search and install packages with fzf
|
|
|
|
yi() {
|
|
|
|
SELECTED_PKGS="$(yay -Slq | fzf --header='Install packages' -m --preview 'yay -Si {1}')"
|
|
|
|
if [ -n "$SELECTED_PKGS" ]; then
|
|
|
|
yay -S $(echo $SELECTED_PKGS)
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
# search and remove packages with fzf
|
|
|
|
yr() {
|
|
|
|
SELECTED_PKGS="$(yay -Qsq | fzf --header='Remove packages' -m --preview 'yay -Si {1}')"
|
|
|
|
if [ -n "$SELECTED_PKGS" ]; then
|
|
|
|
yay -Rns $(echo $SELECTED_PKGS)
|
|
|
|
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
|
|
|
|
:q() { 'exit' }
|
|
|
|
:wq() { 'exit' }
|
|
|
|
|
|
|
|
# zbar output only data
|
|
|
|
zbarimg() { /usr/bin/zbarimg -q --raw $@ }
|
|
|
|
zbarcam() { /usr/bin/zbarcam -q --raw $@ }
|
|
|
|
|
|
|
|
# switch to desktop mode
|
|
|
|
dock() { swaymsg output eDP-1 disable }
|
|
|
|
|
|
|
|
# move to trash instead of remove
|
|
|
|
rm() { trash $@ }
|
|
|
|
|
|
|
|
# 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
|
2019-10-29 22:43:03 +00:00
|
|
|
yay -Sc
|
2019-10-26 17:05:31 +00:00
|
|
|
SPACEAFTER=$(eval "$DFCMD")
|
|
|
|
echo "Saved $(calc $SPACEAFTER - $SPACEBEFORE)G of space"
|
|
|
|
}
|
|
|
|
|
|
|
|
# connect to wireguard
|
|
|
|
startvpn() { sudo systemctl start wg-quick@wg0.service }
|
|
|
|
stopvpn() { sudo systemctl stop wg-quick@wg0.service }
|
|
|
|
|
|
|
|
# connect to metropolia vpn
|
|
|
|
metropoliavpn() { sudo openconnect -u markoak --passwd-on-stdin vpn.metropolia.fi }
|
|
|
|
|
|
|
|
# read qrcode from selection
|
|
|
|
qr() { grim -g "$(slurp -d)" - | zbarimg PNG:- }
|
|
|
|
|
|
|
|
# generate qr code in terminal
|
|
|
|
qrencode() { /usr/bin/qrencode -t ansiutf8 $@ }
|
|
|
|
|
|
|
|
# color picker
|
|
|
|
cpick() { grim -g "$(slurp -p)" -t ppm - | convert - -format "%[pixel:p{0,0}]" txt:- }
|
|
|
|
|
|
|
|
# eclim daemon location
|
|
|
|
eclimd() { /usr/lib/eclipse/eclimd }
|
|
|
|
|
|
|
|
#iwctl aliases
|
|
|
|
i() { iwctl station wlan $@ }
|
|
|
|
|
|
|
|
# download firefox customizations
|
|
|
|
ffcustom() { wget "https://gist.githubusercontent.com/Sporif/db6b3440fba0b1bcf5477afacf93f875/raw/2a1be65a12f8f0c88ba84a69697e542ad62d4624/userChrome.css" "https://gist.github.com/mrkwatz/277fb19d210a7539304ca2388f24d8e3/raw/d5b47f4089a3ef29cc719ecb9f3bc0d333ab866a/userChrome.js" "https://gist.github.com/mrkwatz/277fb19d210a7539304ca2388f24d8e3/raw/d5b47f4089a3ef29cc719ecb9f3bc0d333ab866a/userChrome.xml" }
|
|
|
|
|
|
|
|
# change cpu power settings
|
|
|
|
performanceg() { sudo cpupower frequency-set -g performance }
|
|
|
|
powersaveg() { sudo cpupower frequency-set -g powersave }
|
|
|
|
performance() { performanceg && sudo ryzenadj --stapm-limit=45000 --fast-limit=45000 --slow-limit=45000 --tctl-temp=90 }
|
|
|
|
powersave() { powersaveg && sudo ryzenadj --stapm-limit=25000 --fast-limit=25000 --slow-limit=25000 --tctl-temp=55 }
|
|
|
|
ultimatepowersave() { powersave && sudo ryzenadj --stapm-limit=25000 --fast-limit=25000 --slow-limit=25000 --tctl-temp=20; }
|
|
|
|
|
|
|
|
# monitor cpu freq
|
|
|
|
cpufreq() { watch -n 1 eval "cat /proc/cpuinfo |grep MHz" }
|
|
|
|
|
|
|
|
# dotdrop
|
2019-11-02 06:56:41 +00:00
|
|
|
updatesecrets() { bash $DOTREPO/secrets/secrets.sh; chmod 600 $DOTREPO/secrets/secrets }
|
2019-10-26 17:05:31 +00:00
|
|
|
dotdrop() { source $DOTREPO/secrets/secrets && $DOTREPO/dotdrop/dotdrop.sh --cfg=$DOTREPO/config-home.yaml $@ }
|
|
|
|
sdotdrop() { source $DOTREPO/secrets/secrets && sudo -E $DOTREPO/dotdrop/dotdrop.sh --cfg=$DOTREPO/config-root.yaml $@ }
|
|
|
|
dotgit() { git -C $DOTREPO $@ }
|
|
|
|
dotsync() { cd $DOTREPO && gpull && ga && gc && gpush && cd $OLDPWD }
|
|
|
|
|
|
|
|
# sync password manager
|
|
|
|
passync() { pass git pull && pass git push && updatesecrets }
|
|
|
|
|
|
|
|
# update stuff
|
2019-11-03 10:18:58 +00:00
|
|
|
plugupdate() { vim +PlugUpgrade +PlugUpdate +CocUpdate +qa && zplugin update && $HOME/.tmux/plugins/tpm/bin/update_plugins all }
|
2019-11-06 09:42:29 +00:00
|
|
|
dotupdate() {dotgit submodule update && dotsync }
|
2019-10-26 17:05:31 +00:00
|
|
|
update() { yay -Syu firefox-nightly; flatpak update }
|
|
|
|
updateall() { update; plugupdate; dotupdate; passync; sudo awman-update }
|
|
|
|
|
|
|
|
# remove unneeded packages
|
|
|
|
autoremove() { sudo pacman -R $(pacman -Qdtq) }
|
|
|
|
|
|
|
|
# start neomutt instead of mutt
|
|
|
|
mutt() { neomutt $@ }
|
|
|
|
|
|
|
|
# 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
|
|
|
|
reflect() { sudo reflector --latest 200 --threads 8 --verbose --protocol http --protocol https --sort rate --save /etc/pacman.d/mirrorlist }
|
|
|
|
|
|
|
|
# better ls
|
2019-10-30 19:01:26 +00:00
|
|
|
ls() { ls_extended $@ }
|
2019-10-26 17:05:31 +00:00
|
|
|
|
|
|
|
# default icon for notify-send
|
|
|
|
notify-send() { /usr/bin/notify-send --icon=alarm $@ }
|
2019-10-29 22:43:03 +00:00
|
|
|
|
2019-12-12 12:50:06 +00: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 06:32:25 +00:00
|
|
|
|
2019-10-29 22:43:03 +00: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 20:38:53 +00:00
|
|
|
tail() { grc tail $@ }
|
2019-10-29 22:43:03 +00:00
|
|
|
traceroute() { grc traceroute $@ }
|
|
|
|
wdiff() { grc wdiff $@ }
|
|
|
|
blkid() { grc blkid $@ }
|
|
|
|
du() { grc du $@ }
|
|
|
|
dnf() { grc dnf $@ }
|
|
|
|
docker() { grc docker $@ }
|
|
|
|
docke-machine() { grc docker-machine $@ }
|
|
|
|
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 $@ }
|