Pieds-Nus_custom-scripts/.aliases
2026-01-24 18:07:57 +00:00

132 lines
6.5 KiB
Bash

#!/bin/bash
#alias sudo=doas
#alias sudoedit='doas micro'
alias please='sudo $(history -p \!\!)'
#alias mount=usermount
alias rename=qmv
alias unswap='sudo unswap'
#alias rm='echo "(using trash-put instead of rm.)" ; trash-put $@'
#aptitude shortcuts
alias search='aptitude search'
alias install='sudo aptitude install'
#function searchstall() { aptitude search $1 && echo -e "\n\n package was found: installing\nsudo aptitude install $1" && sudo aptitude install $1 }
alias remove='sudo aptitude purge'
alias show='aptitude show'
alias why='aptitude why'
alias isntall='install'
alias dpgk=dpkg
#power management
alias reboot='systemctl reboot'
alias poweroff='systemctl poweroff'
alias suspend='/usr/local/bin/slock & sleep 0.5 ; systemctl suspend' #'su -c "echo mem > /sys/power/state"'
alias hibernate='/usr/local/bin/slock & sleep 0.5 ; systemctl hibernate' #'xset dpms force off ; sudo su -c "echo shutdown > /sys/power/disk && echo disk > /sys/power/state"' #because fuck sytemd.
alias toggle-locker='pgrep xss-lock > /dev/null && ( xset s off ; xset -dpms ; pkill xss-lock ; echo "Locker off.") || ( xset s 305 0 ; xset +dpms ; xss-lock -- /usr/local/bin/slock -m "Demande le mot de passe à Pieds-Nus" & echo "Locker on.")'
#git shit
alias commit='git commit'
alias add='git add'
#alias status='git status'
alias log='git log -n 20 --pretty=oneline --decorate --graph --shortstat'
alias branch='git branch'
alias pull='git pull'
alias push='git push'
#display preferences
eval "`dircolors`"
alias ls='ls --color=auto'
alias ll='ls -Aghv'
alias ..='cd .. ; ll'
alias ...='cd ../.. ; ll'
alias ....='cd ../../.. ; ll'
alias ~='cd $HOME'
alias lsblk='lsblk -o name,size,type,mountpoint'
alias du='du -hxd1'
alias sxiv='sxiv -aors d'
alias duu='du -hcd1 | sort -h'
alias cp='cp -vr'
#current workflow
#Games
alias aiwar='$HOME/Games/AI\ War/start.sh'
alias bfme='lxterminal -e "cd $HOME/Games/BFME ; wine lotrbfme.exe"'
alias camillelachenal='cd $HOME/Music/Camille\ Lachenal/ ; mpv --loop-playlist=inf À*.opus --\{ --start=24 \[Confinement\ \#27\]\ Valse\ tactile\ \(valse\ à\ 11\ temps\).m4a --\}'
alias civ5="cd $HOME/.steam/debian-installation/steamapps/common/Sid\ Meier\'s\ Civilization\ V/ ; ./Civ5XP ; cd -"
#alias factorio='$HOME/Games/factorio_Space-Age/factorio/launcher.sh' #script copied at /usr/local/bin/factorio
alias ftl='$HOME/Games/FTL/start.sh'
alias Gladius="cd '$HOME/.steam/debian-installation/steamapps/common/Warhammer 40000 Gladius - Relics of War/Binaries/Linux-x86_64' ; ./Gladius.bin ; cd -"
alias minecraft='$HOME/.local/share/multimc/MultiMC'
alias northgard='steam steam://rungameid/466560'
alias rimworld='$HOME/.steam/steam/steamapps/common/RimWorld/RimWorldLinux'
alias SongsOfSyx='cd $HOME/Games/Songs\ of\ Syx_V66/ ; java -jar SongsOfSyx.jar ; cd -'
alias swarm='$HOME/Games/Swarm/swarm-Linux'
alias starsector="cd /home/karsaell/Games/StarSector/starsector ; setxkbmap us ; ./starsector.sh ; setxkbmap fr ; cd -"
alias starsector_shuffle="cd /home/karsaell/Games/StarSector/starsector/saves ; cd \$(ls -t | head -n 1 ) ; mv campaign.xml descriptor.xml .. ; mv campaign.xml.bak campaign.xml ; mv descriptor.xml.bak descriptor.xml ; mv ../campaign.xml campaign.xml.bak ; mv ../descriptor.xml descriptor.xml.bak ; ll ; cd -" #Switch the last autosave and latest save to quick-reload
alias stellaris="cd $HOME/.steam/steam/steamapps/common/Stellaris ; setxkbmap us ; ./stellaris ; setxkbmap fr ; cd -"
alias terraformers='$HOME/Games/Terraformers/game/terraformers_first_steps_on_mars.x86_64'
alias vagrus='$HOME/Games/Vagrus/start.sh'
alias voxeltycoon='steam steam://rungameid/732050'
alias x3='$HOME/Games/X3/start.sh'
#Others
alias cse='firefox --new-window --private-window https://mail.ovh.net/roundcube/ ; pass=$(dmenu -P) ; wid=$(xdotool search --sync --onlyvisible --name "Roundcube.*Private") ; until test "${wid}" -a $"{pass}" ; do sleep 0.5 ; done ; xdotool windowactivate --sync "${wid}" ; until test $(xdotool getactivewindow) = "${wid}" ; do sleep 0.5 ; done ; sleep 0.5 ; xdotool type --window "${wid}" --clearmodifiers "delegation-cse@latelierpaysan.org ${pass}" ; xdotool key --window "${wid}" --clearmodifiers Return'
alias pdfrotate='pdfjam --a4paper --no-landscape --angle 90 --outfile rotated.pdf '
alias pdfunlock='read -p "Password: " -s pass ; echo -e "\nFile will be saved to ./unlocked.pdf" ; mutool convert -p "${pass}" -F pdf -o unlocked.pdf '
alias py='python3'
alias wlist='nmcli radio wifi on ; nmcli device wifi list --rescan yes'
alias xobreset='test $(pgrep xob 2>&1 | wc -l) -ne 2 && ( killall xob ; /usr/bin/tail -q -f "/tmp/log/volume" | /usr/local/bin/xob -q -s volume & /usr/bin/tail -q -f "/tmp/log/brightness" | /usr/local/bin/xob -q -s brightness & )'
alias azerty='setxkbmap us'
alias qwerty='setxkbmap fr'
#mututuelle
alias ncmutu='read -s -p "Password: " pass ; nextcloudcmd --user Mututu --password "$pass" $HOME/Documents/Mututuelle https://nuage.jean-cloud.net'
alias mutunion='firefox https://discord.com/app https://lite.framacalc.org/9kcj-mututuelle_mensuel https://nuage.jean-cloud.net/apps/files/ https://mypads2.framapad.org/p/mutuelle-du-shlag-14-10-xg71yj9zs https://meet.evolix.org/mutuelle_spers%C3%A9e'
#networks
alias hotspot='nmcli radio wifi on ; sleep 1 ; nmcli --fields SSID device wifi | grep -q "aaaaaaaa" && ( nmcli connection down karsaell-hotspot ; nmcli radio wifi off ) || ( nmcli radio wifi on ; nmcli connection up karsaell-hotspot; nmcli device wifi show-password ; sleep 1800 ; nmcli connection down karsaell-hotspot ; nmcli radio wifi off )&'
alias android='sudo umount /media/karsaell/android ; sudo rmdir /media/karsaell/android/ ; sudo mkdir /media/karsaell/android/ ; sudo chown karsaell:karsaell /media/karsaell/android/ ; jmtpfs /media/karsaell/android/'
alias httpserver='python3 -m http.server'
#custom combined functions
function mkcd() {
mkdir "$1"
cd "$1"
}
function cl() {
cd "$1"
ll
}
function update() {
if test $(df 2>/dev/null | grep /$ | tr -s " " | cut -d " " -f 4 ) -lt 1000000 ; then
status
echo -e "\n\n############\n\nWarning: less than 1GB free space on /\n\n############\n\n\t Attend to swapfiles:\n\n"
sudo swapctl -i
fi
sudo echo ok.
sudo aptitude update
sudo aptitude upgrade
kernels=$(search "?name(linux-image-[0-9\.]+\-[0-9]+\-[^ ]+)" | grep ^i | grep -o -E "linux-image-[0-9\.]+\-[0-9]+\-[^ ]+" | head -n -2) ; test "$kernels" && echo "
extra kernel packages to remove:
$kernels
" && sudo aptitude purge $kernels
sudo aptitude clean
sudo unswap
echo "powersave" | sudo tee /sys/devices/system/cpu/cpufreq/policy*/scaling_governor
sudo -K
}
alias UPDATE='xdotool key Caps_Lock ; update'