Skip to content

Instantly share code, notes, and snippets.

View exodist's full-sized avatar

Chad Granum exodist

View GitHub Profile
@exodist
exodist / gist:ef08a3c406d98c1bb618
Last active August 29, 2015 14:20
smallest mongo+test-simple script
use strict;
use warnings;
use Test::More 'no_plan';
use MongoDB::Timestamp; # needed if db is being run as master
use MongoDB;
use lib "t/lib";
use MongoDBTest qw/build_client get_test_db/;
$ perl -V [~/MongoDB-v0.708.0.0]
Summary of my perl5 (revision 5 version 20 subversion 2) configuration:
Platform:
osname=linux, osvers=3.13.0-44-generic, archname=x86_64-linux-thread-multi
uname='linux work 3.13.0-44-generic #73-ubuntu smp tue dec 16 00:22:43 utc 2014 x86_64 x86_64 x86_64 gnulinux '
config_args='-de -Dprefix=/home/exodist/perl5/perlbrew/perls/mongo -Dusethreads -Aeval:scriptdir=/home/exodist/perl5/perlbrew/perls/mongo/bin'
hint=recommended, useposix=true, d_sigaction=define
useithreads=define, usemultiplicity=define
use64bitint=define, use64bitall=define, uselongdouble=undef
my $iapp = Plack::App::WrapCGI->new(script => "$path/$cgi")->to_app;
my $app = sub {
my $env = shift;
return [
'404',
['Content-Type' => 'text/plain'],
["404 error\n"]
] unless -e $self->path . $env->{PATH_INFO};
exodist@Work $ git status (blead)[~/projects/perl]
On branch blead
Your branch is ahead of 'origin/blead' by 1 commit.
(use "git push" to publish your local commits)
nothing to commit, working directory clean
@exodist
exodist / gist:994205516e2d9f3a5e3f
Last active August 29, 2015 14:19
perl-blead timings
Test::Stream:
Elapsed: 976 sec
u=8.72 s=2.22 cu=606.88 cs=52.03 scripts=2347 tests=711443
Legacy:
Elapsed: 986 sec
u=8.36 s=2.47 cu=551.54 cs=46.54 scripts=2296 tests=720367
<VirtualHost *:443>
ServerName uebernet-plack.testdomain.com
ServerAlias *
ServerAdmin [email protected]
DocumentRoot /ndn/web/uebernet
ErrorLog /var/log/apache2/uebernet.https/error.log
CustomLog /var/log/apache2/uebernet.https/access.log combined
:map <F9> :w<cr>:! PERL5LIB="" /usr/bin/prove -v -Ilib -I/home/cgranum/ndn/perl %<CR>
:imap <F9> <ESC>:w<cr>:! PERL5LIB="" /usr/bin/prove -v -Ilib -I/home/cgranum/ndn/perl %<CR>
:map <F10> :w<cr>:! PERL5LIB="" /opt/plack/perl/bin/prove -v -Ilib -I/home/cgranum/ndn/perl %<CR>
:imap <F10> <ESC>:w<cr>:! PERL5LIB="" /opt/plack/perl/bin/prove -v -Ilib -I/home/cgranum/ndn/perl %<CR>
function! RunFennecLine()
let cur_line = line(".")
exe "!FENNEC_TEST='" . cur_line . "' prove -v -Ilib -I. -I/home/cgranum/ndn/perl %"
endfunction
@exodist
exodist / gist:5b0b9b21cfeda4323937
Last active August 29, 2015 14:11
Test::SkipWithout
package Test::SkipWithout;
use strict;
use warnings;
require Test::More;
sub import {
my $class = shift;
my ($module, $version) = @_;
use strict;
use warnings;
BEGIN {
if( $ENV{PERL_CORE} ) {
chdir 't';
@INC = '../lib';
}
}
@exodist
exodist / fork code
Created September 13, 2014 03:09
fork code
sub use_fork {
require Storable;
my ($r, $w);
pipe($r, $w) || confess "Could not open pipe! $!";
$_[0]->[_USE_FORK] ||= [$r, $w];
return 1;
}