This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import re | |
import datetime | |
try: | |
import httplib # Python 2.7 | |
except ImportError: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import random | |
def quebra(dados, espacos = 0, tamanho = 79): | |
saida = [''] | |
limite = tamanho - espacos | |
for d in dados: | |
r = '\'\\"\'' if d == '"' else repr(d) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import gi | |
gi.require_version('Gst', '1.0') | |
gi.require_version('GstVideo', '1.0') | |
gi.require_version('Gtk', '3.0') | |
from gi.repository import GObject, Gst, Gtk | |
# Needed for window.get_xid(), xvimagesink.set_window_handle(), respectively: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
from __future__ import print_function | |
import numpy | |
# Teorema de Laplace | |
# Pegando sempre a primeira linha, i = 0 | |
# Cofator: (-1)^(i+j) * MC_ij |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
from __future__ import division, print_function | |
import numpy | |
import time | |
linhas = 20 | |
colunas = 20 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Compatibilidade para divisão inteira // entre Python 2 e 3 | |
from __future__ import division | |
import pprint | |
import timeit | |
from collections import deque | |
def somar_digitos_v1(number, base=10): | |
assert number >= 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
def num2mask(num): | |
return str(32-(len(bin(int(num)))-3)) # str(bin(2**32-int(num)).count('1')) | |
def ip2num(ip): | |
if '/' in ip: | |
ip = ip.split('/')[0] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import lxml.etree | |
import xmlsec | |
import urllib2 | |
############################################################################### | |
# Ajustes para NFe | |
############################################################################### |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/env python | |
# -*- coding: utf-8 -*- | |
# Para o print funcionar no Python 2 e 3 | |
from __future__ import print_function | |
# Importa Gtk versão 3, senão possível tenta versão 2 | |
try: | |
import gi | |
gi.require_version('Gtk', '3.0') |