chore: updates here and there
This commit is contained in:
parent
ed190866f5
commit
05708570cb
14 changed files with 58 additions and 67 deletions
6
.local/bin/scripts/ip.me
Executable file
6
.local/bin/scripts/ip.me
Executable file
|
@ -0,0 +1,6 @@
|
|||
#!/bin/bash
|
||||
|
||||
API_ENDPOINT='http://ip-api.com/json/?fields=7876383'
|
||||
printf "%s" "$(curl "${API_ENDPOINT}" 2>/dev/null)" | jq -r '[ "IP: \(.query)", "Country: \(.country)", "City: \(.city)", "ISP: \(.isp)", "ASN: \(.as)" ][] | "\(.)"'
|
||||
|
||||
# vim: ft=bash
|
4
.local/bin/scripts/volume
Executable file
4
.local/bin/scripts/volume
Executable file
|
@ -0,0 +1,4 @@
|
|||
#!/bin/bash
|
||||
|
||||
SINK="$(pactl list sinks short | grep RUNNING | cut -d ' ' -f 1)"
|
||||
pactl set-sink-mute "$SINK" false ; pactl set-sink-volume "$SINK" "$1%"
|
|
@ -1,6 +1,12 @@
|
|||
#!/bin/bash
|
||||
|
||||
IFNAME="wg_lva"
|
||||
PIPE="/var/run/vpnd.sock"
|
||||
|
||||
vpn_sock() {
|
||||
echo echoing "$@"
|
||||
[ -p "$PIPE" ] && echo "$@" > $PIPE
|
||||
}
|
||||
|
||||
while [ "$#" -gt 0 ]; do
|
||||
case "$1" in
|
||||
|
@ -10,7 +16,7 @@ while [ "$#" -gt 0 ]; do
|
|||
;;
|
||||
'-v'|'--verbose') VERBOSE=1
|
||||
;;
|
||||
'--visual') USE_TERMINAL=1
|
||||
'--visual')
|
||||
;;
|
||||
*) echo "Wrong argument!"; exit 1
|
||||
;;
|
||||
|
@ -26,20 +32,18 @@ fi
|
|||
|
||||
UP_NAME="$(ip link show | grep 'wg' | cut -d ' ' -f 2 | sed 's/://')"
|
||||
|
||||
sudo_a() {
|
||||
dmenu -p "$1" <&-
|
||||
}
|
||||
|
||||
if [ -n "${USE_TERMINAL}" ]; then
|
||||
LAUNCH_CMD=(sudo -A -p "Password:")
|
||||
fi
|
||||
|
||||
# shellcheck disable=SC2068
|
||||
if [ -z "${UP_NAME}" ]; then
|
||||
IFNAME="${IFNAME}${DPI}"
|
||||
${LAUNCH_CMD[@]} wg-quick up "${IFNAME}"
|
||||
IFNAME="${IFNAME}${DPI}"
|
||||
if [ -n "${UP_NAME}" ]; then
|
||||
if [ "${UP_NAME}" != "${IFNAME}" ]; then
|
||||
vpn_sock replace "${UP_NAME}" "${IFNAME}"
|
||||
else
|
||||
vpn_sock down "${UP_NAME}"
|
||||
fi
|
||||
else
|
||||
${LAUNCH_CMD[@]} wg-quick down "${UP_NAME}"
|
||||
vpn_sock up "${IFNAME}"
|
||||
fi
|
||||
|
||||
read -r < "$PIPE"
|
||||
pkill -36 dwmblocks
|
||||
|
||||
# vim: ft=bash
|
||||
|
|
|
@ -3,7 +3,6 @@ VENV_FOLDER_NAME="$(basename "${VIRTUAL_ENV:-.venv}")"
|
|||
|
||||
[ -z "${VIRTUAL_ENV}" ] && OPERATION=c || OPERATION=d
|
||||
|
||||
|
||||
help() {
|
||||
echo "USAGE:"
|
||||
echo " venv [OPTIONS] [<VENV_FOLDER_PATH>]"
|
||||
|
@ -55,9 +54,9 @@ VENV_FOLDER="${VENV_FOLDER_PATH}/${VENV_FOLDER_NAME}"
|
|||
|
||||
# shellcheck disable=SC2015
|
||||
case "${OPERATION}" in
|
||||
c) [ -z "${VIRTUAL_ENV}" ] && create_or_activate || help;;
|
||||
d) [ -n "${VIRTUAL_ENV}" ] && deactivate || help;;
|
||||
r) [ -d "${VENV_FOLDER}" ] && remove || help;;
|
||||
c) [ -z "${VIRTUAL_ENV}" ] && create_or_activate || help >&2;;
|
||||
d) [ -n "${VIRTUAL_ENV}" ] && deactivate || help >&2;;
|
||||
r) [ -d "${VENV_FOLDER}" ] && remove || help >&2;;
|
||||
esac
|
||||
|
||||
# vim: set ft=sh
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue