Skip to content

Instantly share code, notes, and snippets.

View melo's full-sized avatar

Pedro Melo melo

View GitHub Profile
@melo
melo / .tidyallrc
Created December 16, 2014 20:59
My .tidyallrc
[PerlTidy]
select = **/*.{pl,pm,t}
[PodTidy]
argv = --column=100
select = **/*.{pm,pod}
[Perl::AlignMooseAttributes]
select = **/*.pm
my $p = path(`$FindBin::Bin/orc-project-root`);
my @cpanfiles = map { $_ = Module::CPANfile->load($_)->prereqs } _find_cpanfiles($p);
my $reqs = CPAN::Meta::Prereqs->new->with_merged_prereqs(\@cpanfiles);
sub _merge_cpanfile {
my @cpanfiles = map { $_ = Module::CPANfile->load($_)->prereqs } _find_cpanfiles($_[0]);
my $reqs = CPAN::Meta::Prereqs->new->with_merged_prereqs(\@cpanfiles);
return Module::CPANfile->from_prereqs($reqs->as_string_hash)->to_string;
}
@melo
melo / Dockerfile
Created August 14, 2015 05:00
Simple Dockerfile base for Perl project
FROM our/base
COPY *.patch /build/
## Replicate std perl image but on top of our base image
RUN cd /build \
&& mkdir src \
&& curl -SL https://cpan.metacpan.org/authors/id/S/SH/SHAY/perl-5.20.2.tar.bz2 -o perl-5.20.2.tar.bz2 \
&& echo '63126c683b4c79c35008a47d56f7beae876c569f *perl-5.20.2.tar.bz2' | sha1sum -c - \
&& tar --strip-components=1 -xjf perl-5.20.2.tar.bz2 -C src \
@melo
melo / intro.md
Last active February 18, 2016 18:02 — forked from anonymous/intro.md
Compare VPack to Sereal - *Size* only

At $work, we are looking to replace JSON encoding with another format, to increase encode/decode speed and required storage size.

Requirements, in order of importance for our use case, YMMV:

  • no schema requirement: data is JSON-compatible, deeply nested in cases, but we don't have a schema to start from;
  • smallest size: we store the objects in memory on Redis DB's, so size is the main factor;
  • fast decode: we can trade slower encode speed for size, but decode should be fast;
  • language support: stack is Perl, Go, and JavaScript. PHP is a plus, but not required.

We are testing msgpack, cbor, sereal, and others,

@melo
melo / aws.md
Last active April 20, 2017 04:15
AWS ElasticBeanstalk inconsistency...

** found it ** - I was running an old version of AWS CLI :)

I was able to create a ElasticBeanstalk environment with a EnvironmentName that is longer than what the API's allows...

I can describe the environment, but I can't find the options for it, describe-configuration-options doesn't accept --environment-id... :(

$ env_name=`aws elasticbeanstalk describe-environments --environment-id e-XXXXXXXX | jq .Environments[0].EnvironmentName`
$ echo $env_name
"XXXXXXXX-XXXXXXX-XXX-XXX"

$ aws elasticbeanstalk describe-environments --environment-name $env_name

@melo
melo / gist:64e10f195834b20a0085f26315abcbe6
Created August 2, 2016 09:55
Hugo not that fast, or I need a new Mac
Started building site
0 of 4 drafts rendered
0 future content
0 expired content
976 pages created
0 non-page files copied
700 paginator pages created
494 tags created
in 40914 ms
@melo
melo / sanity.pl
Created August 3, 2016 16:33
Carton local dir inspection tool
#!/usr/bin/env perl
#
# Checks "provides" list in install.json files with the actual files
# installed by Carton on your local dir
#
use strictures 2;
use File::Find;
use Path::Tiny;
use JSON::MaybeXS 'decode_json';
@melo
melo / keybase.md
Created September 2, 2016 22:03
keybase.md

Keybase proof

I hereby claim:

  • I am melo on github.
  • I am pedromelo (https://keybase.io/pedromelo) on keybase.
  • I have a public key whose fingerprint is C3BA 5291 133A 3116 9FB7 5DA7 6112 28B7 2371 312C

To claim this, I am signing this object:

FROM perl
WORKDIR /perl
ENTRYPOINT ["carton", "exec"]
RUN cpanm -n Carton
COPY tarball.tgz /perl
RUN cd /perl && tar zxf tarball.tgz && carton install --deployment