Skip to content

Instantly share code, notes, and snippets.

View avargas's full-sized avatar

Angelo Vargas avargas

View GitHub Profile
@avargas
avargas / gist:1004594
Created June 2, 2011 14:54
PHP Memcached failover
<?php
$mem = new Memcached("pool");
$mem->setOption(Memcached::OPT_BINARY_PROTOCOL, true);
$mem->setOption(Memcached::OPT_DISTRIBUTION, Memcached::DISTRIBUTION_CONSISTENT);
$mem->setOption(Memcached::OPT_LIBKETAMA_COMPATIBLE, true);
$mem->setOption(Memcached::OPT_NO_BLOCK, true);
$mem->setOption(Memcached::OPT_SERVER_FAILURE_LIMIT, 1);
$mem->setOption(Memcached::OPT_RETRY_TIMEOUT, 30);
$mem->setOption(29, 2);
@avargas
avargas / gist:963972
Created May 10, 2011 05:54
git push current branch only to it's origin
git push branch HEAD:master
find src/ -type f -name *.php -exec sed -i 's/ *$//' '{}' ';'
KEY=ABC123456
gpg --keyserver subkeys.pgp.net --recv $KEY
gpg --export --armor $KEY | sudo apt-key add -