All pastes #758149 Raw Edit

Something

public text v1 · immutable
·published 2007-11-01 23:07 UTC
rendered paste body
<?
header("Content-type: image/png");

$img = imagecreatefrompng("t01.png");
imagecolorallocate($img, 0, 0, 0);
$white = imagecolorallocate($img, 255, 208, 32);
//imagestring($img, 2, 430, 20, implode(posix_uname(), " "), $white);

//uptime
$ret = exec("uptime");
$r1 = strpos($ret, "up")+3;
$r2 = strpos($ret, "users");
$rr = substr($ret, $r1, $r2-$r1);
$r1 = strrpos($rr, ",");
$rr = "ALAS is up for ".substr($rr, 0, $r1);
imagestring($img, 2, 10, 25, $rr, $white);

//load
$rr = strstr($ret, "load");
imagestring($img, 2, 10, 37, $rr, $white);

// how many users?
$ret = strtok(exec("w -h | cut -f1 -d\  | sort | uniq | wc"), " ")." users logged in";
imagestring($img, 2, 10, 54, $ret, $white);

// how many processes?

$ret = strtok(exec("ls /proc | grep -e [0-9] | wc"), " ")." processes running";
imagestring($img, 2, 10, 71, $ret, $white);

imagepng($img);

?>