Skip to content

Instantly share code, notes, and snippets.

package Local::Format;
BEGIN { $INC{'Local/Format.pm'} = __FILE__ };
sub new {
my ( $class, %opt ) = @_;
$opt{delimiter} ||= ',';
return bless \%opt, $class;
}
package Local::Format::csv;
### -- 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
<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" />
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";
127.0.0.1:6379> hget ticket:1949250 _request_timestamp
"1516910939"
127.0.0.1:6379> multi
OK
127.0.0.1:6379> watch ticket:1949250
(error) ERR WATCH inside MULTI is not allowed
127.0.0.1:6379> discard
OK
127.0.0.1:6379> watch ticket:1949250
OK
@preaction
preaction / inc10.js
Last active January 5, 2018 22:57 — forked from DLSteve/inc10.js
Increment Every 10
var nodes = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 ];
for (var i = 0; i < nodes.length; i+=10) {
for ( var j = 0; j < 10 && i+j < nodes.length; j++ ) {
console.log( 'i:' + i + ' j:' + j + ' i+j:' + ( i + j ) );
}
}
@preaction
preaction / test.pl
Last active December 19, 2017 20:54
use Mojolicious::Lite;
use Mojo::Asset::File;
use Alien::SwaggerUI;
use File::Spec::Functions qw( catfile );
get '/docs/*path' => { path => 'index.html' }, sub {
my ( $c ) = @_;
# Redirect so that trailing / helps browser build URLs and
# we have our spec loaded. Can't make its own route because
# the trailing `/` is optional in Mojolicious's route
mysql> select * from release_summary where uploadid = 257874;
+-------------------------------------+---------+----------+--------------------------------------+--------+---------+---------+---------+------+------+------+---------+----------+
| dist | version | id | guid | oncpan | distmat | perlmat | patched | pass | fail | na | unknown | uploadid |
+-------------------------------------+---------+----------+--------------------------------------+--------+---------+---------+---------+------+------+------+---------+----------+
| Log-Dispatch-Scribe | 0.05 | 72845160 | 871570d0-72d6-11e6-87fd-ef1f6f1c15c2 | 1 | 1 | 2 | 1 | 11 | 9 | 0 | 0 | 257874 |
| CMS-Drupal-Modules-MembershipEntity | 0.96 | 67390109 | 5ddb7101-6c0c-1014-839c-59612b99e85d | 1 | 1 | 2 | 1 | 5 | 0 | 0 | 0 | 257874 |
+-------------------------------------+---------+--------
@preaction
preaction / output.txt
Created November 20, 2017 05:58
Output of cpan/DB_File/t/db-hash.t
$ ./perl -I. -MTestInit cpan/DB_File/t/db-hash.t
Use of uninitialized value $value in string eq at cpan/DB_File/t/db-hash.t line 224.
Use of uninitialized value $values[0] in string eq at cpan/DB_File/t/db-hash.t line 224.
Use of uninitialized value $value in lc at cpan/DB_File/t/db-hash.t line 224.
Use of uninitialized value $h{""} in string eq at cpan/DB_File/t/db-hash.t line 243.
Use of uninitialized value in numeric eq (==) at cpan/DB_File/t/db-hash.t line 252.
Use of uninitialized value in numeric eq (==) at cpan/DB_File/t/db-hash.t line 252.
Use of uninitialized value in numeric eq (==) at cpan/DB_File/t/db-hash.t line 252.
Use of uninitialized value in numeric eq (==) at cpan/DB_File/t/db-hash.t line 252.
Use of uninitialized value in numeric eq (==) at cpan/DB_File/t/db-hash.t line 252.