Generate Color For Row Array (Specific Colour Grouping)

create two below function

function random_color_part() {
	return str_pad( dechex( mt_rand( 0, 255 ) ), 2, '0', STR_PAD_LEFT);
}

function random_color() {
	$color =  $this->random_color_part() . $this->random_color_part() . $this->random_color_part();
	return $color;
}

then result set data

$res = SELECT FROM DB GROUP BY

foreach ($res as $key => $value) {
	$setcolor[trim($value['kelas'])] = $this->random_color();
}

foreach($loopingall as $v){
// check if any kelas value in color (group select)
if (in_array($v['kelas'], array_keys($setcolor))) {
	$color = $setcolor[$v['kelas']];
} else {
	$color = 'FFFFFF';
}

}

done dude.

ref: stackoverflow

Move Active Window with WMCTRL (Without Alt+Tab)

first what we need is install the packages

$ sudo pacman -S wmctrl

after installing, modify your bashrc or zshrc to add alias like this:

...
alias subl3="subl3 && wmctrl -a \"\$(wmctrl -l | grep subl3 | cut -f 1,2,3,4 -d ' ' --complement)\" 2>&1 >/dev/null"

then test open your sublime text and another application/windows (in it)

open your run command subl3 / modify your run command preferences

prefix: chromium
command: wmctrl -a chromium

done.