Skip to content

Instantly share code, notes, and snippets.

Pedro Melo melo

View GitHub Profile
melo /
Created Mar 12, 2018 — forked from DaveMessina/
git-find-blob: pass a blob SHA1 and find commits which contain it
use 5.008;
use strict;
use Memoize;
# by Aristotle Pagaltzis <>
# taken from thread
# on 6 june 2010
my $usage =
melo /
Last active Mar 12, 2018
Improvements on ULID generation (perl)
package ULID;
use strict;
use warnings;
use Exporter;
use Crypt::PRNG 'random_bytes';
use Time::HiRes 'time';
use bytes;
our @ISA = qw( Exporter );
melo /
Last active Jul 7, 2017
Perl setup
package MyClass;
use MySetup;
use Function::Parameters ();
use Moo ();
use namespace::sweep ();
use Scalar::Util ();
use Try::Tiny ();
use Import::Into;
melo / git-build
Created Dec 6, 2016
Trigger a Gitlab CI build with 'git build'
View git-build
project_id=`git config gitlab.project-id`
if [ -z "$project_id" ] ; then
echo "FATAL: could not find gitlab.project-id on your config"
echo "To fix: use 'git config gitlab.project-id ID'"
echo " find the project ID in the Settings > Triggers page,"
echo " in the examples, it is the number in the URL"
exit 1
melo / cpanfile
Last active Dec 2, 2016
Benchmark ZADD's over the network to a low-powered server
View cpanfile
# Use `carton install` to install these deps
requires 'Redis::Fast';
requires 'Data::UUID::LibUUID';
requires 'Time::HiRes';
View Dockerfile
FROM perl
ENTRYPOINT ["carton", "exec"]
RUN cpanm -n Carton
COPY tarball.tgz /perl
RUN cd /perl && tar zxf tarball.tgz && carton install --deployment

Keybase proof

I hereby claim:

  • I am melo on github.
  • I am 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:

melo /
Created Aug 3, 2016
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 / gist:64e10f195834b20a0085f26315abcbe6
Created Aug 2, 2016
Hugo not that fast, or I need a new Mac
View gist:64e10f195834b20a0085f26315abcbe6
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 /
Last active Apr 20, 2017
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
$ aws elasticbeanstalk describe-environments --environment-name $env_name
You can’t perform that action at this time.