2022-12-19 16:11:45 +01:00
|
|
|
# cd into project dir and list files and directories
|
|
|
|
pro() {
|
|
|
|
[ -z "$PROJECTDIR" ] && PROJECTDIR="$HOME/Projects"; [ -z "$TOOL" ] && TOOL=fzf
|
|
|
|
clear; cd "$PROJECTDIR/$($LIST $PROJECTDIR | $TOOL)"
|
|
|
|
clear; $LIST -lah
|
|
|
|
}
|
|
|
|
|
|
|
|
# cd into dotdir and list files and directories
|
2023-01-23 22:20:43 +01:00
|
|
|
cdot() {
|
2022-12-19 16:11:45 +01:00
|
|
|
[ -z "$DOTDIR" ] && DOTDIR="$HOME/.config"; [ -z "$TOOL" ] && TOOL=fzf
|
2023-01-23 22:20:43 +01:00
|
|
|
command -v "$TOOL" > /dev/null || return
|
2022-12-19 16:11:45 +01:00
|
|
|
clear; cd "$DOTDIR/$($LIST -a $PROJECTDIR | $TOOL)"
|
|
|
|
clear; $LIST -lah
|
|
|
|
}
|
|
|
|
|
|
|
|
# list passwords and copy to xclip
|
|
|
|
lspass() {
|
|
|
|
command -v pass > /dev/null || exit 1
|
2023-08-06 17:06:01 +02:00
|
|
|
|
2022-12-19 16:11:45 +01:00
|
|
|
val="$(/bin/ls $HOME/.password-store | sed "s/[.]gpg//g" | grep -v "\-id" | fzf)"
|
2023-08-06 17:06:01 +02:00
|
|
|
|
2022-12-19 16:11:45 +01:00
|
|
|
[ -z "$val" ] && return
|
2023-08-06 17:06:01 +02:00
|
|
|
|
|
|
|
printf "%s" "$val" | grep -q otp && otp="otp" || otp=nootp
|
|
|
|
|
2022-12-19 16:11:45 +01:00
|
|
|
case "$otp" in
|
2023-08-06 17:06:01 +02:00
|
|
|
"otp") pass otp $val | xclip -selection clipboard && printf "Copied OTP code to clipboard\n" || printf "Failed to copy OTP code to clipboard.\n"; return ;;
|
|
|
|
"nootp") pass $val | xclip -selection clipboard && printf "Copied password to clipboard\n" || printf "Failed to copy password to clipboard.\n"; return ;;
|
2022-12-19 16:11:45 +01:00
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
|
|
|
# clear clipboard
|
|
|
|
clearboard() {
|
|
|
|
echo "" | xclip -selection clipboard
|
|
|
|
}
|
|
|
|
|
|
|
|
# ssh into the server
|
|
|
|
ssh_server() {
|
|
|
|
USER="$(head -n 1 ${SERVERDATA})"
|
|
|
|
IP="$(tail -n 1 ${SERVERDATA})"
|
|
|
|
ssh ${USER}@${IP}
|
|
|
|
}
|
2023-01-23 22:20:43 +01:00
|
|
|
|
|
|
|
..() {
|
|
|
|
[ -z "$1" ] && cd .. && return
|
|
|
|
|
|
|
|
for i in $(seq $1); do
|
|
|
|
cd ..
|
|
|
|
done
|
|
|
|
}
|