Skip to content

Instantly share code, notes, and snippets.

View frostming's full-sized avatar

Frost Ming frostming

View GitHub Profile
@frostming
frostming / bub-nanobot.md
Last active March 11, 2026 06:07
为什么我认为 Bub 比 nanobot 更像一个“长期可演进”的工程底座

为什么我认为 Bub 比 nanobot 更像一个“长期可演进”的工程底座

最近把当前项目 bubnanobot 放在一起看了一遍。这里文中的 nanobot,指的是该本地 checkout 当前对应的上游项目 HKUDS/nanobot 代码。

为了避免“讨论的不是同一版代码”,先把本文评估所基于的提交写清楚:

  • bub: 370a68ad29b5877d923053c19656c9562c6583ea
  • nanobot: 82f4607b99818d3c785b7f2b540d6044bb06b4cc

如果先给结论:

@frostming
frostming / context.py
Last active May 30, 2025 07:28
Go context in Python
import asyncio
import time
from typing import Any, Awaitable, Callable, TypeVar
Callback = TypeVar("Callback", bound=Callable[[], Any])
class Context:
def _cancel(self, msg: str | None = None) -> None:
"""Cancel the current task."""
@frostming
frostming / json_parser.py
Last active December 13, 2024 09:32
Python JSON Parser
from __future__ import annotations
import re
from typing import Any, Never
class JSONParseError(Exception):
pass
@frostming
frostming / keybase.md
Created October 29, 2024 01:39
keybase.md

Keybase proof

I hereby claim:

  • I am frostming on github.
  • I am frostming (https://keybase.io/frostming) on keybase.
  • I have a public key whose fingerprint is 1A21 DF26 CF48 7A9B 9E9B C482 7B28 4C8F CC08 5EFF

To claim this, I am signing this object:

@frostming
frostming / fly.toml
Last active October 13, 2023 03:33
A Fly.io config file for OpenCat™ for Team that can be deployed directly
# fly.toml file generated for still-snowflake-6351 on 2023-03-30T09:53:40+08:00
kill_signal = "SIGINT"
kill_timeout = 5
primary_region = "sin"
processes = []
[build]
image = "bayedev/opencatd"
name: Add to Journal
on:
workflow_dispatch:
inputs:
text:
description: Add a single item to Logseq journal
type: string
required: true
@frostming
frostming / iterm_image.py
Last active March 3, 2022 05:41
Render image in iTerm2
"""
Render Image in iTerm2 without pixelization
This small snippet is ported from https://github.com/sindresorhus/ansi-escapes.
It leverages iTerm2's image protocol: https://iterm2.com/documentation-images.html
so it only works on iTerm2.
Released to the public domain, feel free to copy and modify.
- Frost Ming
"""
@frostming
frostming / napkin.py
Created April 30, 2021 03:28
Cusdis Telegram Bot
from napkin import response, request
import requests
import json
TELEGRAM_BOT_TOKEN = 'xxxxxx'
TELEGRAM_CHAT_ID = 'xxxxx'
def format_message(data):
"""data example:
@frostming
frostming / promise.py
Last active June 16, 2024 18:17
Python implementation of JavaScript's Promise interface
"""
Python implementation of JavaScript's Promise interface
with the power of asyncio.
See https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Promise
for the API specification.
Authored by: Frost Ming <mianghong@gmail.com>
License: WTFPL
"""
@frostming
frostming / api.js
Last active March 22, 2023 14:18
Flask WTF cookie based CSRF
// npm i js-cookie --save
import axios from 'axios'
import Cookies from 'js-cookie'
const api = axios.create({
headers: {
'Content-Type': 'application/json',
'X-CSRF-TOKEN': Cookies.get('csrf_token')
})