GitHunt
PR

prokrypt/devterm-snippets

bits of bash to make your devterm life easier

Brightness up

echo $((`cat /sys/class/backlight/backlight@0/brightness`+1)) > /sys/class/backlight/backlight@0/brightness

Brigntness down, with ugly hack to prevent 0 brightness

echo $(((`cat /sys/class/backlight/backlight@0/brightness`-1)*9/10+1)) > /sys/class/backlight/backlight@0/brightness

Cleaner version of brightness up with no external commands

bl="/sys/class/backlight/backlight@0/brightness"; read br < $bl; echo $((br+1)) > $bl

Cleaner version of brightness down with no external commands

bl="/sys/class/backlight/backlight@0/brightness"; read br < $bl; echo $(((br-1)*9/10+1)) > $bl

Spit out battery/charging stats

cat /sys/class/power_supply/axp20x-battery/uevent

Calculate wattage

read V < /sys/class/power_supply/axp20x-battery/voltage_now
read I < /sys/class/power_supply/axp20x-battery/current_now
printf -v P %0.2f $((V*I))e-12
printf "Voltage: %0.2fV, Current:, %0.2fA, Wattage: %0.2fW\n" $((V))e-6 $((I))e-6 $P

Change suspend mode to s2idle

tee /sys/power/state <<< s2idle

Turn off all cores except core "0"

tee /sys/devices/system/cpu/cpu[12345]/online <<< 0

Turn on all cores

tee /sys/devices/system/cpu/cpu?/online <<< 1

Switch governor of both clusters to conservative

tee /sys/devices/system/cpu/cpufreq/policy?/scaling_governor <<< conservative

Get available frequencies and governors

grep . /sys/devices/system/cpu/cpufreq/policy?/*avail*

Contributors

Created May 1, 2022
Updated January 5, 2025
prokrypt/devterm-snippets | GitHunt