Skip to content

Instantly share code, notes, and snippets.

View vvanglro's full-sized avatar
💤

vvanglro vvanglro

💤
View GitHub Profile
@vvanglro
vvanglro / __init__.py
Created February 8, 2025 03:39 — forked from rednafi/__init__.py
Log context propagation in Python ASGI apps. Details here: https://rednafi.com/python/log_context_propagation/
from svc import log # noqa
@vvanglro
vvanglro / example.yaml
Last active February 17, 2025 02:28
clashx meta config
proxy-providers:
provider1:
url: "xxx"
type: http
interval: 86400
health-check: {enable: true,url: "https://www.gstatic.com/generate_204",interval: 300}
override:
additional-prefix: "[p1]"
provider2:
url: "xxx"
import base64
# 原始数据
data = "wd98"
# 使用标准 Base64 字符集对数据进行编码
encoded_data = base64.b64encode(data.encode()).decode()
print(f"Base64 Encoded Data: {encoded_data}")
# 标准和自定义 Base64 字符集
import base64
import random
import string
chars = string.ascii_letters + string.digits
def base64_encode(data):
encoded_bytes = base64.b64encode(data.encode("utf-8"))
return encoded_bytes.decode("utf-8")
import base64
from io import BytesIO
from random import choice, randint, uniform
from PIL import Image, ImageDraw, ImageFont
def random_color(start: int, end: int):
red = randint(start, end)
green = randint(start, end)