Skip to content

Instantly share code, notes, and snippets.

@bradclawsie
Created July 13, 2012 06:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bradclawsie/3103038 to your computer and use it in GitHub Desktop.
Save bradclawsie/3103038 to your computer and use it in GitHub Desktop.
temp.pl
#!/usr/bin/env perl
use DateTime;
$| = 1;
my $tmux_out = '';
my $sensors_bin = '/usr/bin/sensors';
if (-e -x $sensors_bin) {
my $sensors_out = `$sensors_bin`;
if ($sensors_out =~ /temp1\:\s+\+(\d+)/s) {
$tmux_out .= '|' . $1 . 'C| ';
}
}
my $dt = DateTime->now->set_time_zone('America/Los_Angeles');
my $date_out = $dt->hour . ':' . sprintf("%02d",$dt->minute) .
' ' . $dt->month . '/' . $dt->day;
print $tmux_out . $date_out . "\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment