Skip to content

Instantly share code, notes, and snippets.

View melo's full-sized avatar

Pedro Melo melo

View GitHub Profile
@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 =
@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 / gist:4484184
Last active December 10, 2015 19:48 — forked from anonymous/gist:4484023
use strict;
use Test::More;
use Test::TCP;
use Proc::Guard ();
use ZMQ::LibZMQ3;
use ZMQ::Constants ':all';
sub start_proxy {
my @ports = map { Test::TCP::empty_port() } 1..3;
HTTP (Starman) vs FastCGI (fastpass)
HTTP
Pros:
HTTP, easy for humans to debug
Also works directly behind load-balancers (without frontends)
Many PSGI server implementations, preforking Starman, Starlet and non-blocking Twiggy
Cons:
@melo
melo / gist:305397
Created February 16, 2010 08:47 — forked from cpinto/gist:305094
Keep most recent but don't delete original option
<body>
<select id="teste">
<option>item 1</option>
<option>item 2</option>
<option>item 3</option>
<option>item 4</option>
</select>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">
$(document).ready(function()