Skip to content

Instantly share code, notes, and snippets.

View flyinactor91's full-sized avatar

Michael duPont flyinactor91

View GitHub Profile
@flyinactor91
flyinactor91 / app.py
Created September 23, 2020 05:51
AI @ UCF DialogFlow Workshop - DF Echo Server
"""
DialogFlow Echo Response Fulfillment
Run ngrok:
https://ngrok.com/download
./ngrok http 8080
Setup:
pip install fastapi uvicorn
@flyinactor91
flyinactor91 / app.py
Last active February 21, 2020 20:56
Demo showing how to use a native Python dataclass to perform automatic value validation and conversion via type hints with FastAPI and pydantic
"""
FastAPI demo showing automatic string-to-dataclass parameter conversion
Based on the quickstart demo found at https://fastapi.tiangolo.com/#create-it
"""
from fastapi import FastAPI, Path
# NOTE: Imports from stdlib instead of pydantic
from dataclasses import dataclass
@flyinactor91
flyinactor91 / app.py
Created January 14, 2019 06:25
Sample Rollbar Exception Logging with Quart
"""
Sample Quart app with Rollbar integration
Adapted from the Flask example
https://github.com/rollbar/rollbar-flask-example/blob/master/hello.py
"""
from quart import Quart
app = Quart(__name__)
@flyinactor91
flyinactor91 / tq.py
Created February 7, 2018 15:47
I needed to replace a memory bound queue with something that could be shared between programs running on different machines. I don’t need something like RabbitMQ or a task-based queue like RQ. Implemented a single-item queue-like class using redis
import redis
class TinyQueue(object):
"""
A single-item queue to share data between sandboxed projects using Redis
Instances of this class with the same 'tag' will be connected
'overwrite' will cause new push data to overwrite the previous
overwrite=False -> FIFO
<!DOCTYPE html>
<meta charset="utf-8">
<style>
path {
fill: none;
stroke-linejoin: round;
}
.sphere,