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
from __future__ import with_statement | |
from itertools import chain | |
import datetime | |
import sys | |
import warnings | |
import time | |
import logging | |
import threading | |
import time as mod_time | |
from redis._compat import (b, basestring, bytes, imap, iteritems, iterkeys, |
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
# -*- coding: utf-8 -*- | |
def decompor_decimal(num): | |
"""Decompoe um numero em sua representação decimal. """ | |
l = len(str(num)) | |
return ' + '.join([i.ljust(l - b, '0') for b, i in enumerate(str(num))]) | |
print(decompor_decimal(32477)) |
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
# -*- coding: utf-8 -*- | |
def notas_total(valor): | |
notas = [100, 50, 20, 10, 5, 2, 1] | |
totais = [] | |
for idx, nota in enumerate(notas): | |
totais.append(0) | |
if valor > nota: | |
totais[idx] = int(valor / nota) | |
valor -= totais[idx] * nota |
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
# -*- coding: utf-8 -*- | |
import timeit | |
ncache = 0 | |
cache = {} | |
def partition(number): | |
global cache, ncache | |
answer = {(number,), } |
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
var noticias = {"ultimas": {"noticia/tecnologia": [{"pasta": "Noticia/Tecnologia", "imagem_330x220": "https://i.em.com.br/21JEkvZUvC5jrl0EdfTFTPe8cic=/330x220/smart/imgsapp.em.com.br/app/noticia_127983242361/2017/06/14/876552/20170614200611475069i.jpg", "imagem": "http://imgsapp.em.com.br/app/noticia_127983242361/2017/06/14/876552/20170614200611475069i.jpg", "url": "http://www.em.com.br/app/noticia/tecnologia/2017/06/14/interna_tecnologia,876552/netflix-supera-tvs-a-cabo-em-numero-de-assinantes-nos-estados-unidos.shtml", "titulo": "Netflix supera TVs a cabo em n\u00famero de assinantes nos Estados Unidos", "data": "19:56 14/06/2017", "descricao": "Servi\u00e7o de streaming de v\u00eddeos teve crescimento de 5,4 milh\u00f5es de assinantes por ano nos \u00faltimos cinco anos"}, {"pasta": "Noticia/Tecnologia", "imagem_330x220": "https://i.em.com.br/Ku6jryC0cpHHHoWwg-ivIaP6MhA=/330x220/smart/imgsapp.em.com.br/app/noticia_127983242361/2017/03/27/857434/20170327102023584363e.jpg", "imagem": "http://imgsapp.em.com.b |
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
# -*- coding: latin1 -*- | |
""" | |
Codigo para colocar uma imagem na orientacao correta. | |
""" | |
from PIL import Image | |
from PIL.ExifTags import TAGS | |
def get_exif(img): | |
info_exif = {} |
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
// https://www.urionlinejudge.com.br/judge/en/problems/view/1566 | |
include <stdio.h> | |
#include <stdlib.h> | |
struct Node{ | |
int num; | |
struct Node *prox; | |
}; | |
typedef struct Node node; |
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
class MyClass(object): | |
"""Legal.""" | |
def __init__(self, **kwargs): | |
object.__init__(self) | |
self._session = dict(**kwargs) | |
self._session['idade'] = 98 | |
self._a_salvar = [] |
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
-- http://www.gmapas.com/poligonos-ibge/municipios-do-brasil | |
-- Download do arquivo KML com 5.566 municípios brasileiros | |
-- https://docs.google.com/a/gmapas.com/file/d/0B2yOq3AMumqRM2Q0cXVETVJvb1U/edit | |
CREATE EXTENSION postgis; | |
CREATE TABLE cidades ( | |
id SERIAL PRIMARY KEY, | |
cidade VARCHAR(64), | |
estado VARCHAR(2), | |
polygon GEOMETRY |
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/bash | |
# Deve ser executado de 15 em 15 minutos | |
# CRONTAB | |
# 0 15,30,45 * * * * script_semaphore.sh > script_semaphore.log 2>&1 | |
echo $(date) | |
DIR=$(dirname $0) | |
PIDFILE=${DIR}"/script_semaphore.pid" | |
PUBLICA=$(dirname $(dirname $(dirname $DIR))) |