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
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCpbrzA0XGgUmtTTAmEXxMjAj7B+lkW4e2KkPGcmP2u4bYehH/1axdTaAf6HYKcMDv65aJIN8Qz/zp0b6zNb5mwptPNa3f9LrEZ2zT0agPZCgRX71AUunp9WhNazz48uPyWCYRw9BIQzNHyJFMIlnjwCwpwZu/qBMZWHu9EBQ3UOHqfdUzf2mw0/8UASFnGduLGbY7kSDMxX3NBDN6zLsYBKBVJyz+bszdWi3QXLNcDLVqqh0sOi16FTHZJzsjFnf+K6JNRQGeMMsisyZX1E2TSFBm+slJYzW2zdqGuOjnDsGQyZ9Uv+m0oJ+t29cMiTwOKcURI64U3LSSTm0oCLHaj |
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 -*- | |
;; custom | |
;; Atenção: não esquecer de setar a variável HOME do windows para a | |
;; pasta home do usuário. Caso contrário o "~" não será reconhecido. | |
(setq frame-title-format "emacs do amaral") | |
(tool-bar-mode -1) | |
(scroll-bar-mode -1) | |
(set-default 'cursor-type 'hbar) |
I hereby claim:
- I am herberthamaral on github.
- I am herberthamaral (https://keybase.io/herberthamaral) on keybase.
- I have a public key ASB1HmxiGMufY0PlmTyzmFkHKm6Z1Vz65loVAmN47-Y5zAo
To claim this, I am signing this object:
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
import json | |
from werkzeug.wrappers import Request, Response | |
@Request.application | |
def application(request): | |
print('HEADERS:') | |
for header, value in request.headers.items(): | |
print('{header}: {value}'.format(header=header, value=value)) | |
print('CONTENT:') |
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
def troco(valor): | |
retorno = {50: 0, 25: 0, 10:0, 5: 0, 1: 0} | |
while valor >= 5: | |
if valor >= 50: | |
retorno[50] += 1 | |
valor = valor - 50 | |
elif valor >= 25: | |
retorno[25] = 1 | |
valor = valor - 25 | |
elif valor >= 10: |
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
import unittest | |
def fizzbuzz(num): | |
retorno = '' | |
if num == 0: | |
return retorno | |
if num % 3 == 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
import asyncio | |
from typing import AsyncGenerator, Dict | |
from fastapi import FastAPI | |
from nats.aio.client import Client as NATS | |
from nats.aio.client import Msg | |
from starlette.requests import Request | |
from starlette.responses import StreamingResponse | |
app = FastAPI() |
Algumas observações a respeito dos arquivos deste gist:
- O arquivo Python pode ser executado diretamente para que os testes dentro dele sejam executados;
- Por questões de simplicidade, optou-se por deixar o código de produção junto com o código de testes, mas isso não é recomendado em um projeto real -- os dois tipos de código devem ficar separados;
- Também por questões de simplicidade, um framework de BDD (como o python-behave) não foi utilizado;
- Apenas os dois primeiros cenários foram implementados;
- A forma normal de utilizar o unittest é criar uma pasta
tests
e colocar todos os arquivos lá e utilizar o comandopython -m unittest
como consta na documentação [1].
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
import queue | |
import random | |
import threading | |
import time | |
def ouvir_microfone(fila_comandos: queue.Queue) -> None: | |
# Função produtora da fila | |
# Esta função simula alguém ditando comandos no microfone, colocando na | |
# fila de comandos o que foi dito. Gera um comando a cada 5 segundos. |
OlderNewer