From f32fc8b9eb8303d1ca2e1cc17773bc44d38fff3d Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Mon, 27 May 2024 14:17:49 +0200 Subject: updated --- bin/extra/aivpn | 18 +++++------------- bin/menuscripts/mpass-otp | 2 +- config/essentials/shell/aliases.sh | 3 ++- config/essentials/shell/functions.sh | 11 ++--------- config/essentials/zsh/.zshrc | 9 +-------- config/home/.zshenv | 2 +- config/wayland/gammastep/config.ini | 2 +- 7 files changed, 13 insertions(+), 34 deletions(-) diff --git a/bin/extra/aivpn b/bin/extra/aivpn index 21436ed..841d926 100755 --- a/bin/extra/aivpn +++ b/bin/extra/aivpn @@ -16,23 +16,15 @@ done export SSH_ASKPASS="sshpass" export SSH_ASKPASS_REQUIRE="prefer" -export PASSWORD="zot/qemu" +export PASSWORD="zot/quickemu" 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 +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 +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/bin/menuscripts/mpass-otp b/bin/menuscripts/mpass-otp index 52d1341..2be6186 100755 --- a/bin/menuscripts/mpass-otp +++ b/bin/menuscripts/mpass-otp @@ -1,7 +1,7 @@ #!/bin/sh pass="$(find "$PASSWORD_STORE_DIR"/keys/otp -iname "*.gpg" | sed "/^\./d;s#^$PASSWORD_STORE_DIR/keys/otp/##;s/\.gpg$//" | - commander -c)" + dmenu -c)" [ "$pass" ] || exit 1 pass otp -c keys/otp/"$pass" notify-send -t 1000 "mpass" "copied $pass" diff --git a/config/essentials/shell/aliases.sh b/config/essentials/shell/aliases.sh index eb48416..ab17645 100644 --- a/config/essentials/shell/aliases.sh +++ b/config/essentials/shell/aliases.sh @@ -53,7 +53,8 @@ alias pf='profanity' alias f='fg' -alias gurk='pgrep gurk > /dev/null && printf "Already Running.\n" || gurk' +which gurk > /dev/null 2>&1 && + alias gurk='pgrep gurk > /dev/null && printf "Already Running.\n" || gurk' alias arduino-cli='arduino-cli --config-file $XDG_CONFIG_HOME/arduino15/arduino-cli.yaml' diff --git a/config/essentials/shell/functions.sh b/config/essentials/shell/functions.sh index 1fd6e92..e0b148c 100644 --- a/config/essentials/shell/functions.sh +++ b/config/essentials/shell/functions.sh @@ -317,17 +317,10 @@ serve() { if [ "$1" ] then logn "Serving $1" - docker container run \ - --rm \ - --volume "$(readlink -f "$1")":/data \ - --publish 80:5000 sigoden/dufs /data + dufs "$1" else - logn "Receiving files.." - docker container run \ - --rm \ - --volume /tmp/data:/data \ - --publish 80:5000 sigoden/dufs /data --allow-upload + dufs /tmp/data --alow-upload fi } diff --git a/config/essentials/zsh/.zshrc b/config/essentials/zsh/.zshrc index ab66fcb..e2704e9 100644 --- a/config/essentials/zsh/.zshrc +++ b/config/essentials/zsh/.zshrc @@ -31,7 +31,7 @@ eval "$(zoxide init zsh)" ### Plugins [ -f "$HOME/.local/share/zap/zap.zsh" ] && source "$HOME/.local/share/zap/zap.zsh" -plug "MichaelAquilina/zsh-you-should-use" +# plug "MichaelAquilina/zsh-you-should-use" plug "chivalryq/git-alias" plug "kutsan/zsh-system-clipboard" # plug "marlonrichert/zsh-autocomplete" @@ -110,13 +110,6 @@ 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"; } diff --git a/config/home/.zshenv b/config/home/.zshenv index 65fe153..c4b1e9d 100644 --- a/config/home/.zshenv +++ b/config/home/.zshenv @@ -64,7 +64,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" diff --git a/config/wayland/gammastep/config.ini b/config/wayland/gammastep/config.ini index 3a80417..e0699ac 100644 --- a/config/wayland/gammastep/config.ini +++ b/config/wayland/gammastep/config.ini @@ -1,7 +1,7 @@ [general] fade=0 location-provider=manual -adjustment-method=wayland +# adjustment-method=wayland gamma=0.8 temp-day=5700 temp-night=3600 -- cgit v1.2.3 From 4bf952169c5d94044a6dd3c868c990716d22c58b Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Wed, 19 Jun 2024 10:28:46 +0200 Subject: checkpoint --- bin/extra/ytplay | 4 +++- config/essentials/shell/aliases.sh | 3 ++- config/essentials/zsh/.zshrc | 12 ++++++------ config/extra/mutt/.gitignore | 1 + config/extra/mutt/muttrc | 1 + 5 files changed, 13 insertions(+), 8 deletions(-) create mode 100644 config/extra/mutt/.gitignore create mode 100644 config/extra/mutt/muttrc diff --git a/bin/extra/ytplay b/bin/extra/ytplay index b5c1a8c..5243364 100755 --- a/bin/extra/ytplay +++ b/bin/extra/ytplay @@ -1,2 +1,4 @@ #!/bin/sh -yt-dlp -o - "$(ytlink)" | mpv - +url="$(ytlink)" +herbe "playing: $url" & +yt-dlp -o - "$url" | mpv - diff --git a/config/essentials/shell/aliases.sh b/config/essentials/shell/aliases.sh index 44aa7bc..5db3d65 100644 --- a/config/essentials/shell/aliases.sh +++ b/config/essentials/shell/aliases.sh @@ -3,7 +3,8 @@ # The most important one alias vi='nvim' -alias cd='z' +which z > /dev/null 2>&1 && + alias cd='z' # Zsh specific aliases if [ $SHELL = "/bin/zsh" ] diff --git a/config/essentials/zsh/.zshrc b/config/essentials/zsh/.zshrc index 6e28602..2b3ae1a 100644 --- a/config/essentials/zsh/.zshrc +++ b/config/essentials/zsh/.zshrc @@ -7,8 +7,6 @@ then [ "${TTY%%tty*}" = '/dev/' ] && clear case "${TTY#/dev/tty}" in 1) exec startx > /dev/null 2>&1 ;; - 2) exec startdwl > /dev/null 2>&1 ;; - 3) exec startw > /dev/null 2>&1 ;; *) false ;; esac && exit fi @@ -18,10 +16,12 @@ autoload -z edit-command-line zle -N edit-command-line ### Source files -. $XDG_CONFIG_HOME/zsh/comp.zsh -. $XDG_CONFIG_HOME/shell/functions.sh -. $XDG_CONFIG_HOME/shell/aliases.sh -. $XDG_CONFIG_HOME/zsh/widgets.zsh +source_it() { [ -f "$1" ] && . "$1" } +source_it /etc/profile.d/plan9.sh +source_it $XDG_CONFIG_HOME/zsh/comp.zsh +source_it $XDG_CONFIG_HOME/shell/functions.sh +source_it $XDG_CONFIG_HOME/shell/aliases.sh +source_it $XDG_CONFIG_HOME/zsh/widgets.zsh # . $XDG_CONFIG_HOME/zsh/prompt.zsh # . $XDG_CONFIG_HOME/zsh/plugins.zsh diff --git a/config/extra/mutt/.gitignore b/config/extra/mutt/.gitignore new file mode 100644 index 0000000..5e46596 --- /dev/null +++ b/config/extra/mutt/.gitignore @@ -0,0 +1 @@ +cache \ No newline at end of file diff --git a/config/extra/mutt/muttrc b/config/extra/mutt/muttrc new file mode 100644 index 0000000..a5cfa90 --- /dev/null +++ b/config/extra/mutt/muttrc @@ -0,0 +1 @@ +source /home/aluc/.config/mutt/configs/raymaekers.luca@gmail.com -- cgit v1.2.3 From 947f7df73f16981f170265a64a964142fc617023 Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Thu, 20 Jun 2024 12:01:39 +0200 Subject: checkpoint --- bin/common/gt | 111 +++++++++++++++++++++ bin/guiscripts/osurf-fill | 22 +++- bin/guiscripts/osurftxt | 28 +++--- bin/guiscripts/osurftxts | 22 ++++ config/essentials/shell/aliases.sh | 3 - config/essentials/shell/functions.sh | 2 +- .../essentials/vis/plugins/vis-snippets/init.lua | 0 config/essentials/vis/visrc.lua | 1 + 8 files changed, 165 insertions(+), 24 deletions(-) create mode 100755 bin/common/gt create mode 100755 bin/guiscripts/osurftxts create mode 100644 config/essentials/vis/plugins/vis-snippets/init.lua diff --git a/bin/common/gt b/bin/common/gt new file mode 100755 index 0000000..bdbd00f --- /dev/null +++ b/bin/common/gt @@ -0,0 +1,111 @@ +#!/bin/sh + +# Git Trach, track the state of multiple repos from a single file. + +# dependencies: +# - git +# - $EDITOR: -e +# - herbe (optional): -s + +repos="${XDG_DATA_HOME:-$HOME}"/git-track.txt +touch "$repos" + +help() { + >&2 cat </dev/null | while read -r line + # \r\033[0K : clear current line + do >&2 printf '\r\033[0K%s' "$line" + done +} + +# Print repositories prettily +# This function function prints animations (eg. clearing the line) +# to stderr and the final status line is outputted to stdout. +status() { + while read -r repo + do + repo_pretty="$(printf '%s' "$repo" | sed "s@$HOME@~@" )" + + # absolute path + cd "$repo" + + # replace line with status + >&2 printf '\r\033[0K' + + status="$(git status --porcelain 2> /dev/null | awk '{print $1}' | uniq | tr -d '\n')" + remote="$(git branch -v 2>/dev/null | sed 's/ahead/↑/;s/behind/↓/;s/[^↓↑]*//g')" + + printf '%s %s %s\n' "$repo_pretty" "$status" "$remote" + done < "$repos" +} + +# run git command in each repo +# $1: command +repos_cmd() { + while read -r repo + do + repo_pretty="$(printf '%s' "$repo" | sed "s@$HOME@~@" )" + printf ''\''%s'\'' in %s' "$1" "$repo_pretty" + ( + cd "$repo" + git "$1" > /dev/null 2>&1 + [ $? -gt 0 ] && s="x" || s="o" + printf '\r\033[0K%s: %s\n' "$repo_pretty" "$s" + ) + done < "$repos" +} + +# no options +if [ -z "$1" ] +then + help + exit 1 +fi + +while getopts ":a:c:f:lshe" opt +do + case "$opt" in + a) + cd "$OPTARG" || exit 1 + r="$(git rev-parse --show-toplevel)" + [ "$r" ] || exit 2 + + if grep "$r" "$repos" > /dev/null 2>&1 + then + >&2 printf 'added already.\n' + exit 2 + fi + + printf '%s\n' "$r" >> "$repos" + + >&2 printf 'added.\n' ;; + c) repos_cmd "$OPTARG" ;; + s) status=1 ;; + l) cat "$repos" ;; + e) $EDITOR "$repos" ;; + f) repos="$OPTARG" ;; + T) help ;; + :) >&2 printf -- '-%s requires argument\n' "$OPTARG"; exit 1 ;; + ?) >&2 printf -- 'Invalid option: -%s\n' "$OPTARG"; exit 1 ;; + esac +done + +if [ "$status" ] +then + status + which herbe > /dev/null 2>&1 && + eval "herbe $(status | sed 's/"/\"/g;s/.*/"&"/' | tr '\n' ' ')" & +fi diff --git a/bin/guiscripts/osurf-fill b/bin/guiscripts/osurf-fill index 311c273..43af807 100755 --- a/bin/guiscripts/osurf-fill +++ b/bin/guiscripts/osurf-fill @@ -1,6 +1,16 @@ #!/bin/sh -# bitwarden dmenu script - based off of the autofill userscript from qutebrowser -# requires the fifo patch + +# Fills a password for a given website +# original script by Avalon Williams (avalonwilliams@protonmail.com) +# This version uses the window id to know the url of the surf window +# and to know which fifo it must use. Then it injects javascript code. +# that will fill the forms with the credentials + +# dependencies: +# - surf fifo patch (http://surf.suckless.org/patches/fifo/) +# - xprop +# - 'pass' with password store in form dir/url/pass.gpg + # $1: winid fifodir="$HOME/.config/surf/fifo" @@ -12,6 +22,7 @@ fi fifo="$fifodir/$winid" [ -p "$fifo" ] || exit 2 +# Get only domain name + top-level domain url="$(xprop -id "$winid" _SURF_URI | cut -f 2 -d'"' | sed 's,^.*://\([^/]*\)/.*,\1,' | @@ -19,13 +30,15 @@ url="$(xprop -id "$winid" _SURF_URI | [ "$url" ] || exit 3 >&2 printf 'url: %s\n' "$url" - +# get pass with url and ask if multiple are found pass="$({ find $PASSWORD_STORE_DIR/websites/ -type f -name '*.gpg' | grep "$url/" || echo; } | head -n 1 | sed "s,$PASSWORD_STORE_DIR/,,;s/\.gpg$//" | dmenu -c)" +# if dmenu was stopped, exit [ $? -gt 0 ] && exit 4 +# if no password was found, search through password store manually with dmenu if [ -z "$pass" ] then store="${PASSWORD_STORE_DIR:-$HOME/.password-store}" @@ -44,14 +57,15 @@ then pass="$file" fi >&2 printf 'pass: %s\n' "$pass" - herbe "filling ${pass#websites/}" & # Get password and username in variables with only one call to 'pass' +# escape single quotes eval "$(pass show "$pass" | sed -n "1s/'/'\\\\''/g;1s/.*/password='&'/p;s/^login: \?\(.\+\)/username='\1'/p")" printf '%s : %s\n' "$username" "$password" +# Escape quotes and backslashes for javascript javascript_escape() { printf '%s' "$1" | sed -s 's,['\''"\\\\],\\\\&,g' } diff --git a/bin/guiscripts/osurftxt b/bin/guiscripts/osurftxt index ef60166..9a1d4f4 100755 --- a/bin/guiscripts/osurftxt +++ b/bin/guiscripts/osurftxt @@ -1,22 +1,18 @@ #!/bin/sh -# open all links in txt file into one tabbed surf +# open a link from a txt file in surf # dependencies: surf, osurf, dmenu -# $1: file path for non interactive use -if [ -z "$1" ] -then - d="$HOME/dl/txtabs" - f="$(find "$d" -type f -printf '%f\n' | dmenu)" - [ "$f" ] || exit 1 - f="$d"/"$f" -else - [ -f "$1" ] || exit 1 - f="$1" -fi +winid="$1" +>&2 printf 'winid: %s\n' "$winid" +tabs="$HOME/dl/txtabs" -winid="$(osurf "$(head -n 1 "$f")")" -tail -n +2 "$f" | while read -r url; - do surf -e "$winid" "$url" & - done +f="$(find "$tabs" -type f -printf '%f\n' | dmenu -c)" +[ "$f" ] || exit 1 +f="$tabs"/"$f" +>&2 printf 'f: %s\n' "$f" + +url="$(dmenu -c < "$f")" + +printf 'loaduri %s' "$url" > $HOME/.config/surf/fifo/$winid diff --git a/bin/guiscripts/osurftxts b/bin/guiscripts/osurftxts new file mode 100755 index 0000000..ef60166 --- /dev/null +++ b/bin/guiscripts/osurftxts @@ -0,0 +1,22 @@ +#!/bin/sh + +# open all links in txt file into one tabbed surf + +# dependencies: surf, osurf, dmenu + +# $1: file path for non interactive use +if [ -z "$1" ] +then + d="$HOME/dl/txtabs" + f="$(find "$d" -type f -printf '%f\n' | dmenu)" + [ "$f" ] || exit 1 + f="$d"/"$f" +else + [ -f "$1" ] || exit 1 + f="$1" +fi + +winid="$(osurf "$(head -n 1 "$f")")" +tail -n +2 "$f" | while read -r url; + do surf -e "$winid" "$url" & + done diff --git a/config/essentials/shell/aliases.sh b/config/essentials/shell/aliases.sh index fdd9d17..ddc605a 100644 --- a/config/essentials/shell/aliases.sh +++ b/config/essentials/shell/aliases.sh @@ -164,9 +164,6 @@ alias wtip='wt ip -c -brief addr' alias fusephone='sshfs myphone: /media/phone' alias ttyper='ttyper -l english1000' -alias wgup='doas wg-quick up wg0' -alias wgdown='doas wg-quick down wg0' - # NPM alias npi="npm init --yes" diff --git a/config/essentials/shell/functions.sh b/config/essentials/shell/functions.sh index 8e51135..1b69fbd 100644 --- a/config/essentials/shell/functions.sh +++ b/config/essentials/shell/functions.sh @@ -306,7 +306,7 @@ gdown () { } # toggle wireguard vpn on $1 -> interface -wgtoggle() { +wgt() { d="${1:-wg0}" ip -br a | awk '{print $1}' | grep "$d" > /dev/null && doas wg-quick down "$d" || diff --git a/config/essentials/vis/plugins/vis-snippets/init.lua b/config/essentials/vis/plugins/vis-snippets/init.lua new file mode 100644 index 0000000..e69de29 diff --git a/config/essentials/vis/visrc.lua b/config/essentials/vis/visrc.lua index a424613..1813888 100644 --- a/config/essentials/vis/visrc.lua +++ b/config/essentials/vis/visrc.lua @@ -5,6 +5,7 @@ require('vis') require('plugins/vis-cursors') require('plugins/vis-title') +require('plugins/vis-snippets') ------------------------------------ --- EVENTS -- cgit v1.2.3