Blog/2024-02-22/Moon Landings: Difference between revisions
Created page with "Possibly the most unbelievable story I read today was that [https://arstechnica.com/space/2024/02/a-little-us-company-makes-history-by-landing-on-the-moon-but-questions-remain/ there was a private moon landing] and it almost didn't happen because the nav lasers crapped out. The guys on the ground then used the NASA payload's cameras to perform that function! Speaking of these lasers, why do they always manage to do this? There's a whole plane that flies along with Maver..." |
No edit summary |
||
Line 58: | Line 58: | ||
Pretty straightforward stuff. Maybe 30 s for a quick HTTP server. | Pretty straightforward stuff. Maybe 30 s for a quick HTTP server. | ||
[[Category:Blog]] |
Latest revision as of 05:54, 16 April 2024
Possibly the most unbelievable story I read today was that there was a private moon landing and it almost didn't happen because the nav lasers crapped out. The guys on the ground then used the NASA payload's cameras to perform that function!
Speaking of these lasers, why do they always manage to do this? There's a whole plane that flies along with Maverick in the new Top Gun whose whole job is to help him get a lock so he can bomb the target but those guys just fly along and then fail to actually get a lock! Made them look like chumps.
Recently also tried `fastapi` with `uvicorn` and it is an unbelievably pleasant experience. The harder part was configuring the Kubernetes ingress on EKS and so on, but when I had to do it on our own k3s cluster running Traefik everything was super easy.
import aiomysql
from fastapi import FastAPI, HTTPException
app = FastAPI()
db_pool: aiomysql.pool.Pool | None = None
async def get_db_pool():
import os
global db_pool
if db_pool is None:
db_pool = await aiomysql.create_pool(
host=os.environ.get("DB_HOST"),
port=3306,
user=os.environ.get("DB_USERNAME"),
password=os.environ.get("DB_PASSWORD"),
db=os.environ.get("DB_DATABASE"),
minsize=5,
maxsize=10
)
return db_pool
@app.on_event("startup")
async def startup():
global db_pool
db_pool = await get_db_pool()
@app.on_event("shutdown")
async def shutdown_event():
global db_pool
if db_pool:
db_pool.close()
await db_pool.wait_closed()
CATEGORIES = {"animals", "lamps"}
@app.get("/products/")
async def get_things(
category: str = None,
):
if category not in CATEGORIES:
raise HTTPException(status_code=400, detail=f"Not a valid category from {CATEGORIES}")
return [{"name": "thing1"}, {"name", "thing2"}]
Pretty straightforward stuff. Maybe 30 s for a quick HTTP server.