Skip to content

Instantly share code, notes, and snippets.

@steveherrin
steveherrin / main_aiocache.py
Created January 11, 2024 19:38
Minimal demo of using aiocache with FastAPI
"""
caching test/demo
first:
pip install fastapi aiocache "uvicorn[standard]"
"""
import asyncio
import contextlib
import json
import logging
@faaaaabi
faaaaabi / synapse-postgres-docker-compose.md
Last active June 24, 2024 05:04
A basic setup for synapse with postgres behind a nginx reverse proxy

Synapse Docker Compose Setup

This proposed setup assumes that you want to use synapse with a Postgres database behind a separate nginx reverse proxy for TLS.

Setup

DNS setup

A detailed explanation of a basic and extended dns setup can be found here

Generate synapse config

@bmaupin
bmaupin / free-database-hosting.md
Last active July 20, 2024 16:10
Free database hosting
@lilyball
lilyball / sieve.ml
Created August 23, 2008 03:35
An implementation of the Sieve of Eratosthenes in OCaml
type primality = Prime | Composite | Unknown
type sieve = primality array
exception Out_of_bounds
let make n =
if n < 2 then invalid_arg "Sieve.make"
else
let sieve = Array.make n Unknown in
sieve.(0) <- Composite;
sieve.(1) <- Composite;