Skip to content

Instantly share code, notes, and snippets.

Doug Bell preaction

Block or report user

Report or block preaction

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View dependencies.pl
use v5.28;
use warnings;
use experimental qw( signatures postderef );
use version;
use Data::Printer;
use MetaCPAN::Client;
my $mcpan = MetaCPAN::Client->new;
@preaction
preaction / cpantesters-docker-compose.md
Created Jun 22, 2019
Work with the CPAN Testers docker-compose development environment
View cpantesters-docker-compose.md
@preaction
preaction / vack.bash
Created Feb 22, 2019
Useful shell functions / scripts
View vack.bash
vack() {
# Takes a keyword as an argument, acks current directory, opens a vim session
# with a tab for each file with a match found, and puts the keyword in the @/
# register, so that you can `n` through matches.
my_search=$(ack -l "$1")
if [[ -z $my_search ]]
then
echo "No results found for $1"
else
args=(--cmd "let @/=\"$1\"" -p )
View myapp.pl
package Local::Plugin::MyPlugin;
use Mojo::Base 'Mojolicious::Plugin';
sub cached_thing {
state $cache = 'expensive';
return $cache;
}
sub register {
my ( $self, $app, $conf ) = @_;
$app->helper( myplugin => sub { $self } );
}
View minion.pl
#!/usr/bin/env perl
use Mojolicious::Lite;
use Time::HiRes qw( time );
plugin Minion => {
SQLite => 'sqlite:' . app->home->child('minion.db'),
};
app->minion->add_task(
View test.pl
package Local::Controller::Kubernetes;
BEGIN { $INC{'Local/Controller/Kubernetes.pm'} = __FILE__ }
use Mojo::Base 'Mojolicious::Controller';
sub log { shift->render( text => "Hello, World" ) }
package main;
use Mojolicious::Lite;
unshift @{ app->routes->namespaces }, 'Local::Controller';
app->routes->get( '/' )->to( 'kubernetes#log' );
app->start;
View from-any.pl
package Local::Format;
BEGIN { $INC{'Local/Format.pm'} = __FILE__ };
sub new {
my ( $class, %opt ) = @_;
$opt{delimiter} ||= ',';
return bless \%opt, $class;
}
package Local::Format::csv;
View 01-before.txt
### -- Failure timeout after 60 seconds
$ curl -O http://api.cpantesters.org/v3/release
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 76 100 76 0 0 1 0 0:01:16 0:01:00 0:00:16 18
$ head -c 60 release
{ "message" :"The API is temporarily unavailable. Please try%
### -- Bypass Fastly, success in 2.5 minutes
$ curl -O http://api-3.cpantesters.org/v3/release
View gist:50d7f252e7949c9cd9ef2a197beebf36
<head>
<link rel="stylesheet" type="text/css" href="print.css" media="print" />
</head>
<!DOCTYPE html>
<html dir="ltr" lang="en-gb">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1" />
View test.pl
use v5.24;
use warnings;
my $message = 'this is a log message endofmessage;dept_id=neteng';
my $trunc = $message =~ s/\s*;?(?:[^=;\s]+=[^;=\s]+(?:[ ;]|$))+//r;
say "Message: $message";
say "Trunc: $trunc";
You can’t perform that action at this time.