From 1460eae0d754818dffdaadb744571cbfce1a8378 Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Sat, 29 Jul 2023 11:46:22 +0200 Subject: use script instead of alias --- bin/common/cx | 2 ++ 1 file changed, 2 insertions(+) create mode 100755 bin/common/cx (limited to 'bin/common') diff --git a/bin/common/cx b/bin/common/cx new file mode 100755 index 0000000..88fb817 --- /dev/null +++ b/bin/common/cx @@ -0,0 +1,2 @@ +#!/bin/sh +[ -x "$1" ] && chmod -x "$1" || chmod +x "$1" -- cgit v1.2.3 From 55378ac493716f15fd68d73fb77fcade4a667d99 Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Sat, 29 Jul 2023 11:48:39 +0200 Subject: added saf --- bin/common/saf | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100755 bin/common/saf (limited to 'bin/common') diff --git a/bin/common/saf b/bin/common/saf new file mode 100755 index 0000000..0c6fbc4 --- /dev/null +++ b/bin/common/saf @@ -0,0 +1,24 @@ +#!/bin/sh + +# Simple Ass Fetch by futxlii + +red="$(printf '\033[31m')" +green="$(printf '\033[32m')" +blue="$(printf '\033[34m')" +reset="$(printf '\033[0m')" + +for file in /etc/os-release /usr/lib/os-release +do + [ -f "$file" ] && . "$file" && break +done + +KERNEL="$(uname -r)" +UPTIME="$(uptime -p)"; UPTIME="${UPTIME##up }" +SHELL="$(basename "$SHELL")" + +cat < Date: Sat, 29 Jul 2023 11:48:57 +0200 Subject: added toush --- bin/common/toush | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100755 bin/common/toush (limited to 'bin/common') diff --git a/bin/common/toush b/bin/common/toush new file mode 100755 index 0000000..dd675b9 --- /dev/null +++ b/bin/common/toush @@ -0,0 +1,14 @@ +#!/bin/sh +# fork of +# https://codeberg.org/futxlii/bin/toush :) + +shebang='#!/bin/sh' + +usage() { >&2 printf 'Usage: %s' "${0##*/}"; exit 1 ;} + +[ "$1" ] || usage +while [ "$1" ]; do + [ -f "$1" ] && usage + printf '%s\n\n' "$shebang" > "$1" && chmod +x "$1" + shift +done -- cgit v1.2.3 From eeb2fac3028837fae0db3d816acf6d8bd0050120 Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Sat, 29 Jul 2023 11:49:08 +0200 Subject: added sync-install.sh --- bin/common/sync-install.sh | 58 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100755 bin/common/sync-install.sh (limited to 'bin/common') diff --git a/bin/common/sync-install.sh b/bin/common/sync-install.sh new file mode 100755 index 0000000..e26c74d --- /dev/null +++ b/bin/common/sync-install.sh @@ -0,0 +1,58 @@ +#!/bin/sh + +die () +{ + echo "$@" >&2 +} + +read_char () +{ + old_stty_cfg=$(stty -g) + stty raw -echo + dd ibs=1 count=1 2> /dev/null + stty $old_stty_cfg +} + +confirm () +{ + printf "$1 " + read_char | grep "[yY]" +} + +usage() +{ + >&2 printf 'Usage: %s \n' "${0##*/}" +} + +[ $# -lt 2 ] && usage && exit 1 +REMOTE="$1" +DEST="$2" +SCRIPT="${3:-sync.sh}" + +if ! ssh $REMOTE test -w $DEST 2> /dev/null +then + die "Not a valid remote or destination." + exit 1 +fi + +die "─────────────────────────────────────────────────────────────" +cat <&2 +#!/bin/sh + +THISDIR="\$(dirname "\$(readlink -f "\$0")")" +inotifywait -m -e create,modify,delete --format "%f" "\$THISDIR" | +while read FILE +do + rsync -aP "\$THISDIR/" "$REMOTE:$DEST" + sleep 1m +done +EOF +die "─────────────────────────────────────────────────────────────" +die "located at $(readlink -f "$SCRIPT")" + +if confirm "good?" +then + chmod +x "$SCRIPT" +else + rm -f "$SCRIPT" +fi -- cgit v1.2.3 From e850f3a1702b4d8b9d0cfec5c07d710b5201ed29 Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Fri, 4 Aug 2023 22:36:30 +0200 Subject: edited toush to fit needs --- bin/common/toush | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'bin/common') diff --git a/bin/common/toush b/bin/common/toush index dd675b9..eb2d7cf 100755 --- a/bin/common/toush +++ b/bin/common/toush @@ -1,14 +1,10 @@ #!/bin/sh -# fork of -# https://codeberg.org/futxlii/bin/toush :) +# idea from https://codeberg.org/futxlii/bin/toush :) shebang='#!/bin/sh' -usage() { >&2 printf 'Usage: %s' "${0##*/}"; exit 1 ;} +[ -f "$1" ] && exit 1 -[ "$1" ] || usage -while [ "$1" ]; do - [ -f "$1" ] && usage - printf '%s\n\n' "$shebang" > "$1" && chmod +x "$1" - shift -done +printf '%s\n\n' "$shebang" > "$1" && + chmod +x "$1" && $EDITOR "$1" +grep -qv "$shebang\|^$" "$1" || rm "$1" -- cgit v1.2.3