These are my links for September 21st through September 24th:
Month: September 2011
Bookmarks for July 20th through September 15th
These are my links for July 20th through September 15th:
- extundelete: An ext3 and ext4 file undeletion utility – bacon=saved
- 500 Internal Server Error – 500 Internal Server Error
- 500 Internal Server Error – 500 Internal Server Error
- ViTunes –
- Free Radio Network – why is internet linking *still* illegal in the uk?
A Simple Continuous Integration (Jenkins) Dashboard
I had 15 minutes today to produce a wall-mounted-screen-compatible dashboard for showing the latest build statuses from our Jenkins continuous integration manager. It’s written in Perl and uses a few CPAN modules – XML::Simple, LWP::Simple and Readonly.
This is what it looks like:
and here’s the code:
#!/usr/local/bin/perl -T use strict; use warnings; use XML::Simple; use LWP::Simple qw(get); use Carp; use English qw(-no_match_vars); use Readonly; Readonly::Scalar our $CI => q[http://my.ci.server/rssLatest]; Readonly::Scalar our $COLUMNS => 6; my $str = get($CI); my $xml = XMLin($str); my @entries = map { $xml->{entry}->{$_} } sort keys %{$xml->{entry}}; print <<"EOT" or croak qq[Error printing: $ERRNO]; Content-type: text/html <html> <head> <title>Continuous Integration HUD</title> <meta http-equiv="refresh" content="120; url=$ENV{SCRIPT_NAME}"/> <style type="text/css"> .stable { background-color: green } .unstable { background-color: yellow } .broken { background-color: red } table { margin: 0 auto; } a { font-size: bigger; text-decoration: none; color: black; } </style> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script> <script type="text/javascript"> \$(document).ready(redraw); \$(window).resize(redraw); function redraw() { \$('tr').height((\$(window).height()-60)/\$('tr').size()); \$('td').width((\$(window).width()-60)/\$('tr').first().find('td').size()); } </script> </head> <body> EOT print qq[<table>\n] or croak qq[Error printing: $ERRNO]; while(scalar @entries) { print qq[ <tr>\n] or croak qq[Error printing: $ERRNO]; for my $j (1..$COLUMNS) { my $entry = shift @entries; if(!$entry) { last; } my $title = $entry->{title}; my $class = q[stable]; $class = ($title =~ /unstable/smx) ? 'unstable' : $class; $class = ($title =~ /broken/smx) ? 'broken' : $class; $title =~ s{\s+[(].*?$}{}smx; my $href = $entry->{link}->{href}; print qq[ <td class="$class"><a href="$href">$title</a></td>] or croak qq[Error printing: $ERRNO]; } print qq[ </tr>\n] or croak qq[Error printing: $ERRNO]; } print qq[</table>\n] or croak qq[Error printing: $ERRNO]; print <<'EOT' or croak qq[Error printing: $ERRNO]; </body> </html> EOT