Skip to content

Instantly share code, notes, and snippets.

@ycd
ycd / kafka_logger.py
Created February 2, 2021 23:10
async logger for kafka
import logging
import json
import asyncio
from typing import Dict, Any
from threading import Thread
import confluent_kafka
from confluent_kafka.cimpl import KafkaException
@ycd
ycd / gitlab.ci.yaml
Created January 11, 2021 12:51
AWS Lambda auto deployment pipeline for GO (Golang)
stages:
- test
- deploy
test:
stage: test
image: golang:1.15-alpine
script:
- apk add build-base
- go test $(go list ./... | grep -v /vendor/)
@ycd
ycd / app.py
Last active February 11, 2023 13:32
FastAPI One Liner
app = (lambda fastapi, typing: (lambda app: (app,app.get("/")(lambda: {"Quite ": "ugly"}),app.post("/annotate",)(lambda x, y: {"How to annotate this": int(x) + int(y)}),)[0])(fastapi.FastAPI()))(__import__("fastapi"), __import__("typing"))
def send_100_requests():
URL = "http://httpbin.org/uuid"
result = []
async def send_request():
r = requests.get(URL)
result.append(r.text)
async def main():