Skip to content

Instantly share code, notes, and snippets.

View santagada's full-sized avatar

Leonardo Santagada santagada

  • Guerrilla Games
  • Amsterdam
View GitHub Profile
@santagada
santagada / gist:3080729
Created July 10, 2012 03:11
função de digito verificador
from itertools import cycle
class A(object):
def nfe_digito_verificador(self, key):
numeros = reversed(map(int, key))
soma = sum(n * m for n, m in zip(numeros, cycle(range(2,10))))
resto = soma % 11
if resto < 2:
BZR_SRC_LOC = "lp:openobject-server/6.1 server\n\
lp:trunk addons-pr\n\
lp:localiz/6.1 localization\n\
lp:openobject-addons/6.1 addons\n\
lp:openobject-addons/extra-trunk addons-extra\n\
lp:openerp-web/6.1 web\n"
BZR_SRC_DIRS = $(shell echo -e $(BZR_SRC_LOC)|cut -d " " -f 3)
@santagada
santagada / convert_with_sync.sh
Created December 15, 2010 21:48
convert a google code svn repository but first svnsync it, so you can try the conversion again and easily convert the wiki later. It is way faster too.
#!/bin/sh
set -u
set -e
svnadmin create svn-mirror
echo "#!/bin/sh" > svn-mirror/hooks/pre-revprop-change
echo "exit 0" >> svn-mirror/hooks/pre-revprop-change
chmod +x svn-mirror/hooks/pre-revprop-change
svnsync init file://`pwd`/svn-mirror http://$1.googlecode.com/svn
svnsync sync file://`pwd`/svn-mirror
hg convert file://`pwd`/svn-mirror hg-mirror
(function(){return 2*3;}).toString() === (function(){return 6;}).toString(); // true in FF & Opera, false in IE & WebKit, because Opera don't put the actual code of the function on the string and FF optimizes the source to be the same.