diff --git a/.config/i3/config b/.config/i3/config index c2b99ee..f25ff9c 100644 --- a/.config/i3/config +++ b/.config/i3/config @@ -231,6 +231,9 @@ bindsym $mod+Shift+t [class="^TelegramDesktop$"] scratchpad show bindsym --release Print exec gnome-screenshot -i bindsym --release $mod+Print exec gnome-screenshot -a +# Zoom links in private browser +bindsym $mod+z exec ~/.local/bin/zoom-links + # keyboard layout (de layout without dead keys and switched ESC and CAPS_LOCK) exec setxkbmap own diff --git a/.local/bin/filterHistory b/.local/bin/filterHistory new file mode 100755 index 0000000..afd883d --- /dev/null +++ b/.local/bin/filterHistory @@ -0,0 +1,37 @@ +#!/bin/bash + +[ $# -eq 1 ] || { echo "Specify history file" >&2; exit 1; } +[ "$(stat -c '%a' "$1")" = "600" ] || { echo "File does not look like a history file" >&2; exit 1; } + +declare -a COMMANDS +COMMANDS=('ls' \ + 'll' \ + 'l' \ + ':q' \ + ':Q' \ + 'exit' \ + 'cd' \ + 'cd ~' \ + 'cd .' \ + 'cd ..' \ + 'gs' \ + 'git status' \ + 'gd' \ + 'gpush' \ + 'git pull' \ + 'cmake .. && make' \ + 'exec zsh' \ + 'python3' \ + 'clear' \ +) + +printf '%s\n' "${COMMANDS[@]}" | column +echo "Are you a 100% sure you want to delete these commands from $1? (Type out yes)" +read yn +[ "$yn" = "yes" ] || exit 1 + +for c in "${COMMANDS[@]}"; do + c="$(echo "$c" | sed 's/\./\\./g; s/\//\\\//g')" + sed -Ei '/^: [0-9]+:[0-9]+;'"$c"'$/d' "$1" + echo "$c deleted" +done diff --git a/.local/bin/raw2preview b/.local/bin/raw2preview new file mode 100755 index 0000000..24f3708 --- /dev/null +++ b/.local/bin/raw2preview @@ -0,0 +1,34 @@ +#!/bin/sh + +errorAndExit () { + printf "\033[1;31m$1\033[0m" >&2 + exit $2 +} + +extractRAW () { + if [ -r "$1" ]; then + if [ "$1" != "${1%CR2}" ] && [ ! -f "${1%CR2}JPG" ]; then + exiftool "$1" -PreviewImage -b > "${1%CR2}JPG" + echo "${1%CR2}JPG" + else + printf "\033[1;31mPreview for $1 exists already.\n\033[0m" >&2 + fi + fi +} + +if [ $# -ne 1 ] || [ ! -r "$1" ]; then + errorAndExit "Please specify one readable file.\n" 1 +fi + +if [ "$(file -b --mime-type "$1")" = "image/x-canon-cr2" ]; then + extractRAW "$1" +elif [ "$(head -n 1 "$1")" = "#Geeqie collection" ]; then + while read line; do + if echo "$line" | grep -qv "^#"; then + line="${line#\"}" + extractRAW "${line%\"}" + fi + done < "$1" # <"$(sed -r '/#/d;s/(^"|"$)//g' "$1")" +else + errorAndExit "Please specify either a CR2 or a geeqie collection\n" 1 +fi diff --git a/.local/bin/wifi-mute b/.local/bin/wifi-mute new file mode 100755 index 0000000..5c8e96e --- /dev/null +++ b/.local/bin/wifi-mute @@ -0,0 +1,9 @@ +#!/bin/bash + +## This runs as a crontab every 5minutes ('*/5 * * * * /usr/local/bin/wifi-mute') + +if [[ "$(nmcli -t -f name con show --active)" =~ eduroam* ]]; then # iwgetid -r + # TODO: mute only speaker, not headphones + amixer set Master mute +fi + diff --git a/.local/bin/zoom-links b/.local/bin/zoom-links new file mode 100755 index 0000000..c18c374 --- /dev/null +++ b/.local/bin/zoom-links @@ -0,0 +1,27 @@ +#!/bin/sh + +## Author: druckdev +## Created 2020-06-05 +## +## A script that modifies Zoom links for the use in browsers, opens it then in a private chromium +## window and puts the password into the clipboard. If no argument is given the link is taken out +## of the clipboard. +## The reason behind the choice of Chromium is that my Firefox does weird things when used in +## scripts and that I wanted to run Zoom separately from my normal Firefox instances. +## (although this should be solvable by separate Firefox profiles.) + +# Check if necessary commands exist +command -v chromium-browser >/dev/null 2>&1 || return 1 +command -v xclip >/dev/null 2>&1 || return 1 + +# If no argument is given, set the clipboard as argument +set "$(xclip -selection c -o)" +# Check for right format +echo "$1" | grep -Eq "^https://tu-berlin.Zoom.us/(j|wc/join)/[0-9]*\?pwd=.+" || return 1 + +# Delete password part and convert /j/ to /wc/join/ +link="$(echo "${1%pwd=*}" | sed 's_/j/_/wc/join/_')" +# Open link in private browser +chromium-browser --incognito --new-window "$link" >/dev/null 2>&1 & +# Put password in clipboard +echo -n "${1##*pwd=}" | xclip -selection c