diff options
author | Timmy Keller <tjk@tjkeller.xyz> | 2021-10-23 12:14:47 -0500 |
---|---|---|
committer | Timmy Keller <tjk@tjkeller.xyz> | 2021-10-23 12:14:47 -0500 |
commit | 2b751c00e199a3cdb8481da5a11eb5b31ff6df89 (patch) | |
tree | dd230fb29f33bd8d1079efb3246e61263b493435 | |
parent | 17d9f82cace9cf36aa931d342acde11f8f71e0a8 (diff) | |
parent | fa004d3de13f8e8f46a3375fb4da12936a623209 (diff) | |
download | scripts-2b751c00e199a3cdb8481da5a11eb5b31ff6df89.tar.xz scripts-2b751c00e199a3cdb8481da5a11eb5b31ff6df89.zip |
merge griff bullshit like dude use the fucking script you wrote for it duh and readded new scripts
-rwxr-xr-x | bar/memuse | 36 | ||||
-rwxr-xr-x | launch/launch | 5 | ||||
-rwxr-xr-x | misc/pdfautocompile | 2 | ||||
-rwxr-xr-x | sync/griff | 80 |
4 files changed, 83 insertions, 40 deletions
@@ -1,3 +1,33 @@ -#!/bin/sh -awk '{ if(!total){ total = $2 } else if(!free){ free = $2 } else{ exit } } END{ print int(((total-free)*100)/total)"%" }' /proc/meminfo -#free -b | awk '/^Mem/ { print int($3*100/$2)"%" }' +#!/usr/bin/awk -f +function getvar(label) { + while (getline < meminfo && $1 != label":"); + return $2 +} + +BEGIN { + meminfo="/proc/meminfo" + + # Make sure these are in order of the output of /proc/meminfo + memtotal = getvar("MemTotal") + memfree = getvar("MemFree") + buffers = getvar("Buffers") + cached = getvar("Cached") + shmem = getvar("Shmem") + sreclaimable = getvar("SReclaimable") + + # Htop calculations + totalused = memtotal - memfree + totalcached = cached + sreclaimable - shmem + noncachenonbuf = totalused - (buffers + totalcached) + + # Print % of memory used + print int((noncachenonbuf * 100) / memtotal)"%" +} + +#BEGIN { +# cmd="free -b" +# cmd | getline +# cmd | getline +# print int($3*100/$2)"%" +#} +##awk '{ if(!total){ total = $2 } else if(!free){ free = $2 } else{ exit } } END{ print int(((total-free)*100)/total)"%" }' /proc/meminfo diff --git a/launch/launch b/launch/launch index c943822..e529438 100755 --- a/launch/launch +++ b/launch/launch @@ -39,12 +39,11 @@ case "`hostname`" in ;; librex60) case "$1" in - brave) iceweasel ;; - chromium|chrome) iceweasel ;; + firefox|brave) iceweasel -P default-release ;; + chromium|chrome) iceweasel -P School ;; halt|off|poweroff|shutdown) doas poweroff ;; #sleep|suspend|zzz) doas zzz ;; reboot|res|restart) doas reboot ;; - #snes|snes9x) snes9x-gtk $args ;; *) launchother $@ ;; esac ;; diff --git a/misc/pdfautocompile b/misc/pdfautocompile new file mode 100755 index 0000000..d44ec3f --- /dev/null +++ b/misc/pdfautocompile @@ -0,0 +1,2 @@ +#!/bin/sh +echo "$1" | entr pdflatex "$1" || echo "entr or LaTeX is not installed!" @@ -1,12 +1,12 @@ #!/bin/sh home=$(echo $HOME | sed 's/\//\\\//g') repos="$(grep -v '#' | sed "s/\~/$home/")" << REPOS -blr|~/.local/src/programs/blr -dmenu|~/.local/src/programs/dmenu -dotconfig|~/.config -scripts|~/.local/bin -st|~/.local/src/programs/st -timmywm|~/.local/src/programs/timmywm +#~/.local/src/programs/blr +~/.local/src/programs/dmenu +~/.config +~/.local/bin +~/.local/src/programs/st +~/.local/src/programs/timmywm REPOS #echo "$repos" | cut -f1 @@ -18,32 +18,44 @@ RED="\033[0;31m" GRN="\033[0;32m" MAG="\033[0;35m" -for repo in $repos; do - name=$(echo $repo | cut -d'|' -f1) - dir=$(echo $repo | cut -d'|' -f2) - if cd $dir 2>/dev/null; then - if git diff --quiet HEAD $REF -- $DIR; then - echo "$GRN[Repo $name is unchanged!]$NORM" - else - echo "$CYN[Repo $name has changed:]$NORM" - git status | grep -v '(use' - read -p "Would you like to view the changes? [y/n]: " viewchange - case $viewchange in - y|yes|Y|Yes) git diff HEAD $REF -- $DIR ;; - esac - read -p "Would you like to push these changes? [y/n]: " pushchange - case $pushchange in - y|yes|Y|Yes) - while [ -z "$commitmsg" ]; do - read -p "Enter a commit message: " commitmsg - done - git add . && git commit -m "$commitmsg" && git push \ - && echo "$GRN[Changes to repo $name successfully pushed!]$NORM" \ - || echo "$RED[An error occured while pushing changes to repo $name!]$NORM" - ;; - esac +me() { echo $0 | sed 's/.*\///'; } +repocheck() { [ -z "$repos" ] && echo "No repos have been added!\nUse \"$(me) add\" or edit the script file to add a new repo!" && exit; } + +reponame() { sed -n 's/^\s*url.*\/\(.*\)\.git/\1/p' $1/.git/config; } + +rddiff() { + repocheck + for repo in $repos; do + name="$(reponame $repo)" + if cd $repo 2>/dev/null; then + if git diff --quiet HEAD $REF -- $DIR; then + echo "$GRN[Repo $name is unchanged!]$NORM" + else + echo "$CYN[Repo $name has changed:]$NORM" + git status | grep -v '(use' + read -p "Would you like to view the changes? [y/n]: " viewchange + case $viewchange in + y|yes|Y|Yes) git diff HEAD $REF -- $DIR ;; + esac + read -p "Would you like to push these changes? [y/n]: " pushchange + case $pushchange in + y|yes|Y|Yes) + while [ -z "$commitmsg" ]; do + read -p "Enter a commit message: " commitmsg + done + git add . && git commit -m "$commitmsg" && git push \ + && echo "$GRN[Changes to repo $name successfully pushed!]$NORM" \ + || echo "$RED[An error occured while pushing changes to repo $name!]$NORM" + ;; + esac + fi fi - else - echo "$BOLD$RED[Repo $name does not exist at $dir!]$NORM" - fi -done + done +} + +drdiff() { echo impl; } + +case $1 in + add) echo "add this in" ;; + *) rddiff ;; +esac |