Skip to content

Instantly share code, notes, and snippets.

The following escape sequences are available in constructs that
interpolate, but not in transliterations.
\l lowercase next character only
\u titlecase (not uppercase!) next character only
\L lowercase all characters till \E or end of string
\U uppercase all characters till \E or end of string
\F foldcase all characters till \E or end of string
\Q quote (disable) pattern metacharacters till \E or
end of string
package CPAN::Testers::Backend::ProcessReport;
our $VERSION = 0.001;
# ABSTRACT: Process an incoming test report into useful statistics
=head1 SYNOPSIS
# container.yml - A Beam::Wire container file
process_reports:
$class: CPAN::Testers::Backend::ProcessReport
schema:
@preaction
preaction / todo.md
Last active May 11, 2017 07:05
CPAN Testers To-Do

To-Do List

Major Problems:

  • PROB-1: Performance of main generate task
    • The main generate task is barely keeping up with the incoming reports. A cursory examination reveals nothing that can be easily improved without parallelization.
    • Solution: Refactor into a Minion task that can be parallelized using Beam::Minion
    • Critical chain: BACKEND-1 API-3 BACKEND-2
  • PROB-2: AmazonDB SimpleDB Metabase is expensive (money wise)
  • Solution: Make new API to write to local Metabase cache
=head1 NAME
=head1 SYNOPSIS
=head1 DESCRIPTION
=head1 INSTALLING
=head1 SEE ALSO
diff --git a/bin/hannibal-poll-bmc b/bin/hannibal-poll-bmc
index 96762dc..ebe42b7 100644
--- a/bin/hannibal-poll-bmc
+++ b/bin/hannibal-poll-bmc
@@ -129,12 +129,24 @@ sub _process_result {
sub _write_metric {
my ( $metric, $value ) = @_;
- state $sock = IO::Socket::INET->new(
- PeerAddr => $opt{graphite},
dev.hannibal.bmc.X7QJWP01K.System_Board_Fan2A.Reading 6240
dev.hannibal.bmc.X7QJWP01K.System_Board_Fan3A.Reading 6240
dev.hannibal.bmc.X7QJWP01K.System_Board_Fan4A.Reading 6120
dev.hannibal.bmc.X7QJWP01K.System_Board_Fan5A.Reading 6120
dev.hannibal.bmc.X7QJWP01K.System_Board_Fan6A.Reading 6240
dev.hannibal.bmc.X7QJWP01K.System_Board_Fan7A.Reading 6240
dev.hannibal.bmc.X7QJWP01K.System_Board_Fan1B.Reading 5760
dev.hannibal.bmc.X7QJWP01K.System_Board_Fan2B.Reading 5760
dev.hannibal.bmc.X7QJWP01K.System_Board_Fan3B.Reading 5760
dev.hannibal.bmc.X7QJWP01K.System_Board_Fan4B.Reading 5760
@preaction
preaction / test.pl
Last active March 3, 2017 22:21
Render a useful JSON API error message including the exception, a stack trace, and a log
use Mojolicious::Lite;
use Log::Any qw( $LOG );
use Log::Any::Adapter;
Log::Any::Adapter->set( 'MojoLog', logger => app->log );
app->log->max_history_size( 100 );
get '/' => sub { $LOG->info( "LOG::ANY IS AMAZING" ); die "This should di... ALL GLORY TO THE HYPNOTOAD!\n" };
mounted: function () {
var self = this;
/* Initialize state popover. We do this here in the constructor so
* we can initialize and still have a reference to the Vue component
* (self) to get information from
*/
var popover = $( this.$el ).find( '[data-toggle="popover"].bmc_state' );
popover.popover({
placement: "auto right",

I need to test a UI for a REST JSON API. I don't want to set up a database. I can't set up the dozens of remote machines that my UI interacts with each with different hardware and revealing different potential problems in my code. So I need a mock API that can test my UI without actually doing anything.

So let's set up a simple Mojolicious::Lite app that responds to a request with a JSON response.

XXX Example of single route

But, since we're an AJAX API, we need to explicitly allow cross browser requests:

XXX Cross browser things

@preaction
preaction / ua.pl
Last active February 9, 2017 23:24
use Mojo::Base -strict;
use Mojo::UserAgent;
use Mojo::IOLoop::Server;
my $JOBS = 5; # Keep this many requests in-flight
my @URLS = qw(
http://google.com http://google.com http://google.com http://google.com
http://google.com http://google.com http://google.com http://google.com
http://google.com http://google.com http://google.com http://google.com