I find myself using sudo for certain commands on a daily basis, which impairs the workflow. The following shows how one can run some commands with root privilege but without entering the password.

1
2
3
4
5
6
7
8
9
10
$ sudo EDITOR=vim visudo

# I appended the following in the opened file

...
albert ALL=(ALL:ALL) NOPASSWD: /usr/sbin/openconnect
albert ALL=(ALL:ALL) NOPASSWD: /usr/bin/chmod 666 /sys/devices/system/cpu/smt/control
albert ALL=(ALL:ALL) NOPASSWD: /usr/bin/chmod 666 /sys/devices/system/cpu/intel_pstate/no_turbo
albert ALL=(ALL:ALL) NOPASSWD: /usr/bin/chmod 666 /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages
albert ALL=(ALL:ALL) NOPASSWD: /usr/bin/chmod 666 /sys/kernel/mm/hugepages/hugepages-1048576kB/nr_hugepages

This enables me to manage hyperthreading, turbo boost state and huge pages conveniently.