diff options
| author | Craig Jennings <c@cjennings.net> | 2025-05-27 17:50:58 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2025-05-27 17:50:58 -0500 |
| commit | 77deca928801efd333089ff01a5b9e3e20e11205 (patch) | |
| tree | 7395f26920bcc6592ba3923d74f6822bd423f1b9 | |
| parent | 56a95d0835469438dc8538642e6d349b33dd463d (diff) | |
add wireguard fzf functionality and install script
| -rw-r--r-- | assets/wireguard/USCALA.conf | 15 | ||||
| -rw-r--r-- | assets/wireguard/USCASF.conf | 16 | ||||
| -rw-r--r-- | assets/wireguard/USDC.conf | 15 | ||||
| -rw-r--r-- | assets/wireguard/USGAAT.conf | 15 | ||||
| -rw-r--r-- | dotfiles/system/.profile.d/fzf.sh | 69 | ||||
| -rwxr-xr-x | scripts/wireguard-proton.sh | 13 |
6 files changed, 119 insertions, 24 deletions
diff --git a/assets/wireguard/USCALA.conf b/assets/wireguard/USCALA.conf new file mode 100644 index 0000000..7d902d4 --- /dev/null +++ b/assets/wireguard/USCALA.conf @@ -0,0 +1,15 @@ +[Interface] +# Bouncing = 8 +# NetShield = 1 +# Moderate NAT = on +# NAT-PMP (Port Forwarding) = off +# VPN Accelerator = on +PrivateKey = aDhBPBlyRGAtWz2eaP6mPmEC5e6uNJj/YFleWACZdEk= +Address = 10.2.0.2/32 +DNS = 10.2.0.1 + +[Peer] +# US-CA#187 +PublicKey = fXtINk5LcWvNoCxNwx9WkmHieyyw+zIcLiiRM6eyECc= +AllowedIPs = 0.0.0.0/0 +Endpoint = 146.70.174.162:51820
\ No newline at end of file diff --git a/assets/wireguard/USCASF.conf b/assets/wireguard/USCASF.conf new file mode 100644 index 0000000..7948ae4 --- /dev/null +++ b/assets/wireguard/USCASF.conf @@ -0,0 +1,16 @@ +[Interface] +# Key for velox +# Bouncing = 26 +# NetShield = 1 +# Moderate NAT = on +# NAT-PMP (Port Forwarding) = off +# VPN Accelerator = on +PrivateKey = 4Al9epK8qlWSiASFx1D8YPtqaqdUKUA6SRQhfhmL81g= +Address = 10.2.0.2/32 +DNS = 10.2.0.1 + +[Peer] +# US-CA#75 +PublicKey = xRu4XSIeCCNh4wQqit2w0PwAqzAs7JVA4zQqxGOhSSY= +AllowedIPs = 0.0.0.0/0 +Endpoint = 79.127.185.222:51820
\ No newline at end of file diff --git a/assets/wireguard/USDC.conf b/assets/wireguard/USDC.conf new file mode 100644 index 0000000..62ede76 --- /dev/null +++ b/assets/wireguard/USDC.conf @@ -0,0 +1,15 @@ +[Interface] +# Bouncing = 1 +# NetShield = 1 +# Moderate NAT = on +# NAT-PMP (Port Forwarding) = off +# VPN Accelerator = on +PrivateKey = ODgff/xOftY7+v64+J9vPs9C2ZK83xepaM9+OdJUong= +Address = 10.2.0.2/32 +DNS = 10.2.0.1 + +[Peer] +# US-DC#29 +PublicKey = 3Lz5VpqnS7wfnOWVYFNCFHl+JuuanJ/hB2TqOKQZxVI= +AllowedIPs = 0.0.0.0/0 +Endpoint = 185.247.68.50:51820
\ No newline at end of file diff --git a/assets/wireguard/USGAAT.conf b/assets/wireguard/USGAAT.conf new file mode 100644 index 0000000..b4cfc7d --- /dev/null +++ b/assets/wireguard/USGAAT.conf @@ -0,0 +1,15 @@ +[Interface] +# Bouncing = 0 +# NetShield = 1 +# Moderate NAT = on +# NAT-PMP (Port Forwarding) = off +# VPN Accelerator = on +PrivateKey = gMms305eLQY1Q/GTC1/nTffFh9ou4tIVzpQuWo0P6XU= +Address = 10.2.0.2/32 +DNS = 10.2.0.1 + +[Peer] +# US-GA#319 +PublicKey = vrQlzOff8/CWCDVaesXMZLfQaOE4qrdY2BJUjWeRHyA= +AllowedIPs = 0.0.0.0/0 +Endpoint = 149.22.94.113:51820
\ No newline at end of file diff --git a/dotfiles/system/.profile.d/fzf.sh b/dotfiles/system/.profile.d/fzf.sh index 5a13dd4..2193614 100644 --- a/dotfiles/system/.profile.d/fzf.sh +++ b/dotfiles/system/.profile.d/fzf.sh @@ -4,73 +4,94 @@ # Craig Jennings <c@cjennings.net> # fuzzy find settings and utilities, sourced by .profile +# otherwise ** doesn't expand +source /usr/share/fzf/completion.zsh + ### SETTINGS export FZF_DEFAULT_OPTS='--height=70%' export FZF_DEFAULT_COMMAND='rg --files' export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND" export FZF_DEFAULT_COMMAND='rg --files --no-ignore-vcs --hidden' - -### NAVIGATION +### NAVIGATION # cdff - change directory find file # change to the directory where the file resides. cdff() { - file=$(fzf +m -q "$1") - dir=$(dirname "$file") - cd "$dir" || exit + file=$(fzf +m -q "$1") + dir=$(dirname "$file") + cd "$dir" || exit } # CD to a directory with fzf cdd () { - destdir=$(find "${1:-.}" -path '*/\.*' -prune \ - -o -type d -print 2> /dev/null | fzf +m) && - cd "$destdir" + destdir=$(find "${1:-.}" -path '*/\.*' -prune \ + -o -type d -print 2> /dev/null | fzf +m) && + cd "$destdir" } ### SYSTEM ADMIN # Kill a process with fzf kp () { - pid=$(ps -ef | sed 1d | eval "fzf ${FZF_DEFAULT_OPTS} -m --header='[kill:process]'" | awk '{print $2}') + pid=$(ps -ef | sed 1d | eval "fzf ${FZF_DEFAULT_OPTS} -m --header='[kill:process]'" | awk '{print $2}') - if [ "x$pid" != "x" ] - then - echo "$pid" | xargs kill -${1:-9} - kp - fi + if [ "x$pid" != "x" ] + then + echo "$pid" | xargs kill -${1:-9} + kp + fi } # list available packages, show info in preview, and install selection yinstall() { - yay -Slq | fzf --multi --preview 'yay -Si {1}' | xargs -ro yay -S --noconfirm + yay -Slq | fzf --multi --preview 'yay -Si {1}' | xargs -ro yay -S --noconfirm } yinstall-skipverify() { - yay -Slq | fzf --multi --preview 'yay -Si {1}' | xargs -ro yay -S --noconfirm --mflags --skipinteg + yay -Slq | fzf --multi --preview 'yay -Si {1}' | xargs -ro yay -S --noconfirm --mflags --skipinteg } # list installed packages, show info in preview, and remove selection yrm() { - yay -Qq | fzf --multi --preview 'yay -Qi {1}' | xargs -ro yay -Rns + yay -Qq | fzf --multi --preview 'yay -Qi {1}' | xargs -ro yay -Rns } # find-in-file - usage: fif <searchTerm> fif() { - if [ ! "$#" -gt 0 ]; then echo "Need a string to search for!"; return 1; fi - rg --files-with-matches --no-messages "$1" | fzf --preview "highlight -O ansi -l {} 2> /dev/null | rg --colors 'match:bg:yellow' --ignore-case --pretty --context 10 '$1' || rg --ignore-case --pretty --context 10 '$1' {}" + if [ ! "$#" -gt 0 ]; then echo "Need a string to search for!"; return 1; fi + rg --files-with-matches --no-messages "$1" | fzf --preview "highlight -O ansi -l {} 2> /dev/null | rg --colors 'match:bg:yellow' --ignore-case --pretty --context 10 '$1' || rg --ignore-case --pretty --context 10 '$1' {}" } -### CONVENIENCE +### CONVENIENCE # Find a book in the calibre library and open it in emacs client. # previously: find ~/books \( -iname \*.epub -o -iname \*.pdf -o -iname \*.djvu \) | fzf | xargs emacs bk() { - bkfile=$(find ~/sync/books/ \( -iname "*.pdf" -o -iname "*.epub" -o -iname "*.djvu" \) -print | fzf) - if [ -n "$bkfile" ]; then - emacsclient -c -a '' "$bkfile" & - fi + bkfile=$(find ~/sync/books/ \( -iname "*.pdf" -o -iname "*.epub" -o -iname "*.djvu" \) -print | fzf) + if [ -n "$bkfile" ]; then + emacsclient -c -a '' "$bkfile" & + fi } +# close wireguard connection first if already running, then +# run wireguard, selecting the configuration file. +wg() { + # Check if wireguard is running + output=$(sudo wg) + if [[ -n "$output" ]]; then + # Shutdown all wg interfaces if WireGuard is currently running. + for iface in $(sudo wg show interfaces); do + sudo wg-quick down "${iface}" + done + fi + # Get the list of config files + wgfile=$(sudo find /etc/wireguard/ -iname "*.conf" -exec basename -s .conf {} \; | fzf) + + if [ -n "$wgfile" ]; then + sudo wg-quick up $wgfile + sudo wg + fi +} diff --git a/scripts/wireguard-proton.sh b/scripts/wireguard-proton.sh new file mode 100755 index 0000000..564a9f8 --- /dev/null +++ b/scripts/wireguard-proton.sh @@ -0,0 +1,13 @@ +#!/bin/sh +# https://account.protonvpn.com/downloads + +sudo pacman -S --noconfirm wireguard-tools systemd-resolved + +# copy all Proton Wireguard config files +sudo cp ../assets/wireguard/*.conf /etc/wireguard/ + +sudo systemctl enable systemd-resolved +sudo systemctl start systemd-resolved + +sudo wg-quick up USGA +sudo wg |
