review microservice, is it valuable and cose-effective

微服务并不一定强于单体服务 微服务对运维管理有更高的要求 →Read more

fastapi with celery

Overview 这其实是典型的发布订阅模式, 生产者发布任务到任务队列中, 消费者从任务队列中消费任务. 这里的任务队列是 Redis, 也可以使用 RabbitMQ Quick start from fastapi import FastAPI from pydantic import BaseModel app = FastAPI() class Item(BaseModel): item_id: int name: str description: str = None @app.get("/items/{item_id}", response_model=Item) async def get_item(item_id: int): return {"item_id": item_id, "name": "Some item", "description": "Description of the item"} start cerely by docker compose version: '3.8' […] →Read more

用 Cypher 来查询图数据库

Cyper 作为声明式查询语言, SQL 在计算机行业无人不晓, 无人不知. 而 Cypher 就是 Graph Database 图数据库的 SQL. Cypher is unique because it provides a visual way of matching patterns and relationships. Cypher was inspired by an ASCII-art type of syntax where (nodes)-[:ARE_CONNECTED_TO]->(otherNodes) using rounded brackets for circular (nodes), and -[:ARROWS]-> for relationships. Cypher 用"圆括号"来表示节点, 用"方括号,连接线及箭头"表示关系 When you write a query, […] →Read more

LLM 之用CRISPE 框架构建输入

CRIPSE 1. CR – Capacity and Role: 能力与角色 希望模型扮演怎样的角色, 以及角色所具备的能力 例如: 你是一个精通算法的经验丰富的 C++ 程序员 2. Insight 洞察力 完成任务所依赖的背景信息 例如: 根据现代 C++ 语言的最佳实践 3. Statement 指令 希望模型做什么, 任务的核心关键词和目标 例如: 编程一个类, 实现 24点游戏, 即输入随机的四个数字, 数字范围在1 和9之间, 求出它们是否能通过加减乘除运算得出最终结果为数字 24, 举例如下 输入: 1, 3, 2, 4 计算: 413*2 结果: 24 4. Personality 个性 希望模型以什么风格或方式输出 例如: 请用 C++ 写一个类, 并有一个 […] →Read more

如何计算 mpegts 文件的长度

Background ts文件为传输流文件, 视频编码主要格式 h264/mpeg4, 音频为 acc/mp3。 ts文件分为三层: 1) ts 层Transport Stream、 ts 层就是在pes层加入数据流的识别和传输必须的信息 ts 流: 由定长的TS包组成 (188字节) , 而TS包是对PES包的一个重新封装 (到这里, ES经过了两层的封装) 。应用于相对有错环境下的传输与存储 (如DVB中) , 其基本单位是TS包, 长度固定188字节。日本的DVB-S广播系统采用192个字节的TS包, 美国采用204个字节的TS包, 多加了16个字节的前向纠错校验码 (FEC) 。 2) pes 层 Packet Elemental Stream、 pes 层是在音视频数据上加了时间戳等对数据帧的说明信息, pes 流: PES流是ES流经过PES打包器处理后形成的数据流, 在这个过程中完成了将ES流分组、打包、加入包头信息等操作 (对ES流的第一次打包) 。PES流的基本单位是PES包。 3) es 层 Elementary Stream. es 层就是音视频数据, es 流: 有三种, 图像数据流, […] →Read more

Alert Manager

The Alertmanager handles alerts sent by client applications such as the Prometheus server. It takes care of deduplicating, grouping, and routing them to the correct receiver integration such as email, PagerDuty, or OpsGenie. It also takes care of silencing and inhibition of alerts. Grouping 分组 Grouping categorizes alerts of similar nature into a single notification. […] →Read more

rust first step

installation curl –proto '=https' –tlsv1.2 -sSf https://sh.rustup.rs | sh Cargo Cargo: the Rust build tool and package manager When you install Rustup you’ll also get the latest stable version of the Rust build tool and package manager, also known as Cargo. Cargo does lots of things: build your project with cargo build run your project […] →Read more

gstreamer new plugin: webrtcsink and webrtcsrc

https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/tree/main/net/webrtc webrtcsink and webrtcsrc All-batteries included GStreamer WebRTC producer and consumer, that try their best to do The Right Thing™. It also provides a flexible and all-purposes WebRTC signalling server (gst-webrtc-signalling-server) and a Javascript API (gstwebrtc-api) to produce and consume compatible WebRTC streams from a web browser. Use case The webrtcbin element in GStreamer is […] →Read more

What’s LLM

生成式 AI 对于内容创作者来说, 既是机遇, 也是挑战。 LLM(Large Langage Model) 大语言模型之火愈演愈㤠。 国外的 ChatGPT, 国内的 Kimi 几乎成了与搜索引擎一样必不可少的工具。 AI 不但能理解我们的问题, 理解大篇幅的文本, 还能长篇累牍的生成大块文章, 还能生成图像, 视频, 音频, 这一天来得好快。 现在我写文章, 每当词穷之际, 就会求助于 LLM, 写程序, 忘了函数用法, 也不再查手册, 而去问 LLM, 但是它们是怎么做到的呢。 通过文本生成 token 想想婴儿是怎么学语言的吧, 词汇是基础 , token 就是 LLM 的词汇, BPE(Byte Paire Encoding) 算法广泛用于 LLM , 从给定的数据集中生成 token 通过 token 进行预测 以这句练打字常用的句子为例 the quick […] →Read more

TDD

Test-Driven Development (TDD) is an iterative development cycle that emphasizes writing automated tests before writing the actual feature or function. Put another way, TDD combines building and testing. This process not only helps ensure correctness of the code — but also helps to indirectly evolve the design and architecture of the project at hand. TDD […] →Read more