Skip to content

Instantly share code, notes, and snippets.

from contextlib import asynccontextmanager
from typing import AsyncGenerator
from fastapi import FastAPI, APIRouter, Request
from fastapi.testclient import TestClient
def test_lifecycle_subrouters():
@asynccontextmanager
async def app_lifespan(app: FastAPI) -> AsyncGenerator[dict[str, bool], None]:
package main
import (
"context"
"fmt"
"net"
"github.com/redis/go-redis/v9"
)
package main
import (
"context"
"fmt"
"net"
"github.com/redis/go-redis/v9"
)
@nickstenning
nickstenning / job.yaml
Created April 30, 2024 18:06
Running migrations in k8s
apiVersion: batch/v1
kind: Job
metadata:
name: testjob
spec:
# Never retry this job.
backoffLimit: 0
template:
spec:
containers:
build:
gpu: false
python_version: "3.11"
predict: "predict.py:Predictor"
package main
import (
"bytes"
"context"
"errors"
"fmt"
"io"
"log"
"net/http"
package main
import (
"context"
"fmt"
"io"
"log"
"net/http"
"net/http/httptrace"
"time"
import argparse
import math
import textwrap
from datetime import timedelta
DURATIONS = {"s": 1, "m": 60, "h": 3600, "d": 86400, "w": 604800}
ERROR_RATES = [
0.0001,
0.0005,
0.001,
@nickstenning
nickstenning / README.md
Created March 16, 2020 15:48 — forked from notheotherben/README.md
COVID-19 F@H AzureVM Template

COVID-19 F@H Azure VM Template

Deploy an Azure VM to help Folding@Home

This is an Azure VM template which deploys a GPU-enabled VM of your choice to help the Folding@Home project find ways to combat COVID-19.

import React from "react";
import PropTypes from "prop-types";
import { compose } from "redux";
import { connect } from "react-redux";
import { isEmpty, populate, withFirebase } from "react-redux-firebase";
import AppDrawerAuth from "./AppDrawerAuth";
class AppDrawerAuthContainer extends React.Component {
render() {
const { profile, signOut } = this.props;