Skip to content

Instantly share code, notes, and snippets.

Avatar

Grant McLean grantm

View GitHub Profile
@grantm
grantm / start-es.sh
Created Aug 1, 2012
Launch ES with ulimit raise for more filehandles
View start-es.sh
#!/bin/bash
ES_BINARY=/home/grant/elasticsearch-0.18.7/bin/elasticsearch
if [ -z "$1" ]
then
sudo $0 as-root $USER
stty sane
elif [ "$1" = "as-root" ]
then
@grantm
grantm / gist:3104491
Created Jul 13, 2012
Test failure installing Pithub from CPAN
View gist:3104491
$ make test
PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t t/live/*.t
t/basic.t ............... 1/?
# Failed test 'use Pithub;'
# at t/basic.t line 8.
# Tried to use 'Pithub'.
# Error: Invalid default 0 at /usr/local/share/perl/5.10.1/Method/Generate/Accessor.pm line 49.
# Compilation failed in require at /home/grant/.cpan/build/Pithub-0.01012-akcvbg/blib/lib/Pithub/Base.pm line 14.
# BEGIN failed--compilation aborted at /home/grant/.cpan/build/Pithub-0.01012-akcvbg/blib/lib/Pithub/Base.pm line 14.
# Compilation failed in require at /usr/local/share/perl/5.10.1/Module/Runtime.pm line 317.
@grantm
grantm / tap.log
Created Mar 25, 2012
cpan-api failed test output
View tap.log
cpan-api$ prove -lv t/release/multiple-modules.t
t/release/multiple-modules.t ..
ok 1 - name ok
ok 2 - author ok
not ok 3 - Release is not first
# Failed test 'Release is not first'
# at t/release/multiple-modules.t line 19.
ok 4 - includes three files with modules
ok 5 - file name
View ChartImage.pm
# A quick hack for demoing using App::p to produce graphs from the command-line
# using Perl 1-liners.
#
# E.g.: to look through an Apache access log file and produce a bar graph of
# requests by hour of the day (00-23):
#
# p -nE 'm{/2012:(\d\d)} && $tally{$1}++ }{ S ChartImage->bar_url(data => \%tally, size => "700x300")' access.log
#
# Use it, copy it, sell it, claim it as your own - I don't care :-)
#
View gist:474760
diff --git a/lib/Plack/Runner.pm b/lib/Plack/Runner.pm
index de83a23..70b58b6 100644
--- a/lib/Plack/Runner.pm
+++ b/lib/Plack/Runner.pm
@@ -50,6 +50,7 @@ sub parse_options {
'r|reload' => sub { $self->{loader} = "Restarter" },
'R|Reload=s' => sub { $self->{loader} = "Restarter"; $self->loader->watch(split ",", $_[1]) },
'L|loader=s' => \$self->{loader},
+ "access-log=s" => \$self->{access_log},
"h|help" => \$self->{help},
View gist:465025
diff --git a/lib/Starman/Server.pm b/lib/Starman/Server.pm
index bf11ed4..6f51cb8 100644
--- a/lib/Starman/Server.pm
+++ b/lib/Starman/Server.pm
@@ -31,6 +31,9 @@ sub run {
if ( $options->{pid} ) {
$extra{pid_file} = $options->{pid};
}
+ if ( $options->{log_file} ) {
+ $extra{log_file} = $options->{log_file};