Skip to content

Instantly share code, notes, and snippets.

@vitalbh
vitalbh / lint_json.sh
Created October 15, 2015 14:30 — forked from nstielau/lint_json.sh
A one-liner for validating json
# Lint JSON with python (the exit 255 stops xargs after the first failed command)
find . -name "*.json" -print | xargs -Ixx bash -c "echo JSON linting xx 1>&2; cat xx | python -mjson.tool > /dev/null || exit 255"
@vitalbh
vitalbh / XGH - PT-BR.txt
Last active August 29, 2015 14:26 — forked from banaslee/XGH - en.txt
eXtreme Go-Horse Process
Fonte: http://gohorseprocess.wordpress.com
1- Pensou, não é XGH.
XGH não pensa, faz a primeira coisa que vem à mente. Não existe
segunda opção, a única opção é a mais rápida.
2- Existem 3 formas de se resolver um problema, a correta, a errada e
a XGH, que é igual à errada, só que mais rápida.
@vitalbh
vitalbh / gist:9489144
Created March 11, 2014 16:15
Filtrando resultados no gdata para mobile (controles de acesso conhecidos)
//http://gdata.youtube.com/feeds/mobile/videos/?category=Music&alt=json-in-script&callback=?&orderby=relevance&start-index=" + inicio + "&max-results=" + num_resultados + "&q=
//Gdata para mobile
for (var i = 0; i < entries.length; i++) {
var entry = entries[i];
var embed = true;
for (a in entry.yt$accessControl) {
if (entry.yt$accessControl[a].action == 'embed' && entry.yt$accessControl[a].permission == 'denied')
embed = false;
}
# Send a metric to statsd from bash
#
# Useful for:
# deploy scripts (http://codeascraft.etsy.com/2010/12/08/track-every-release/)
# init scripts
# sending metrics via crontab one-liners
# sprinkling in existing bash scripts.
#
# netcat options:
# -w timeout If a connection and stdin are idle for more than timeout seconds, then the connection is silently closed.
@vitalbh
vitalbh / fonts
Last active February 8, 2016 14:24
Fonts - mime types, gzip and font-face crossdomain bug on firefox
/etc/nginx/mime.types
remove eot (defaults to application/octet-stream).
font/ttf ttf;
font/opentype otf;
application/font-woff woff;
application/vnd.ms-fontobject eot;

Contract Killer 3

Revised date: 07/11/2012

Between us [company name] and you [customer name]

Summary:

We’ll always do our best to fulfil your needs and meet your expectations, but it’s important to have things written down so that we both know what’s what, who should do what and when, and what will happen if something goes wrong. In this contract you won’t find any complicated legal terms or long passages of unreadable text. We’ve no desire to trick you into signing something that you might later regret. What we do want is what’s best for both parties, now and in the future.

@vitalbh
vitalbh / mkdir_recursive.sh
Created September 9, 2013 19:14
Cria arvore de pastas com 4 níveis( 0 - 9 - a - f )
mkdir -p {{0..9},{a..f}}/{{0..9},{a..f}}/{{0..9},{a..f}}/{{0..9},{a..f}}
@vitalbh
vitalbh / Vagrantfile
Last active December 22, 2015 10:59
bootstrap vagrant
Vagrant.configure("2") do |config|
config.vm.box = "precise64"
config.vm.box_url = "http://files.vagrantup.com/precise64.box"
config.vm.network :forwarded_port, guest: 80, host: 8081
config.vm.provision :shell, :path => "provision/shell/bootstrap.sh"
# TODO: fix this hack that ensures 'apt-get update' runs before mysql
# is provisioned with puppet
config.vm.provision :shell, :inline => "apt-get update --fix-missing"
@vitalbh
vitalbh / gist:3420392
Created August 21, 2012 23:22 — forked from douglasmiranda/gist:2555156
Solução para instalar lxml no ubuntu com sucesso =] ( erro em pip install lxml )
#Se o erro for algo parecido com isto:
#building 'lxml.etree' extension
#gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c src/lxml/lxml.etree.c -o build/temp.linux-x86_64-2.7/src/lxml/lxml.etree.o -w
#In file included from src/lxml/lxml.etree.c:239:0:
#src/lxml/etree_defs.h:9:31: erro fatal: libxml/xmlversion.h: Arquivo ou diretório não encontrado
#compilação terminada.
#error: command 'gcc' failed with exit status 1
#basta instalar libxml2-dev e libxslt-dev
@vitalbh
vitalbh / ordenação alfabeto definido
Created January 27, 2012 16:47
python sorting - organizando uma lista em uma ordem alfabética pré-definida
alfabeto = "zyxwvutsrqpomnlkjihgfedcba"
s = ['asdf', 'werwer', 'asgfd','wesasd','yasdfas','zsadf']
print sorted(s, key=lambda w: [alfabeto.index(i) for i in w])