bin: little expansions

This commit is contained in:
xerus2000 2021-04-07 20:24:41 +02:00
parent d848d61fce
commit 2fe72715d6
3 changed files with 16 additions and 2 deletions

View File

@ -5,6 +5,7 @@ alias -g ___='"$(eval "$(fc -ln -1)" | tail -n 1)"'
alias -g G="| grp"
alias -g X="| xargs"
alias -g X1="| xargs -n 1"
alias -g L="--color=always | less"
fi
alias info='info --vi-keys'
@ -124,7 +125,14 @@ alias lar='last | tac'
alias listen='pactl load-module module-loopback; echo "Press Enter to stop"; read; pactl unload-module module-loopback'
alias browse-safe='sudo systemctl disable --now systemd-resolved && sudo rm -f /etc/resolv.conf && echo "nameserver 185.228.168.10" | sudo tee /etc/resolv.conf && sudo chattr +i /etc/resolv.conf'
alias browse-unsafe='sudo chattr -i /etc/resolv.conf && sudo mv /etc/resolv.conf /etc/resolv.conf.bak && sudo systemctl enable --now systemd-resolved && sleep 100 && browse-safe'
browse-unsafe() {
trap 'echo Browsing safe; browse-safe' INT
sudo chattr -i /etc/resolv.conf &&
sudo mv /etc/resolv.conf /etc/resolv.conf.bak &&
sudo systemctl enable --now systemd-resolved &&
sleep 1
browse-safe
}
xo() {
while test $# -gt 0; do

View File

@ -1,3 +1,9 @@
#!/bin/sh
apikey=$(grep apikey $XDG_CONFIG_HOME/syncthing/config.xml | cut -d '>' -f2 | cut -d '<' -f1)
curl -H 'Content-Type: application/json' -H "X-API-Key: $apikey" "http://localhost:8384/rest/$1" "${@:2}" | bat --style=numbers -l json
# https://docs.syncthing.net/rest/db-browse-get.html
# synct 'db/browse?folder=data&levels=1'
# https://docs.syncthing.net/rest/db-need-get.html
# synct 'db/need?folder=music'

View File

@ -12,5 +12,5 @@ xkbstate="$(dirname $(dirname $0))/xkblayout-state"
test "$($xkbstate print %C)" -gt 1 && $xkbstate set $id
# Swap semicolon and colon - https://unix.stackexchange.com/questions/615799/swap-semicolon-colon-to-p-unexpected-cause-semicolon-colon-affected-by-cpas-lock
# test "$id" = "eu" && xmodmap -e 'keysym semicolon = colon semicolon colon semicolon'
test "$id" = "1" && xmodmap -e 'keysym semicolon = colon semicolon colon semicolon' || setxkbmap de nodeadkeys
test "$id" = "1" && setxkbmap eu && xmodmap -e 'keysym semicolon = colon semicolon colon semicolon' || setxkbmap de nodeadkeys
} 2>&1 | tee -a /tmp/scripts.log