Skip to content

Instantly share code, notes, and snippets.

View melo's full-sized avatar

Pedro Melo melo

View GitHub Profile
@melo
melo / cpanfile
Last active December 2, 2016 15:29
Benchmark ZADD's over the network to a low-powered server
# Use `carton install` to install these deps
requires 'Redis::Fast';
requires 'Data::UUID::LibUUID';
requires 'Time::HiRes';
@melo
melo / git-build
Created December 6, 2016 16:11
Trigger a Gitlab CI build with '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 / MyClass.pm
Last active July 7, 2017 23:36
Perl setup
package MyClass;
use MySetup;
use Function::Parameters ();
use Moo ();
use namespace::sweep ();
use Scalar::Util ();
use Try::Tiny ();
use Import::Into;
@melo
melo / ULID.pm
Last active March 12, 2018 10:10
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
melo / git-find-blob.pl
Created March 12, 2018 19:48 — forked from DaveMessina/git-find-blob.pl
git-find-blob: pass a blob SHA1 and find commits which contain it
#!/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 =