From 2c5a050641d5400843facfc65e58a2bef5d87422 Mon Sep 17 00:00:00 2001 From: Benjamin Chausse Date: Wed, 24 Jan 2024 12:22:09 -0500 Subject: Multithreaded R package compilation --- .local/bin/Rinstall | 5 ++--- .local/bin/backlightctl | 2 +- .local/bin/compiler | 48 +++++++++++++++++++++++----------------------- .local/bin/dwmbar/dwmb-vpn | 23 +++++++++++----------- .local/bin/vpnmenu | 6 +++--- 5 files changed, 41 insertions(+), 43 deletions(-) (limited to '.local/bin') diff --git a/.local/bin/Rinstall b/.local/bin/Rinstall index 8d2857e..a4ee1c5 100755 --- a/.local/bin/Rinstall +++ b/.local/bin/Rinstall @@ -1,5 +1,4 @@ #!/bin/sh -for f in $* - do - sudo R --vanilla -e "install.packages('"$f"', repos='http://cran.us.r-project.org')" +for f in $*; do + sudo R --vanilla -e "install.packages('"$f"', repos='http://cran.us.r-project.org', Ncpus=10)" done diff --git a/.local/bin/backlightctl b/.local/bin/backlightctl index d3f6280..1d38c07 100755 --- a/.local/bin/backlightctl +++ b/.local/bin/backlightctl @@ -31,7 +31,7 @@ get_percent() { # $1 is converted to a value between 0-$max within this function get_total() { value="$(to_value "$1")" - printf "%d" "$(($(get_status) + value))" + printf "%d" "$(($(get_status) + $value))" } helpmsg="Usage: backlightctl -[FLAG] [PERCENTAGE] diff --git a/.local/bin/compiler b/.local/bin/compiler index 9020284..220b4a9 100755 --- a/.local/bin/compiler +++ b/.local/bin/compiler @@ -12,30 +12,30 @@ base="${file%.*}" cd "$dir" || exit -textype() { \ - command="pdflatex" - ( sed 5q "$file" | grep -i -q 'xelatex' ) && command="xelatex" - $command --output-directory="$dir" "$base" && - grep -i addbibresource "$file" >/dev/null && - biber --input-directory "$dir" "$base" && - $command --output-directory="$dir" "$base" && - $command --output-directory="$dir" "$base" - } +textype() { + command="pdflatex" + (sed 5q "$file" | grep -i -q 'xelatex') && command="xelatex" + $command --output-directory="$dir" "$base" && + grep -i addbibresource "$file" >/dev/null && + biber --input-directory "$dir" "$base" && + $command --output-directory="$dir" "$base" && + $command --output-directory="$dir" "$base" +} case "$file" in - *\.ms) refer -PS -e -p"$REFERBIB" "$file" | groff -me -ms -kejpt -T pdf > "$base".pdf ;; - *\.gd) groffdown "$file" | refer -PS -e "-p$REFERBIB" | groff -me -ms -kejpt -T pdf > "$base".pdf ;; - # *\.gd) groffdown "$file" | refer -PS -e "$REFERBIB" | groff -me -ms -kejpt -T pdf > "$base".pdf ;; - *\.mom) refer -PS -e -p"$REFERBIB" "$file" | groff -mom -kejpt -T pdf > "$base".pdf ;; - *\.rmd) echo "require(rmarkdown); render('$file')" | R -q --vanilla ;; - *\.rnw) Rscript -e "knitr::knit2pdf('"$file"')" ;; - *\.tex) textype "$file" ;; - *\.md) pandoc "$file" --pdf-engine=xelatex -o "$base".pdf ;; - *config.h) make && sudo make install ;; - *\.c) cc "$file" -o "$base" && "$base" ;; - *\.py) python "$file" ;; - *\.go) go run "$file" ;; - *\.sent) setsid sent "$file" 2>/dev/null & ;; - *.Xresources) xrdb -load "$file" ;; - *) sed 1q "$file" | grep "^#!/" | sed "s/^#!//" | xargs -r -I % "$file" ;; +*\.ms) refer -PS -e -p"$REFERBIB" "$file" | groff -me -ms -kejpt -T pdf >"$base".pdf ;; +*\.gd) groffdown "$file" | refer -PS -e "-p$REFERBIB" | groff -me -ms -kejpt -T pdf >"$base".pdf ;; +# *\.gd) groffdown "$file" | refer -PS -e "$REFERBIB" | groff -me -ms -kejpt -T pdf > "$base".pdf ;; +*\.mom) refer -PS -e -p"$REFERBIB" "$file" | groff -mom -kejpt -T pdf >"$base".pdf ;; +*\.rmd) echo "require(rmarkdown); render('$file')" | R -q --vanilla ;; +*\.rnw) Rscript -e "knitr::knit2pdf('""$file""')" ;; +*\.tex) textype "$file" ;; +*\.md) pandoc "$file" --pdf-engine=xelatex -o "$base".pdf ;; +*config.h) make && sudo make install ;; +*\.c) cc "$file" -o "$base" && "$base" ;; +*\.py) python "$file" ;; +*\.go) go run "$file" ;; +*\.sent) setsid sent "$file" 2>/dev/null & ;; +*.Xresources) xrdb -load "$file" ;; +*) sed 1q "$file" | grep "^#!/" | sed "s/^#!//" | xargs -r -I % "$file" ;; esac diff --git a/.local/bin/dwmbar/dwmb-vpn b/.local/bin/dwmbar/dwmb-vpn index 9ddb5b5..4ce86f9 100755 --- a/.local/bin/dwmbar/dwmb-vpn +++ b/.local/bin/dwmbar/dwmb-vpn @@ -4,13 +4,13 @@ vpnstatus="$(piactl get connectionstate)" case "$vpnstatus" in - Disconnected) icon=" " ;; - Connecting) icon="  " ;; - Connected) icon=" " ;; - Interrupted) icon="  " ;; - Reconnecting) icon="  " ;; - DisconnectingToReconnect) icon="  ";; - Disconnecting) icon="  " ;; +Disconnected) icon=" " ;; +Connecting) icon="  " ;; +Connected) icon=" " ;; +Interrupted) icon=" " ;; +Reconnecting) icon="  " ;; +DisconnectingToReconnect) icon="  " ;; +Disconnecting) icon="  " ;; esac # case "$vpnstatus" in @@ -25,7 +25,6 @@ esac echo " $icon" - # \033]01;31\] # pink # \033]00m\] # white # \033]01;36\] # bold green @@ -34,8 +33,8 @@ echo " $icon" # \033]01;33\] # bold yellow # s/onnected\sto\s//; case $BLOCK_BUTTON in - 1) piactl connect && notify-send -a "VPN" "Connected" && kill -36 $(pidof dwmblocks);; - 2) vpnmenu ;; - 3) piactl disconnect && notify-send -a "VPN" "Disonnected" && kill -36 $(pidof dwmblocks);; - 6) "$TERMINAL" -e "$EDITOR" "$0" ;; +1) piactl connect && notify-send -a "VPN" "Connected" && kill -36 "$(pidof dwmblocks)" ;; +2) vpnmenu ;; +3) piactl disconnect && notify-send -a "VPN" "Disonnected" && kill -36 "$(pidof dwmblocks)" ;; +6) "$TERMINAL" -e "$EDITOR" "$0" ;; esac diff --git a/.local/bin/vpnmenu b/.local/bin/vpnmenu index ff584e0..a42d000 100755 --- a/.local/bin/vpnmenu +++ b/.local/bin/vpnmenu @@ -3,8 +3,8 @@ region="$(piactl get regions | dmenu -p "Select Region: ")" update=$(kill -36 $(pidof dwmblocks)) -[ "$region" == "" ] && notify-send -a " VPN" "Operation aborted" -[ "$region" != "" ] && piactl set region "$region" && \ - $update && notify-send -a " VPN" "Changed region to $region" && \ +[ "$region" == "" ] && notify-send -a " VPN" "Operation aborted" +[ "$region" != "" ] && piactl set region "$region" && + $update && notify-send -a " VPN" "Changed region to $region" && sleep 3 && $update # Comment next line if not using the vpn dwmblock -- cgit v1.2.3