diff options
| author | Jack Jamison <jackqjamison@gmail.com> | 2026-05-05 21:53:16 -0400 |
|---|---|---|
| committer | Jack Jamison <jackqjamison@gmail.com> | 2026-05-05 21:53:16 -0400 |
| commit | be8c956b0e819f2db0c6ae3598b6590b62982a83 (patch) | |
| tree | 9de8204882f8894776bd34f83af2800130bb87b5 /scripts | |
| parent | 6ad4d3dfd32b569f9485d24f80a768ed3ca19e46 (diff) | |
been a while
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/aimos/alloc | 7 | ||||
| -rwxr-xr-x | scripts/aimos/cnr | 28 | ||||
| -rwxr-xr-x | scripts/aimos/getactivenode | 2 | ||||
| -rwxr-xr-x | scripts/dafny | 8 | ||||
| -rwxr-xr-x | scripts/open-emacs-project | 4 | ||||
| -rwxr-xr-x | scripts/sysinfo | 38 |
6 files changed, 64 insertions, 23 deletions
diff --git a/scripts/aimos/alloc b/scripts/aimos/alloc new file mode 100755 index 0000000..46e23f6 --- /dev/null +++ b/scripts/aimos/alloc @@ -0,0 +1,7 @@ +#!/bin/bash +if [ "$#" -ne 2 ]; then + echo "Provide two arguments (number of minutes to allocate)" >&2 + exit 1 +fi + +salloc -N 1 --partition=$2 --gres=gpu:4 -t $1 diff --git a/scripts/aimos/cnr b/scripts/aimos/cnr new file mode 100755 index 0000000..e8d5ce5 --- /dev/null +++ b/scripts/aimos/cnr @@ -0,0 +1,28 @@ +#!/bin/bash + +# cnr - compile and run + +path=$(realpath $1) +out="$path.out" +shift +args="$@" + + +# compile +echo "===> COMPILING..." +nvcc -g -G -gencode arch=compute_70,code=sm_70 "$path" -o "$out" +if [[ $? -ne 0 ]]; then + exit 1 +fi +echo "Success" + +# get node +node=$(getactivenode) +if [[ -z "$node" || "$node" == "(Priority)" || "$node" == "(Resources)" ]]; then + echo "No active nodes to run on, exiting." + exit 1 +fi + +# run +echo "===> EXECUTING ON NODE $node ..." +ssh $node "$out $args" diff --git a/scripts/aimos/getactivenode b/scripts/aimos/getactivenode new file mode 100755 index 0000000..b088853 --- /dev/null +++ b/scripts/aimos/getactivenode @@ -0,0 +1,2 @@ +#!/bin/bash +squeue | awk 'NR > 1 {print $8; exit}' diff --git a/scripts/dafny b/scripts/dafny new file mode 100755 index 0000000..93b26a7 --- /dev/null +++ b/scripts/dafny @@ -0,0 +1,8 @@ +#!/bin/bash + +# get args +file="${!#}" +set -- "${@:1:$(($#-1))}" +args="$@" + +cat "$file" | ssh vm "tee ~/dafny/torun.dfy > /dev/null; dafny $args ~/dafny/torun.dfy" diff --git a/scripts/open-emacs-project b/scripts/open-emacs-project index f2e83ab..48360b1 100755 --- a/scripts/open-emacs-project +++ b/scripts/open-emacs-project @@ -10,9 +10,9 @@ emacs_attached() { switch_to() { if emacs_attached; then - emacsclient -e "(proj-set-dir \"$1\")" + emacsclient -e "(proj-set \"$1\")" else - emacsclient -ce "(proj-set-dir \"$1\")" + emacsclient -ce "(proj-set \"$1\")" fi } diff --git a/scripts/sysinfo b/scripts/sysinfo index 90bac9a..8acc18d 100755 --- a/scripts/sysinfo +++ b/scripts/sysinfo @@ -1,15 +1,11 @@ #!/bin/sh -batperc=$(cat /sys/class/power_supply/BAT0/capacity) -batstate=$(cat /sys/class/power_supply/BAT0/status) -brightness=$(brightnessctl -m | cut -d, -f 4) - -network_info() { +get_network_info() { device=$(ip a | grep "state UP" | awk -F': ' '{ printf($2) }') case "${device}" in wlan*) network=$(iwctl station ${device} show | grep 'Connected network' \ - | awk -F' ' '{ printf($3) }') + | awk -F' ' '{ printf($3) }') echo "${device}: ${network}" ;; eth*) @@ -18,24 +14,24 @@ network_info() { esac } -get_volume() { - wpctl get-volume @DEFAULT_SINK@ | awk -F' ' '{ printf "%s %s%% %s", $1, ($2 * 100), $3; }' -} -if [ "$TERM" = "linux" ]; then - notify-send \ - "System Info:" \ - "\ +batperc=$(cat /sys/class/power_supply/BAT0/capacity) +batstate=$(cat /sys/class/power_supply/BAT0/status) +brightness=$(brightnessctl -m | cut -d, -f 4) +volume=$(wpctl get-volume @DEFAULT_SINK@ | awk -F' ' '{ printf "%s %s%% %s", $1, ($2 * 100), $3; }') +network=$(get_network_info) + +header="System Info:" +message="\ +Date: $(date +"%a %b %d") Time: $(date "+%I:%M:%S") -$(get_volume) +${volume} Brightness: ${brightness} ${batstate}: ${batperc}% -$(network_info)" +${network}" + +if [ "$TERM" = "linux" ]; then + notify-send "$header" "$message" else - echo "\ -Time: $(date "+%I:%M:%S") -$(get_volume) -Brightness: ${brightness} -${batstate}: ${batperc}% -$(network_info)" + echo "$message" fi |
