This file contains 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 python3 | |
# -*- coding: utf-8 -*- | |
from fastapi import FastAPI | |
import logging | |
LOG = logging.getLogger(__name__) | |
app = FastAPI() |
This file contains 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 python3 | |
# -*- coding: utf-8 -*- | |
from fastapi import FastAPI, Depends, HTTPException, Request | |
from fastapi.middleware.cors import CORSMiddleware # https://fastapi.tiangolo.com/tutorial/cors/ | |
from fastapi.staticfiles import StaticFiles # needs aiofiles to be installed | |
import logging | |
LOG = logging.getLogger(__name__) |
This file contains 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 asyncio | |
import logging | |
import uvloop | |
from kafka_producer import KafkaProducer | |
from kafka_consumer import KafkaConsumer | |
LOG=logging.getLogger(__name__) |
This file contains 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
version: '3.7' | |
networks: | |
kafka-net: | |
driver: bridge | |
services: | |
zookeeper: | |
image: 'bitnami/zookeeper:latest' |
This file contains 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 random | |
import functools | |
""" | |
Reference: http://www.keithschwarz.com/darts-dice-coins/ | |
Initialization: | |
1 Create arrays Alias and Prob, each of size n. | |
2 Create two worklists, Small and Large. |
This file contains 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 absolute_import, division, print_function | |
import argparse | |
import logging | |
import sys | |
logger = logging.getLogger(__name__) |