This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import shelve | |
import string | |
import time | |
class MeasurementDB(object): | |
r"""Database for storing measurements, with export to LaTeX macros. | |
Example usage: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import typing as t | |
from fastapi import Depends, FastAPI, Header, HTTPException | |
from fastapi.security.http import HTTPAuthorizationCredentials, HTTPBearer | |
from pydantic import BaseModel | |
from starlette import status | |
app = FastAPI() | |
# Placeholder for a database containing valid token values |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pika | |
#: Name of the Celery events exchange | |
EXCHANGE_NAME = "celeryev" | |
#: Arbitrary name for the transient queue this script will create and consume from | |
QUEUE_NAME = "pikatest" | |
#: Global to hold our channel object in | |
channel = None | |
# Step #2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Token bucket algorithm implementation and example application/consumer.""" | |
import argparse | |
import asyncio | |
import datetime | |
import random | |
from loguru import logger | |
class TokenBucket: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function tssh --description="SSH to a machine using its Tailscale IP." --argument-names=target_host | |
# Find the `tailscale` executable | |
set cmd '/Applications/Tailscale.app/Contents/MacOS/Tailscale' | |
if not test -x $cmd | |
set cmd (which tailscale) | |
if test $status != 0 | |
set_color red | |
printf "ERROR " | |
set_color normal | |
echo "Could not find Tailscale binary" >&2 |
OlderNewer