From d41e2b1e672575e1064c87bd45a0a684a2250efe Mon Sep 17 00:00:00 2001 From: raul Date: Wed, 20 Nov 2024 09:29:51 +0100 Subject: [PATCH] Add source files --- cooler_adduser.sh | 7 +++++++ recordbandwidth | 10 ++++++++++ replace_spaces | 2 ++ 3 files changed, 19 insertions(+) create mode 100755 cooler_adduser.sh create mode 100755 recordbandwidth create mode 100755 replace_spaces diff --git a/cooler_adduser.sh b/cooler_adduser.sh new file mode 100755 index 0000000..06d6390 --- /dev/null +++ b/cooler_adduser.sh @@ -0,0 +1,7 @@ +#!/bin/bash +CMD=$(which useradd) + +for USER in "$@"; do + $CMD -m $USER + echo "$USER:$USER" | chpasswd +done diff --git a/recordbandwidth b/recordbandwidth new file mode 100755 index 0000000..8b72bd1 --- /dev/null +++ b/recordbandwidth @@ -0,0 +1,10 @@ +#!/bin/sh +init="$(($(cat /sys/class/net/[ew]*/statistics/rx_bytes | paste -sd '+')))" + +printf "Recording bandwidth. Press enter to stop." + +read -r wait + +fin="$(($(cat /sys/class/net/[ew]*/statistics/rx_bytes | paste -sd '+')))" + +printf "%4sB of bandwidth used.\\n" $(numfmt --to=iec $(($fin-$init))) diff --git a/replace_spaces b/replace_spaces new file mode 100755 index 0000000..0a4e6e8 --- /dev/null +++ b/replace_spaces @@ -0,0 +1,2 @@ +#!/bin/bash +for file in *; do mv "$file" `echo $file | tr ' ' '_'` ; done