#!/bin/bash alias please='sudo $(history -p \!\!)' alias xobreset='test $(pgrep xob | 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 mount=usermount alias rename=qmv alias unswap='sudo unswap' alias UNSWAP='xdotool key Caps_Lock ; sudo unswap' #alias rm='echo "(using trash-put instead of rm.)" ; trash-put $@' #aptitude shortcuts alias search='aptitude search' alias install='sudo aptitude install' 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 --reflog --pretty=oneline --decorate --graph --shortstat --simplify-by-decoration' alias branch='git branch' alias pull='git pull' alias push='git push' #display preferences eval "`dircolors`" alias ls='ls --color=auto' alias ll='ls -Agh' alias ..='cd .. ; ll' alias ...='cd ../.. ; ll' alias ....='cd ../../.. ; ll' alias ~='cd /home/karsaell' alias lsblk='lsblk -o name,size,type,mountpoint' alias du='du -hxd1' alias sxiv='sxiv -aors d' alias duu='du -hcd1 | sort -h' #current workflow 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 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 ; sleep 1 ; exit' alias py=python3 #mututuelle alias ncmutu='read -s -p "Password: " pass ; nextcloudcmd --user Mututu --password "$pass" /home/karsaell/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://jitsi.hadoly.fr/mutuelle_dispers%C3%A9e' #networks alias hotspot='nmcli radio wifi on ; sleep 1 ; nmcli --fields SSID device wifi | grep -q "wifi_AP" && nmcli connection down karsaell-hotspot || ( 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 -l --sync --output=avail,target 2>/dev/null | grep /$ | tr -d " /" ) -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" fi sudo echo ok. sudo aptitude update sudo aptitude upgrade sudo aptitude clean } function mailexp() { thunderbird -compose \ from=atelier@latelierpaysan.org \ to=commandes@latelierpaysan.org \ subject="Expédition $1 $2" \ body="Palette prête : \n$3 kg ; $4 x $5 x $6 cm" } function leviials() { read -p "user: " USER read -p "password: " PASSWORD folder=$1 domain="cloud.latelierpaysan.org" path='/remote.php/webdav' suffix='' prefix=$path$folder curl -s -X PROPFIND "https://$domain/remote.php/webdav$folder" -u 'USER:PASSWORD' | xmllint --format - | grep href | awk '{$1=$1};1' | cut -c$((${#prefix}+1))- | rev | cut -c$((${#suffix}+1))- | grep . | rev | while read; do echo -e ${REPLY//%/\\x}; done }