Skip to content

Instantly share code, notes, and snippets.

View leejo's full-sized avatar
🏂

Lee J leejo

🏂
View GitHub Profile
@leejo
leejo / bof
Created February 5, 2015 13:41
bug or feature
[leejohnson@lees-macbook-air J0 C10206 14:40:37 * lee/make_this_work]
*/Users/leejohnson/working/mojolicious-plugin-oauth2-server/examples > perl -E 'my @array = (); say shift(@array)'
[leejohnson@lees-macbook-air J0 C10207 14:41:36 * lee/make_this_work]
*/Users/leejohnson/working/mojolicious-plugin-oauth2-server/examples > perl -E 'my @array = (); say shift(())'
Not an ARRAY reference at -e line 1.
@leejo
leejo / dnytp5.21.8
Created January 21, 2015 11:21
cpanm log output with Devel::NYTProf (perl 5.21.8)
cpanm (App::cpanminus) 1.7001 on perl 5.021008 built for darwin-2level
Work directory is /Users/leejohnson/.cpanm/work/1421839145.42553
You have make /usr/bin/make
You have /opt/local/bin/wget
You have /usr/bin/tar: bsdtar 2.8.3 - libarchive 2.8.3
You have /usr/bin/unzip
Searching Devel::NYTProf on cpanmetadb ...
--> Working on Devel::NYTProf
Fetching http://www.cpan.org/authors/id/T/TI/TIMB/Devel-NYTProf-5.06.tar.gz
-> OK
@leejo
leejo / gist:b24ddb077b8b226569f7
Created September 23, 2014 12:02
Mojolicious TT Renderer Config
116 my $renderer = Mojolicious::Plugin::TtRenderer::Engine->build(
117 mojo => $self,
118 template_options => {
119 INTERPOLATE => 0,
120 RELATIVE => 1,
121 ABSOLUTE => 1,
122 COMPILE_DIR => $compile_dir,
123 COMPILE_EXT => $compile_ext,
124 INCLUDE_PATH => [ qw/
125 templates
I have bigballofmud.pl that calls (requires) many littleballsofmud.pl,
none of which use strict and have many globals (there is no way i can
add use strict to any of these... yet). I want to add a new littleballofmud.pl,
but of course want to use strict. I still need to access the global
vars from bigballofmud.pl (and again, can't modify it to pass args)
but want littleballofmud.pl to be testable outside of bigballofmud.pl
under full strict *not* using globals.
My solution is this in littleballofmud.pl:
if [type] == "syslog" {
grok {
match => {
message => "%{SYSLOGTIMESTAMP:timestamp} %{SYSLOGHOST:hostname} (%{SYSLOGHOST:remote} )?%{DATA:program}(?:\[%{POSINT:pid}\])?: (%{YEAR}/%{MONTHNUM}/%{MONTHDAY} %{TIME} )?%{GREEDYDATA:message_no_ts}"
}
add_tag => [ "%{[tag]}","syslog","%{[program]}" ]
}
date {
# we use the value of timestamp in the @timestamp field
match => [ "timestamp","MMM dd HH:mm:ss","MMM d HH:mm:ss" ]