Complete guide to setting up SSH authentication using a YubiKey's PIV module on macOS (Apple Silicon).
uv tool install yubikey-manager| from enum import StrEnum | |
| from fastapi import FastAPI | |
| from .sorting import Sorting | |
| class SortingField(StrEnum): | |
| FIELD_A = "field_a" | |
| FIELD_B = "field_b" |
| import base64 | |
| from datetime import datetime | |
| from jwcrypto import jwt, jwk # pip install jwcrypto | |
| b64_jwk = "XXXX" # Base64-encoded JWT you get from Cloudflare Stream API (https://developers.cloudflare.com/stream/viewing-videos/securing-your-stream#step-1-call-the-streamkey-endpoint-once-to-obtain-a-key) | |
| jwk_key = jwk.JWK.from_json(base64.b64decode(b64_jwk)) | |
| def get_video_token(video_id: str, lifetime: int = 3600) -> str: | |
| header = {"kid": jwk_key["kid"], "alg": "RS256"} |
| import asyncio | |
| import streamlit as st | |
| from httpx_oauth.clients.google import GoogleOAuth2 | |
| st.title("Google OAuth2 flow") | |
| "## Configuration" | |
| client_id = st.text_input("Client ID") |
| const myMethod = require('./module') | |
| // or | |
| import myMethod from './module' |
| import { createReadStream } from 'fs' | |
| import { basename } from 'path' | |
| import * as request from 'request' // npm i request | |
| import * as Throttle from 'throttle' // npm install throttle | |
| const fileToUploadPath = '/foo.txt' | |
| const fileSize = 1024 // Computed with 'fs.stat' for example | |
| request.post( | |
| '/upload', |