summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbin/common/gt111
-rwxr-xr-xbin/extra/aivpn30
-rwxr-xr-xbin/extra/ytplay2
-rwxr-xr-xbin/guiscripts/osurf-fill22
-rwxr-xr-xbin/guiscripts/osurftxt28
-rwxr-xr-xbin/guiscripts/osurftxts22
-rwxr-xr-xbin/menuscripts/mpass-otp2
-rw-r--r--config/essentials/shell/aliases.sh9
-rw-r--r--config/essentials/shell/functions.sh13
-rw-r--r--config/essentials/vis/plugins/vis-snippets/init.lua0
-rw-r--r--config/essentials/vis/visrc.lua1
-rw-r--r--config/essentials/zsh/.zshrc13
-rw-r--r--config/extra/mutt/.gitignore1
-rw-r--r--config/extra/mutt/muttrc1
-rw-r--r--config/wayland/gammastep/config.ini2
15 files changed, 213 insertions, 44 deletions
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 <<EOF
+usage: gt [OPTION]
+-a PATH add repo
+-s update and show status of each repo
+-c COMMAND run 'git COMMAND' in each repo
+-h show this help
+-l list repos
+-e edit repos in $EDITOR
+EOF
+}
+
+# fetch repository prettily, outputs nothing if failed
+fetch() {
+ # fetch with one-line printing of progress
+ git fetch --progress 2>/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/extra/aivpn b/bin/extra/aivpn
new file mode 100755
index 0000000..841d926
--- /dev/null
+++ b/bin/extra/aivpn
@@ -0,0 +1,30 @@
+#!/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/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
+
+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/bin/extra/ytplay b/bin/extra/ytplay
index 66204c4..5243364 100755
--- a/bin/extra/ytplay
+++ b/bin/extra/ytplay
@@ -1,4 +1,4 @@
#!/bin/sh
url="$(ytlink)"
-notify-send "playing: $url" &
+herbe "playing: $url" &
yt-dlp -o - "$url" | mpv -
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/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 be35a6c..ddc605a 100644
--- a/config/essentials/shell/aliases.sh
+++ b/config/essentials/shell/aliases.sh
@@ -3,7 +3,8 @@
# The most important one
alias vi='vis'
-alias cd='z'
+which z > /dev/null 2>&1 &&
+ alias cd='z'
# Zsh specific aliases
if [ $SHELL = "/bin/zsh" ]
@@ -53,7 +54,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'
@@ -162,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 976db1e..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" ||
@@ -318,17 +318,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/vis/plugins/vis-snippets/init.lua b/config/essentials/vis/plugins/vis-snippets/init.lua
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/config/essentials/vis/plugins/vis-snippets/init.lua
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
diff --git a/config/essentials/zsh/.zshrc b/config/essentials/zsh/.zshrc
index 8aa9f5e..5981fd9 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
@@ -31,6 +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 "chivalryq/git-alias"
# plug "marlonrichert/zsh-autocomplete"
plug "zap-zsh/fzf"
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
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