From 197a1a74f468d9d69d624b19f90280a3946455e5 Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Tue, 16 Apr 2024 10:04:31 +0200 Subject: update --- config/essentials/shell/functions.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'config/essentials/shell') diff --git a/config/essentials/shell/functions.sh b/config/essentials/shell/functions.sh index ce02490..fa32446 100644 --- a/config/essentials/shell/functions.sh +++ b/config/essentials/shell/functions.sh @@ -68,7 +68,10 @@ sms() { ssh -t phone sendmsg "$1" "'$2'"; } trcp() { scp "$1" db:/media/basilisk/downloads/transmission/torrents/; } rln() { ln -s "$(readlink -f "$1")" "$2"; } getgit() { git clone git@db:"$1"; } + esc() { eval "$EDITOR '$(which $1)'"; } +compdef esc="which" + delfile() { curl "${2:-https://upfast.cronyakatsuki.xyz/delete/$1}"; } upfile() { curl -F "file=@\"$1\"" "${2:-https://0x0.st}"; } to_webm() { ffmpeg -y -i "$1" -vcodec libvpx -cpu-used -12 -deadline realtime "${1%.*}".webm; } @@ -292,3 +295,10 @@ edit_in_dir() { [ -f "$file" ] || return 1 $EDITOR "$file" } + +wgtoggle() { + d="${1:-wg0}" + ip -br a | awk '{print $1}' | grep "$d" > /dev/null && + doas wg-quick down "$d" || + doas wg-quick up "$d" + } -- cgit v1.2.3 From cb06bb626545a35f56f55f2abe3942262f5ca824 Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Mon, 29 Apr 2024 14:02:17 +0200 Subject: add serve function --- config/essentials/shell/functions.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'config/essentials/shell') diff --git a/config/essentials/shell/functions.sh b/config/essentials/shell/functions.sh index f8b764a..3078f46 100644 --- a/config/essentials/shell/functions.sh +++ b/config/essentials/shell/functions.sh @@ -301,4 +301,11 @@ wgtoggle() { ip -br a | awk '{print $1}' | grep "$d" > /dev/null && doas wg-quick down "$d" || doas wg-quick up "$d" - } +} + +serve() { + docker container run \ + --rm \ + --volume "$(readlink -f "$1")":/data \ + --publish 80:5000 sigoden/dufs:latest /data --allow-all +} -- cgit v1.2.3 From 179582b4187f5cc9ab784d8ec20b42db4bf12281 Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Mon, 29 Apr 2024 20:45:38 +0200 Subject: Add gdown function --- config/essentials/shell/functions.sh | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'config/essentials/shell') diff --git a/config/essentials/shell/functions.sh b/config/essentials/shell/functions.sh index 250d049..17bf8c4 100644 --- a/config/essentials/shell/functions.sh +++ b/config/essentials/shell/functions.sh @@ -292,3 +292,11 @@ edit_in_dir() { [ -f "$file" ] || return 1 $EDITOR "$file" } + +# Download a file from google drive +# link like this: https://drive.usercontent.google.com/download?id=1TiJDEftTtF1KTMBI950Bj487ndYqkwpQ&export=download +gdown () { + agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/12$(head /dev/urandom | tr -dc '0-1' | cut -c1).0.0.0 Safari/537.36" + uuid=$(curl -sL "$1" -A "$agent" | sed -nE 's|.*(uuid=[^"]*)".*|\1|p') + aria2c -x16 -s16 "$1&confirm=t&$uuid" -U "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36" --summary-interval=0 -d "${2:-.}" +} -- cgit v1.2.3 From 4cf668d9a23e39fbc8a215cc7876f95291722366 Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Thu, 2 May 2024 22:33:24 +0200 Subject: Add sshids alias and ssh_keyadd function --- config/essentials/shell/aliases.sh | 2 ++ config/essentials/shell/functions.sh | 2 ++ 2 files changed, 4 insertions(+) (limited to 'config/essentials/shell') diff --git a/config/essentials/shell/aliases.sh b/config/essentials/shell/aliases.sh index 68b66f2..d5f3e7f 100644 --- a/config/essentials/shell/aliases.sh +++ b/config/essentials/shell/aliases.sh @@ -3,6 +3,7 @@ # The most important one alias vi='nvim' +alias cd='z' # Zsh specific aliases if [ $SHELL = "/bin/zsh" ] @@ -149,6 +150,7 @@ alias wd='dict' # ssh alias sha='ssh-add' alias sshs='eval "$(ssh-agent)" && ssh-add' +alias sshids='ssh-add -L | xargs -I{} grep "{}" -l $(find "$HOME/.ssh" -type f -iname '\''*.pub'\'') | sed "s;$HOME/.ssh/;;;s;\.pub$;;"' alias whatsmyip='curl -s "ifconfig.co"' alias icognito='unset HISTFILE' alias webcam='v4l2-ctl --set-fmt-video=width=1280,height=720; mpv --demuxer-lavf-format=video4linux2 --demuxer-lavf-o-set=input_format=mjpeg av://v4l2:/dev/video0 --profile=low-latency --untimed --no-resume-playback' diff --git a/config/essentials/shell/functions.sh b/config/essentials/shell/functions.sh index 99d854e..8172c73 100644 --- a/config/essentials/shell/functions.sh +++ b/config/essentials/shell/functions.sh @@ -330,3 +330,5 @@ serve() { --publish 80:5000 sigoden/dufs /data --allow-upload fi } + +ssh_keyadd() { ssh-keygen -f "$HOME"/.ssh/"$1" -P "$(pass generate -f keys/"$HOST"/ssh/"$1" | tail -n 1)" -t ed25519; } -- cgit v1.2.3 From 80462e764abf047544be6026c5d67c1f54599ae5 Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Fri, 3 May 2024 18:22:38 +0200 Subject: Update --- bin/extra/aivpn | 18 ++++++++++-------- config/essentials/shell/aliases.sh | 1 + config/essentials/shell/functions.sh | 11 +++++++++++ config/essentials/starship.toml | 4 +--- config/essentials/zsh/.zshrc | 7 +++++++ 5 files changed, 30 insertions(+), 11 deletions(-) (limited to 'config/essentials/shell') diff --git a/bin/extra/aivpn b/bin/extra/aivpn index 6fa0783..21436ed 100755 --- a/bin/extra/aivpn +++ b/bin/extra/aivpn @@ -1,6 +1,6 @@ #!/bin/sh -logn() { printf "%s\n" "$@"; } +err() { printf "%s\n" "$@"; } if [ "$1" = "-k" ] then @@ -8,23 +8,25 @@ then exit fi -keyadd ehb/ai +err "I: Waiting for connectivity..." +while ! ssh -o ConnectTimeout=1 -o BatchMode=yes vm 2>&1 | grep "Permission denied" > /dev/null +do sleep 1 +done + export SSH_ASKPASS="sshpass" export SSH_ASKPASS_REQUIRE="prefer" export PASSWORD="zot/qemu" -logn "I: Waiting for connectivity..." -while ! ssh -o ConnectTimeout=1 -o BatchMode=yes vm 2>&1 | grep "Permission denied" > /dev/null -do sleep 1 -done - -logn "I: Activating vpn" +err "I: Activating vpn" ssh vm "rasdial \"vpn.student.ehb.be\"" + +keyadd ehb/ai ssh -f -N \ -L 2222:10.2.160.41:22 \ vm +keyadd ehb/vm_int ssh -f -N \ -L 2223:10.2.160.9:22 \ vm diff --git a/config/essentials/shell/aliases.sh b/config/essentials/shell/aliases.sh index d5f3e7f..6305a90 100644 --- a/config/essentials/shell/aliases.sh +++ b/config/essentials/shell/aliases.sh @@ -333,3 +333,4 @@ alias update-mirrors='reflector -p https | rankmirrors -n 10 -p -w - | doas tee alias tmpd='cd $(mktemp -d)' alias brs='$BROWSER' + diff --git a/config/essentials/shell/functions.sh b/config/essentials/shell/functions.sh index 8172c73..1fd6e92 100644 --- a/config/essentials/shell/functions.sh +++ b/config/essentials/shell/functions.sh @@ -332,3 +332,14 @@ serve() { } ssh_keyadd() { ssh-keygen -f "$HOME"/.ssh/"$1" -P "$(pass generate -f keys/"$HOST"/ssh/"$1" | tail -n 1)" -t ed25519; } + + +fchange() +{ + [ "$1" ] || return 1 + inotifywait -m -e create,modify,delete --format "%f" "${2:-.}" | + while read -r EVENT + do + eval "$1" + done +} diff --git a/config/essentials/starship.toml b/config/essentials/starship.toml index cd5832f..15139f5 100644 --- a/config/essentials/starship.toml +++ b/config/essentials/starship.toml @@ -34,8 +34,6 @@ disabled = false [custom.upds] command = 'cat ~/.cache/updates' # shows output of command -# detect_files = ['foo'] # can specify filters but wildcards are not supported -when = ''' test "$(cat ~/.cache/updates)" -gt 0''' +when = '[ "$(cat ~/.cache/updates)" -gt 0 ]' symbol = '📦' format = '$output$symbol ' - diff --git a/config/essentials/zsh/.zshrc b/config/essentials/zsh/.zshrc index c9bf8b1..ab66fcb 100644 --- a/config/essentials/zsh/.zshrc +++ b/config/essentials/zsh/.zshrc @@ -110,6 +110,13 @@ bindkey -M menuselect '^xh' accept-and-hold # Hold bindkey -M menuselect '^xn' accept-and-infer-next-history # Next bindkey -M menuselect '^xu' undo # Undo +space-expand-alias() { + zle _expand_alias + zle self-insert +} +zle -N space-expand-alias +bindkey -M main ' ' space-expand-alias + ## window title hooks add-zsh-hook -Uz preexec () { print -n "\e]0;$1\a\033[0m"; } add-zsh-hook -Uz precmd set_wt (){ print -Pn "\e]0;%n@%m on %~\a"; } -- cgit v1.2.3 From d1fd4c1c04b9fefcdaa21d18b0262c2a700847a9 Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Sat, 4 May 2024 09:17:46 +0200 Subject: add bat alias --- config/essentials/shell/aliases.sh | 2 ++ 1 file changed, 2 insertions(+) (limited to 'config/essentials/shell') diff --git a/config/essentials/shell/aliases.sh b/config/essentials/shell/aliases.sh index 68b66f2..50238cc 100644 --- a/config/essentials/shell/aliases.sh +++ b/config/essentials/shell/aliases.sh @@ -331,3 +331,5 @@ alias update-mirrors='reflector -p https | rankmirrors -n 10 -p -w - | doas tee alias tmpd='cd $(mktemp -d)' alias brs='$BROWSER' +which bat > /dev/null 2>&1 && + alias cat="bat -p" -- cgit v1.2.3 From c4d529e5f67c4766ab5dad9f68aacaa1ccbc6382 Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Tue, 7 May 2024 03:16:34 +0200 Subject: reorganized. --- bin/extra/aivpn | 38 -------------------------------------- config/essentials/shell/aliases.sh | 9 ++++++++- config/essentials/zsh/.zshrc | 9 +-------- 3 files changed, 9 insertions(+), 47 deletions(-) delete mode 100755 bin/extra/aivpn (limited to 'config/essentials/shell') diff --git a/bin/extra/aivpn b/bin/extra/aivpn deleted file mode 100755 index 21436ed..0000000 --- a/bin/extra/aivpn +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/sh - -err() { printf "%s\n" "$@"; } - -if [ "$1" = "-k" ] -then - pgrep -f -- "ssh.*-L.*vm" | xargs kill - exit -fi - -err "I: Waiting for connectivity..." -while ! ssh -o ConnectTimeout=1 -o BatchMode=yes vm 2>&1 | grep "Permission denied" > /dev/null -do sleep 1 -done - - -export SSH_ASKPASS="sshpass" -export SSH_ASKPASS_REQUIRE="prefer" -export PASSWORD="zot/qemu" - -err "I: Activating vpn" -ssh vm "rasdial \"vpn.student.ehb.be\"" - -keyadd ehb/ai -ssh -f -N \ - -L 2222:10.2.160.41:22 \ - vm - -keyadd ehb/vm_int -ssh -f -N \ - -L 2223:10.2.160.9:22 \ - vm -ssh -f -N \ - -L 2224:10.2.160.10:22 \ - vm -ssh -f -N \ - -L 2225:10.2.160.11:22 \ - vm diff --git a/config/essentials/shell/aliases.sh b/config/essentials/shell/aliases.sh index eb48416..de441a5 100644 --- a/config/essentials/shell/aliases.sh +++ b/config/essentials/shell/aliases.sh @@ -169,7 +169,14 @@ alias wgdown='doas wg-quick down wg0' alias npi="npm init --yes" # Python -alias penv='python3 -m venv env' + +if which uv > /dev/null 2>&1 +then + alias penv='uv venv env' + alias pip='uv pip' +else + alias penv='python3 -m venv env' +fi alias phttp='python3 -m http.server' alias pipreq='pip install -r requirements.txt' diff --git a/config/essentials/zsh/.zshrc b/config/essentials/zsh/.zshrc index ab66fcb..91a1618 100644 --- a/config/essentials/zsh/.zshrc +++ b/config/essentials/zsh/.zshrc @@ -110,19 +110,12 @@ bindkey -M menuselect '^xh' accept-and-hold # Hold bindkey -M menuselect '^xn' accept-and-infer-next-history # Next bindkey -M menuselect '^xu' undo # Undo -space-expand-alias() { - zle _expand_alias - zle self-insert -} -zle -N space-expand-alias -bindkey -M main ' ' space-expand-alias - ## window title hooks add-zsh-hook -Uz preexec () { print -n "\e]0;$1\a\033[0m"; } add-zsh-hook -Uz precmd set_wt (){ print -Pn "\e]0;%n@%m on %~\a"; } ## automatic ls after cd -add-zsh-hook -Uz chpwd (){ [ "$PWD" = "$HOME" ] || ls -a; } +add-zsh-hook -Uz chpwd (){ [ "$PWD" = "$HOME" ] || ls -A; } ### Variables ## Run menuscripts with fzf -- cgit v1.2.3 From f073720476b2bc19346049e4f2c774469289410f Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Sun, 26 May 2024 13:05:53 +0200 Subject: update cycle keyboard in fillpass to qwerty because of ydotool disable fast-forward in git config add alias to git config for changing email add unhappy.exe shell function add ssh_port shell function disable upds in prompt remove options from LESS variable add entry to zsh gitignore --- bin/guiscripts/fillpass | 8 ++++++++ config/essentials/git/config | 4 ++++ config/essentials/shell/functions.sh | 21 +++++++++++++++++++++ config/essentials/starship.toml | 12 ++++++------ config/essentials/zsh/.gitignore | 3 ++- config/home/.zshenv | 4 ++-- 6 files changed, 43 insertions(+), 9 deletions(-) (limited to 'config/essentials/shell') diff --git a/bin/guiscripts/fillpass b/bin/guiscripts/fillpass index 358afd1..ea2246a 100755 --- a/bin/guiscripts/fillpass +++ b/bin/guiscripts/fillpass @@ -1,5 +1,11 @@ #!/bin/sh +if [ "colemak" = "$(setxkbmap -query | awk '/^variant:/ {print $2}')" ] +then + cycleKB + cycle=1 +fi +# assume we are using colemak pass="$( find "${PASSWORD_STORE_DIR:=~/src/password-store/}" -name "*.gpg" | sed -e "s@$PASSWORD_STORE_DIR/@@" -e 's/\.gpg$//' | @@ -13,3 +19,5 @@ if [ "$login" ] then printf '%s\t%s\n' "$login" "$password" | ydotool type -f - else printf '%s\n' "$password" | ydotool type -f - fi + +[ "$cycle" ] && cycleKB diff --git a/config/essentials/git/config b/config/essentials/git/config index fcf80db..cb16983 100644 --- a/config/essentials/git/config +++ b/config/essentials/git/config @@ -10,3 +10,7 @@ rebase = false [commit] gpgsign = true +[merge] + ff = false +[alias] + change-commits = "!f() { VAR1=$1; VAR='$'$1; OLD=$2; NEW=$3; echo \"Are you sure for replace $VAR $OLD => $NEW ?(Y/N)\";read OK;if [ \"$OK\" = 'Y' ] ; then shift 3; git filter-branch --env-filter \"if [ \\\"${VAR}\\\" = '$OLD' ]; then export $VAR1='$NEW';echo 'to $NEW'; fi\" $@; fi;}; f " diff --git a/config/essentials/shell/functions.sh b/config/essentials/shell/functions.sh index 1fd6e92..1eca57c 100644 --- a/config/essentials/shell/functions.sh +++ b/config/essentials/shell/functions.sh @@ -343,3 +343,24 @@ fchange() eval "$1" done } + +unhappy.exe() { + [ "$1" ] && + smiles=("[: " ".-." " :]" "._.") || + smiles=("]: " ".-." " :[" "._.") + + while true + do + for s in $smiles + do + printf '\r%s' "$s" + sleep 1 + done + done +} + +ssh_port() +{ + ssh -f -N -L 0.0.0.0:"$3":localhost:"$1" "$2" + >&2 printf "Forwarded port '%s' on '%s' to '%s'.\n" "$1" "$2" "$3" +} diff --git a/config/essentials/starship.toml b/config/essentials/starship.toml index 15139f5..efcaf48 100644 --- a/config/essentials/starship.toml +++ b/config/essentials/starship.toml @@ -3,7 +3,7 @@ # Inserts a blank line between shell prompts add_newline = false # format = ' ${custom.upds}' -format = ' [\[$username@$hostname\]](bg:#000000) ${custom.upds}$all' +format = ' [\[$username@$hostname\]](bg:#000000) $all' right_format = """$status""" [character] @@ -32,8 +32,8 @@ min_time = 500 format = '($status)' disabled = false -[custom.upds] -command = 'cat ~/.cache/updates' # shows output of command -when = '[ "$(cat ~/.cache/updates)" -gt 0 ]' -symbol = '📦' -format = '$output$symbol ' +# [custom.upds] +# command = 'cat ~/.cache/updates' # shows output of command +# when = '[ "$(cat ~/.cache/updates)" -gt 0 ]' +# symbol = '📦' +# format = '$output$symbol ' diff --git a/config/essentials/zsh/.gitignore b/config/essentials/zsh/.gitignore index b717a37..a13c79f 100644 --- a/config/essentials/zsh/.gitignore +++ b/config/essentials/zsh/.gitignore @@ -1,2 +1,3 @@ histfile -zcompcache \ No newline at end of file +zcompcache +.zcompdump diff --git a/config/home/.zshenv b/config/home/.zshenv index f480c51..1af14cf 100644 --- a/config/home/.zshenv +++ b/config/home/.zshenv @@ -2,7 +2,7 @@ export EDITOR="nvim" export VISUAL="nvim" -export BROWSER="librewolf" +export BROWSER="surf" export VIEWER="zathura" export PLAYER="mpv" @@ -78,7 +78,7 @@ export FZF_DEFAULT_OPTS=$FZF_DEFAULT_OPTS' --color=info:#b48ead,prompt:#bf6069,pointer:#b48dac --color=marker:#a3be8b,spinner:#ebcb8b,header:#a3be8b' -export LESS="-j 4 -i -r" +export LESS="-i -r" # Colored manpages export MANPAGER="less -R --use-color -Dd+r -Du+b" -- cgit v1.2.3 From a99f0e2f80a26114eb55d165c2cad9ab660916f2 Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Thu, 30 May 2024 22:50:27 +0200 Subject: feat: add more aliases --- config/essentials/shell/aliases.sh | 5 +++++ config/home/.zshenv | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'config/essentials/shell') diff --git a/config/essentials/shell/aliases.sh b/config/essentials/shell/aliases.sh index de441a5..77c7684 100644 --- a/config/essentials/shell/aliases.sh +++ b/config/essentials/shell/aliases.sh @@ -342,3 +342,8 @@ alias tmpd='cd $(mktemp -d)' alias brs='$BROWSER' which bat > /dev/null 2>&1 && alias cat="bat -p" + +alias glf='git pull --ff' +alias glnf='git pull --no-ff' +alias quickvms='/media/cricket/vms/quickemu/"$(find '\''/media/cricket/vms/quickemu/'\'' -type f -iname '\''*.conf'\'' -printf '\''%f +'\'' | sed '\''s/\.conf$//'\'' | fzf)".conf 2> /dev/null' diff --git a/config/home/.zshenv b/config/home/.zshenv index 1af14cf..76c6e92 100644 --- a/config/home/.zshenv +++ b/config/home/.zshenv @@ -2,7 +2,7 @@ export EDITOR="nvim" export VISUAL="nvim" -export BROWSER="surf" +export BROWSER="osurf" export VIEWER="zathura" export PLAYER="mpv" -- cgit v1.2.3 From 0afe617cb914a00470a5346e47456fe1ed67e1c7 Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Tue, 4 Jun 2024 13:12:20 +0200 Subject: checkpoint --- config/essentials/shell/functions.sh | 4 ++-- config/home/.zshenv | 1 + config/wayland/hypr/hyprland.conf | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) (limited to 'config/essentials/shell') diff --git a/config/essentials/shell/functions.sh b/config/essentials/shell/functions.sh index 1eca57c..9f7f4ce 100644 --- a/config/essentials/shell/functions.sh +++ b/config/essentials/shell/functions.sh @@ -45,12 +45,12 @@ o() test "$1" && shift test -f "$f" && $EDITOR $@ "$f" } -go() +og() { _googoo_fzf_opt "$1" cd "$(goo d "$dest" | fzf $opt)" } -ogo() +oog() { _googoo_fzf_opt "$1" cd "$(dirname "$(goo f "$dest" | fzf $opt)")" diff --git a/config/home/.zshenv b/config/home/.zshenv index 76c6e92..f302a10 100644 --- a/config/home/.zshenv +++ b/config/home/.zshenv @@ -92,3 +92,4 @@ export PATH="$HOME/go/bin:$PATH" export PATH="$XDG_CONFIG_HOME/cargo/bin:$PATH" export PATH="$PATH:./node_modules/.bin" export PATH="$PATH:$HOME/.dotnet/tools" +export PATH="$PATH:$GOPATH/bin" diff --git a/config/wayland/hypr/hyprland.conf b/config/wayland/hypr/hyprland.conf index eb232c9..0a00b31 100644 --- a/config/wayland/hypr/hyprland.conf +++ b/config/wayland/hypr/hyprland.conf @@ -8,9 +8,9 @@ exec-once = $HOME/.config/hypr/startup.sh input { kb_layout = us - kb_variant = + kb_variant = colemak kb_model = - kb_options = ctrl:swapcaps + kb_options = ctrl:swapcaps,altwin:menu_win kb_rules = follow_mouse = 2 -- cgit v1.2.3