Skip to content

Instantly share code, notes, and snippets.

View melo's full-sized avatar

Pedro Melo melo

View GitHub Profile
@melo
melo / Where does perl come from?
Created February 27, 2012 15:03
perl on CentOS
# rpm -qf /usr/bin/perl
perl-5.10.1-119.el6_1.1.i686
diff --git a/t/20-how-crud-of-you.t b/t/lib/HowCrudOfYou.pm
similarity index 99%
rename from t/20-how-crud-of-you.t
rename to t/lib/HowCrudOfYou.pm
index dd81086..e8b994c 100644
--- a/t/20-how-crud-of-you.t
+++ b/t/lib/HowCrudOfYou.pm
@melo
melo / snippet.pl
Created October 28, 2011 14:49
My tweaks to Test::More::subtest
sub tests {
my ($name, $subtests) = @_;
return if $ENV{SUBTEST_FOCUS} && $name !~ /$ENV{SUBTEST_FOCUS}/;
diag("Running '$name'");
return Test::More->builder->subtest(@_);
}
@melo
melo / .bash_prompt
Created October 22, 2011 21:44
uber git PS1
#!/bin/bash
#
# PS1 magic
#
# Mostly copied from YUVAL KOGMAN version, added my own __git_ps1 stuff
# Original: http://gist.github.com/621452
#
# See video demo of this at http://vimeo.com/15789794
#
# To enable save as .bash_prompt in $HOME and add to .bashrc:
@melo
melo / delegation.pl
Created October 21, 2011 16:41
Create delegations dynamically on roles
package DB;
use Moose;
sub create {
use Data::Dump qw(pp); print STDERR ">>>>>> ", pp(@_), "\n";
}
package Role;
@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.
@melo
melo / redis_cluster_notes.mmd
Created October 18, 2011 11:19
Notes about the Redis Cluster specification
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@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 / 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 / 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,