Commit 20476a6
xxwhirlpool
·
2026-04-06 16:36:05 -0400 EDT
parent 8717b20
`serveit`, notifications for `passmenu`
2 files changed,
+35,
-0
| ... | ... | @@ -22,8 +22,10 @@ if [[ "$typeit" -eq 0 ]]; then | |
| 22 | 22 | # else it's a normal password, copy it to clipboard | |
| 23 | 23 | if [[ "${password_files[*]}" =~ 2fa && "$password" =~ 2fa ]]; then | |
| 24 | 24 | pass otp "$password" | perl -pe "chomp if eof" | xclip -sel clipboard | |
| 25 | + | notify-send "passmenu" "2fa code copied to clipboard" | |
| 25 | 26 | else | |
| 26 | 27 | pass show -c "$password" 2>/dev/null | |
| 28 | + | notify-send "passmenu" "password copied to clipboard" | |
| 27 | 29 | fi | |
| 28 | 30 | else | |
| 29 | 31 | pass show "$password" | { IFS= read -r pass; printf %s "$pass"; } |
+33,
-0
| ... | ... | @@ -0,0 +1,33 @@ | |
| 1 | + | #!/usr/bin/env bash | |
| 2 | + | # | |
| 3 | + | # inspired by evan hahn: | |
| 4 | + | # https://codeberg.org/EvanHahn/dotfiles/src/commit/f7a9d94ae2254cb7e5f67e6e5bdb74b6467f6dec/home/bin/bin/serveit | |
| 5 | + | ||
| 6 | + | usage_help() { | |
| 7 | + | echo "Usage: serveit [-p] [-r | -y]" | |
| 8 | + | echo "Options: -p (port, optional) | -r (ruby) | -y (python)" | |
| 9 | + | } | |
| 10 | + | ||
| 11 | + | if [[ $# -eq 0 ]]; then | |
| 12 | + | usage_help | |
| 13 | + | fi | |
| 14 | + | ||
| 15 | + | port_default="6969" | |
| 16 | + | ||
| 17 | + | py_server() { | |
| 18 | + | [[ "$(command -v python3)" ]]; python3 -m http.server "${port:-$port_default}" || echo "could not run python server" | |
| 19 | + | } | |
| 20 | + | ||
| 21 | + | rb_server() { | |
| 22 | + | [[ "$(command -v ruby)" ]]; ruby -run -e httpd . -p "${port:-$port_default}" || echo "could not run ruby server" | |
| 23 | + | } | |
| 24 | + | ||
| 25 | + | while getopts "p:ryh" opt; do | |
| 26 | + | case "$opt" in | |
| 27 | + | p) port="$OPTARG" ;; | |
| 28 | + | y) py_server ;; | |
| 29 | + | r) rb_server ;; | |
| 30 | + | h) usage_help ;; | |
| 31 | + | *) echo "something went wrong" ;; | |
| 32 | + | esac | |
| 33 | + | done |