Skip to content

Instantly share code, notes, and snippets.

Pedro Melo melo

View GitHub Profile
@melo
melo / git-find-blob.pl
Created Mar 12, 2018 — forked from DaveMessina/git-find-blob.pl
git-find-blob: pass a blob SHA1 and find commits which contain it
View git-find-blob.pl
#!/usr/bin/perl
use 5.008;
use strict;
use Memoize;
# by Aristotle Pagaltzis <http://stackoverflow.com/users/9410/aristotle-pagaltzis>
# taken from thread http://stackoverflow.com/questions/223678/git-which-commit-has-this-blob
# on 6 june 2010
my $usage =
@melo
melo / ULID.pm
Last active Mar 12, 2018
Improvements on ULID generation (perl)
View ULID.pm
package ULID;
use strict;
use warnings;
use Exporter;
use Crypt::PRNG 'random_bytes';
use Time::HiRes 'time';
use bytes;
our @ISA = qw( Exporter );
@melo
melo / MyClass.pm
Last active Jul 7, 2017
Perl setup
View MyClass.pm
package MyClass;
use MySetup;
use Function::Parameters ();
use Moo ();
use namespace::sweep ();
use Scalar::Util ();
use Try::Tiny ();
use Import::Into;
@melo
melo / git-build
Created Dec 6, 2016
Trigger a Gitlab CI build with 'git build'
View git-build
#!/bin/sh
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
fi
@melo
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
WORKDIR /perl
ENTRYPOINT ["carton", "exec"]
RUN cpanm -n Carton
COPY tarball.tgz /perl
RUN cd /perl && tar zxf tarball.tgz && carton install --deployment
View 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:

@melo
melo / sanity.pl
Created Aug 3, 2016
Carton local dir inspection tool
View sanity.pl
#!/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 / 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
melo / aws.md
Last active Apr 20, 2017
AWS ElasticBeanstalk inconsistency...
View aws.md

** 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
You can’t perform that action at this time.