Skip to content

Instantly share code, notes, and snippets.

View exodist's full-sized avatar

Chad Granum exodist

View GitHub Profile
@exodist
exodist / test.pl
Last active August 10, 2016 20:46
use strict;
use warnings;
{
package Ndn::Widget;
sub fob_id { '1' }
sub Fob {
my $self = shift;
sub foo(&) {
my $code = shift;
my @got = $code->();
die "codeblock returned stuff, it should not" if @got;
}
sub blah {
return 1 if defined wantarray;
return;
}
t/external/ocsp.t ................. # tcp connect to www.microsoft.com:443 ok
# fingerprint matches
# validation with default CA w/o OCSP ok
t/external/ocsp.t ................. 1/3
# Failed test 'did not get expected OCSP response with stapling'
# at t/external/ocsp.t line 93.
# tcp connect to www.spiegel.de:443 ok
# fingerprint matches
# validation with default CA w/o OCSP ok
# validation with default CA with OCSP defaults ok
@exodist
exodist / test.pl
Created November 6, 2016 21:28
Data from subtest into parent
use Test2::Bundle::Extended;
use Test2::Tools::AsyncSubtest qw/fork_subtest/;
use Test2::API qw/test2_stack/;
# This is a custom event meant to transport our data.
{
package Test2::Event::MyData;
use base 'Test2::Event';
use Test2::Util::HashBase qw/mydata/;
sub no_display { 1 }
./miniperl -Ilib make_ext.pl lib/auto/Time/HiRes/HiRes.so MAKE="make" LIBPERL_A=libperl.a LINKTYPE=dynamic
Makefile.PL: The "xdefine" exists, skipping the configure step.
("/home/exodist/projects/perl/miniperl Makefile.PL --configure" to force the configure step)
Warning: No Makefile!
make[1]: Entering directory '/home/exodist/projects/perl/dist/Time-HiRes'
make[1]: *** No rule to make target 'all'. Stop.
make[1]: Leaving directory '/home/exodist/projects/perl/dist/Time-HiRes'
make[1]: Entering directory '/home/exodist/projects/perl/dist/Time-HiRes'
make[1]: *** No rule to make target 'all'. Stop.
make[1]: Leaving directory '/home/exodist/projects/perl/dist/Time-HiRes'
while (my $file = readdir($PSGI_DIR)) {
next if $file eq 'dev_dev.psgi';
next if $file =~ m/mock/i;
next unless $file =~ m/^(.*)_dev\.psgi$/;
my $name = $1;
local $@;
$APPS{$name} = eval "package $name; do '$PATH/$file'"
or print STDERR "Failed to load $file: $@";
use Test2::Bundle::Extended;
subtest foo => sub {
ok(1);
subtest bar => sub {
ok(1);
subtest baz => sub {
ok(1);
bail_out "xx";
}
@exodist
exodist / test.pl
Created May 3, 2017 17:21
test.pl
use strict;
use warnings;
use Test::More;
use Test2::API qw/context/;
my @tasks;
sub enqueue(&) {
my $ctx = context(); # Gets the context created by 'is_later'
# Snapshot is safe to pass around, unlike the actual context.
@exodist
exodist / DepTracer.pm
Last active October 13, 2017 17:25
DepTracer
package DepTracer;
use strict;
use warnings;
use Object::HashBase qw/
-_on
-exclude
-dep_map
-loaded
-my_require
@exodist
exodist / fix.pl
Created January 24, 2018 22:40
fix a stamp for postgres
sub format_stamp {
my $stamp = shift;
return undef unless $stamp;
my $out = DateTime->from_epoch(epoch => $stamp)->stringify;
$out .= $1 if sprintf("%.10f", $stamp) =~ m/(\.\d+)$/;
return $out;
}