Skip to content

Instantly share code, notes, and snippets.

View melo's full-sized avatar

Pedro Melo melo

View GitHub Profile
@melo
melo / moose_attr_traits.pl
Created December 23, 2010 16:35
How to use Moose attribute traits
##################
# Error management
has 'errors' => (
traits => ['Hash'],
is => 'bare',
isa => 'HashRef',
default => sub { {} },
handles => {
add_error => 'set',
@melo
melo / gist:767856
Created January 6, 2011 13:03
strange problem with confess()
#
# Edited Class::MOP to this, around line 120:
catch {
unless (/^Can't locate \Q$file\E in \@INC/) {
# uncomment next line to temporarily work-around the problem
# s/ at / AT /gsm;
print "\n\n-------\n$_\n\n---------\n\n";
confess "Couldn't load class ($name) because: $_";
@melo
melo / perl_smoker
Created February 5, 2011 11:47
Script to use with Jenkins to smoke a Perl module
#!/bin/sh
#
# Use this as Jenkins Build "Execute shell" script
#
# Pedro Melo <melo@simplicidade.org>
## Die on any errors
set -ex
export OUTPUT=$WORKSPACE/logs
HTTP (Starman) vs FastCGI (fastpass)
HTTP
Pros:
HTTP, easy for humans to debug
Also works directly behind load-balancers (without frontends)
Many PSGI server implementations, preforking Starman, Starlet and non-blocking Twiggy
Cons:
@melo
melo / TLS.pm
Last active February 22, 2017 15:32
Package MIME::Lite::TLS - **DEPRECATED** - look at Net::SMTPS at https://metacpan.org/release/Net-SMTPS
package MIME::Lite::TLS;
use strict;
use warnings;
use Net::SMTP::TLS;
use parent 'MIME::Lite';
=head1 NAME
@melo
melo / stacktrace.txt
Created September 16, 2011 10:33
Divvy console error messages
9/16/11 11:32:07 AM com.apple.launchd[139] ([0x0-0x64f64f].com.mizage.divvy[87769]) Exited abnormally: Trace/BPT trap
9/16/11 11:32:27 AM Divvy[87780] *** -[NSBundle URLForResource:withExtension:]: unrecognized selector sent to instance 0x30e7b0
9/16/11 11:32:27 AM Divvy[87780] An uncaught exception was raised
9/16/11 11:32:27 AM Divvy[87780] *** -[NSBundle URLForResource:withExtension:]: unrecognized selector sent to instance 0x30e7b0
9/16/11 11:32:27 AM Divvy[87780] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSBundle URLForResource:withExtension:]: unrecognized selector sent to instance 0x30e7b0'
9/16/11 11:32:27 AM Divvy[87780] Stack: (
2497023979,
2493496891,
2497053162,
@melo
melo / gist:1286900
Created October 14, 2011 11:57
Work around bad choice for Apache::SizeLimit::Core policy on old CentOS
use Apache::SizeLimit;
BEGIN {
### Don't try this at home kids...
# this version of CentOS is too old, no read-access to
# /proc/self/smaps unless you are root
no warnings;
$Apache::SizeLimit::Core::USE_SMAPS = 0;
*Apache::SizeLimit::Core::_platform_check_size =
\&Apache::SizeLimit::Core::_linux_size_check;
@melo
melo / watchdog.pl
Created October 14, 2011 16:31
My simple watchdog
#!/usr/bin/env perl
use strict;
use warnings;
use AnyEvent;
use AnyEvent::WebService::Notifo;
use Sys::Hostname;
### Use your Notifo.com info here
my $api_key = '';
@melo
melo / redis_cluster_notes.mmd
Created October 18, 2011 11:19
Notes about the Redis Cluster specification
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@melo
melo / log
Created October 19, 2011 10:44
Debian 6
root@vs0303:~# apt-get install curl
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
ca-certificates libcurl3
The following NEW packages will be installed:
ca-certificates curl libcurl3
0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 660 kB of archives.