From 125237e4a7cf7e6d2ec28565d4403ab9c9908d85 Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Thu, 10 Oct 2019 23:12:02 +0200 Subject: add generic shell helper scripts --- bin/alert | 25 +++++++++++++++++++++++++ bin/execprim | 15 +++++++++++++++ bin/fauvpn | 25 +++++++++++++++++++++++++ bin/pss | 15 +++++++++++++++ 4 files changed, 80 insertions(+) create mode 100755 bin/alert create mode 100755 bin/execprim create mode 100755 bin/fauvpn create mode 100755 bin/pss (limited to 'bin') diff --git a/bin/alert b/bin/alert new file mode 100755 index 0000000..2eb45e5 --- /dev/null +++ b/bin/alert @@ -0,0 +1,25 @@ +#!/bin/sh + +# Print and ring Bell + +# Author: Florian Fischer +# License: WTFPL + +if test -n "$1" -a ! \( "$1" == "-l" -o "$1" == "--loop" \) +then + echo "Usage: $0 [-l | --loop]" + exit 1 +fi + +CMD="xkbbell ^/dev/null; echo -n -e \a" + +eval $CMD + +if test -n "$1" +then + while true + do + eval $CMD + sleep 1 + done +fi diff --git a/bin/execprim b/bin/execprim new file mode 100755 index 0000000..39a83f8 --- /dev/null +++ b/bin/execprim @@ -0,0 +1,15 @@ +#!/bin/sh + +# Print primary selection with all special chars to stdout and +# prompt if this should be evaluated + +# Author: Florian Fischer +# License: WTFPL + +! type xclip &>/dev/null && echo "Please install xclip" && exit 1 + +PRIMARY=$(xclip -o) +echo $PRIMARY | cat -A # show special chars +echo -e "\nExecute? (y/N): " +read CHOICE +[[ "$CHOICE" -eq "y" ]] && eval $PRIMARY diff --git a/bin/fauvpn b/bin/fauvpn new file mode 100755 index 0000000..9d2d484 --- /dev/null +++ b/bin/fauvpn @@ -0,0 +1,25 @@ +#!/bin/sh + +# Run openvpn with fau settings in eather full or split mode + +# Author: Florian Fischer +# License: WTFPL + +if test -n "$1"; then + if test "$1" = "full"; then + MODE=Full + elif test "$1" = "split"; then + MODE=Split + fi +fi + +if test -z "$MODE"; then + echo "Usage: $0 [full | split]" + exit 1 +fi + +pushd . >/dev/null +cd $HOME/Documents/MyDocuments/Study/FAU-Erlangen/Allgemein && \ +sudo openvpn FAU-${MODE}tunnel.ovpn +popd >/dev/null + diff --git a/bin/pss b/bin/pss new file mode 100755 index 0000000..223b10e --- /dev/null +++ b/bin/pss @@ -0,0 +1,15 @@ +#!/bin/sh + +# Print info for running processes mathing PATTERN + +# Author: Florian Fischer +# License: WTFPL + +if test -z "$1" +then + echo "Usage: $0 PATTERN" + exit 1 +fi + +PIDS=$(pgrep -d , -f $1) +test -n "$PIDS" && ps -Fp $PIDS -- cgit v1.2.3