<commit_before>do_cpu_governor() {
	if [ -x /usr/bin/cpufreq-set ]; then
		if [ -d /sys/devices/system/cpu/cpufreq/performance ]; then
			GOVERNOR="performance"
		elif [ -d /sys/devices/system/cpu/cpufreq/powersave ]; then
			GOVERNOR="powersave"
		elif [ -d /sys/devices/system/cpu/cpufreq/userspace ]; then
			GOVERNOR="userspace"
		elif [ -d /sys/devices/system/cpu/cpufreq/ondemand ]; then
			GOVERNOR="ondemand"
		elif [ -d /sys/devices/system/cpu/cpufreq/conserative ]; then
			GOVERNOR="conserative"
		elif [ -d /sys/devices/system/cpu/cpufreq/interactive ]; then
			GOVERNOR="interactive"
		fi

		FUN=$(whiptail --title "Set CPU Governor Mode" --menu "The governor is currently set to $GOVERNOR\n \n What mode would you like to set it to?" $LINES $COLUMNS $(( $LINES - 8 )) --cancel-button Exit --ok-button Select \
			"1 performance" "Always run your CPU at full speed. Not recommended if you are running on a battery." \
			"2 powersave" "Always run your CPU at the lowest possible speed. Useful if you want to conserve battery, but may cause issues with Gigabit Ethernet" \
			"3 userspace" "Let userspace utilities set the speed of your CPU (Not for the faint hearted)" \
			"4 ondemand" "Increases the CPU speed only when under heavy load. Recommended option if running on a battery, but may cause issues with Gigabit Ethernet" \
			"5 conserative" "CPU will gradually speed up or slow down depending on how much load the CPU is doing. May cause issues with Gigabit Ethernet" \
			"6 interactive" "Let the system decide what CPU speed to use. This is the default option" \
			3>&1 1>&2 2>&3)
		RET=$?
		if [ $RET -eq 1 ]; then
			exit 0
		elif [ $RET -eq 0 ]; then
			case "$FUN" in
				1\ *) set_governor performance ;;
				2\ *) set_governor powersave ;;
				3\ *) set_governor userspace ;;
				4\ *) set_governor ondemand ;;
				5\ *) set_governor conserative ;;
				h\ *) set_governor interactive ;;
				*) whiptail --msgbox "ERROR: The option is invalid" 20 60 1 ;;
			esac || whiptail --msgbox "There was an error running option $FUN" 20 60 1
		else
			exit 1
		fi
	else
		if (whiptail --title "Set CPU Governor Mode" --yesno "It seems that the tool required for this operation is not installed on your system. Do you want me to install it for you?" 8 78); then
			if ( $DISTRO == "ubuntu" || $DISTRO == "debian" ); then
				apt -y install cpufrequtils
				do_cpu_governor
			elif ( $DISTRO == "opensuse" ); then
				zypper -y install cpufrequtils
				do_cpu_governor
			fi
		else
			return 0
		fi
	fi
}

set_governor() {
	cpufreq-set -g $1
	if [ $? -eq 0 ]; then
		whiptail --title "Set CPU Governor Mode" --msgbox "SUCCESS. The CPU governor is set to $1" 8 78<commit_msg>Fixed the cpu governor selector<commit_after>do_cpu_governor() {
	if [ -x /usr/bin/cpufreq-set ]; then
		GOVERNOR=$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor)
		
		FUN=$(whiptail --title "Set CPU Governor Mode" --menu "The governor is currently set to $GOVERNOR\n \n What mode would you like to set it to?" $LINES $COLUMNS $(( $LINES - 8 )) --cancel-button Exit --ok-button Select \
			"1 performance" "Always run your CPU at full speed. Not recommended if you are running on a battery." \
			"2 powersave" "Always run your CPU at the lowest possible speed. Useful if you want to conserve battery, but may cause issues with Gigabit Ethernet" \
			"3 userspace" "Let userspace utilities set the speed of your CPU (Not for the faint hearted)" \
			"4 ondemand" "Increases the CPU speed only when under heavy load. Recommended option if running on a battery, but may cause issues with Gigabit Ethernet" \
			"5 conserative" "CPU will gradually speed up or slow down depending on how much load the CPU is doing. May cause issues with Gigabit Ethernet" \
			"6 interactive" "Let the system decide what CPU speed to use. This is the default option" \
			3>&1 1>&2 2>&3)
		RET=$?
		if [ $RET -eq 1 ]; then
			return 0
		elif [ $RET -eq 0 ]; then
			case "$FUN" in
				1\ *) set_governor performance ;;
				2\ *) set_governor powersave ;;
				3\ *) set_governor userspace ;;
				4\ *) set_governor ondemand ;;
				5\ *) set_governor conserative ;;
				h\ *) set_governor interactive ;;
				*) whiptail --msgbox "ERROR: The option is invalid" 20 60 1 ;;
			esac || whiptail --msgbox "There was an error running option $FUN" 20 60 1
		else
			return 1
		fi
	else
		if (whiptail --title "Set CPU Governor Mode" --yesno "It seems that the tool required for this operation is not installed on your system. Do you want me to install it for you?" 8 78); then
			if ( $DISTRO == "ubuntu" || $DISTRO == "debian" ); then
				apt -y install cpufrequtils
				do_cpu_governor
			elif ( $DISTRO == "opensuse" ); then
				zypper install -y cpufrequtils
				do_cpu_governor
			fi
		else
			return 0
		fi
	fi
}

set_governor() {
	cpufreq-set -g $1
	if [ $? -eq 0 ]; then
		whiptail --title "Set CPU Governor Mode" --msgbox "SUCCESS. The CPU governor is set to $1" 8 78
{'fraction_non_alphanumeric': 0.1048273076146233, 'fraction_numerical': 0.01716824883861846, 'mean_word_length': 3.137009189640769, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '781319', 'n_tokens_mistral': 1870, 'n_tokens_neox': 1576, 'n_words': 662}