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
| # /// script | |
| # dependencies = [ | |
| # "feedparser", | |
| # ] | |
| # /// | |
| """ | |
| RSS 订阅抓取脚本 | |
| 脚本无需接收命令行参数,会并发抓取 DEFAULT_FEEDS 中最近一周的帖子, |
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
| from dataclasses import dataclass | |
| from operator import add, sub, mul, truediv | |
| from tabnanny import check | |
| from typing import Self, Literal | |
| import random | |
| type OP = Literal["+", "-", "*", "/"] | |
| OPERATIONS = {"+": add, "-": sub, "*": mul, "/": truediv} | |
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 json | |
| from collections.abc import Callable | |
| import sys | |
| from typing import Annotated | |
| from function_schema import get_function_schema | |
| from openai import OpenAI | |
| from openai.types.chat import ChatCompletionMessageParam | |
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 { Etcd3 } from "etcd3"; | |
| const client = new Etcd3(); | |
| async function withLock( | |
| key: string, | |
| action: () => Promise<void>, | |
| client: Etcd3 | |
| ): Promise<void> { | |
| const lockKey = `locks/${key}`; | |
| const lock = client.lock(lockKey); |
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
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8" /> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
| <title>GPS Stat</title> | |
| <script src="https://cdn.tailwindcss.com"></script> | |
| </head> | |
| <body> |
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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="UTF-8" /> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
| <title>firework</title> | |
| <script src="script.js"></script> | |
| </head> | |
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
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8" /> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
| <title>Comment Component</title> | |
| <link | |
| href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" | |
| rel="stylesheet" | |
| /> |
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
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8" /> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
| <title>Double Pendulum Animation</title> | |
| </head> | |
| <body> | |
| <canvas id="canvas" width="800" height="600"></canvas> | |
| <script src="script.js"></script> |
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
| from datetime import UTC, datetime | |
| from fastapi import FastAPI, HTTPException, Request | |
| from fastapi.responses import JSONResponse | |
| from pydantic import BaseModel | |
| class Response[T](BaseModel): | |
| code: int | |
| success: bool |
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
| from collections import defaultdict | |
| from typing import Self | |
| class TrieNode(defaultdict): | |
| def __init__(self): | |
| super().__init__(TrieNode) | |
| self.end = False | |
| def insert(self, word: str) -> None: |
NewerOlder