first commit

This commit is contained in:
Daniel Bauer
2020-04-01 11:45:24 +02:00
commit 1872ef616f
5 changed files with 295 additions and 0 deletions

19
scripts/gpu.sh Executable file
View File

@@ -0,0 +1,19 @@
#!/usr/bin/env bash
print_gpu_usage() {
function getGPUUsage() {
gpuUsage=$(nvidia-smi -q -d UTILIZATION | grep Gpu | awk '{print $3}')
}
getGPUUsage
if [ -z "$GpuUsage" ]; then
echo "$gpuUsage%"
else
echo "-"
fi
}
main() {
print_gpu_usage
}
main

12
scripts/helpers.sh Executable file
View File

@@ -0,0 +1,12 @@
#!/usr/bin/env bash
get_tmux_option() {
local option="$1"
local default_value="$2"
local option_value="$(tmux show-option -gqv "$option")"
if [ -z "$option_value" ]; then
echo "$default_value"
else
echo "$option_value"
fi
}