Python2026/01/14

Python的异步IO

协程

Python 的异步 I/O 基于协程实现。使用async关键字来创建一个异步函数,对异步函数的调用不会执行该函数,而是生成一个协程对象。
对每一个协程对象,都必须等待其结束(即使是没有启动的协程),否则会产生一个RuntimeWarning。

示例 :

1# 创建一个异步函数
2async def say_hello():
代码块被截断。
查看全文
X112026/01/14
查看全文
X112026/01/14

xcb 截图

通过 xcb_get_image 可以进行截图:

1xcb_get_image_cookie_t
2xcb_get_image (xcb_connection_t *c,               // X连接
3               uint8_t           format,          // 格式 
4               xcb_drawable_t    drawable,        // 要截图的目标,例如窗口,截全屏则为 root 窗口
5               int16_t           x,               // 截图的起点 x 坐标
代码块被截断。
查看全文
X112026/01/14
代码块被截断。
查看全文
X112026/01/14

xcb 获取鼠标指针的坐标

1typedef struct xcb_query_pointer_reply_t {
2    uint8_t      response_type;
3    uint8_t      same_screen;
4    uint16_t     sequence;
5    uint32_t     length;
6    xcb_window_t root;
7    xcb_window_t child;
代码块被截断。
查看全文
X112026/01/14
代码块被截断。
查看全文
CUDA2026/01/14

Linux CUDA 驱动失效问题的解决办法

在使用 Linux 的时候,如果经常进行升级,时不时会遇到驱动失效的问题:

1$ nvidia-smi 
2NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA driver. 
3Make sure that the latest NVIDIA driver is installed and running.
查看全文
CUDA2026/01/14

NVIDIA驱动安装成功但无法使用

现象

1$ nvidia-smi
2NVIDIA-SMI has failed because it couldn’t communicate with the NVIDIA driver. Make sure that the latest NVIDIA driver is installed and running.
3
4$ dkms status
5nvidia, 470.86, 5.13.0-22-generic, x86_64: installed
代码块被截断。
查看全文
CUDA2026/01/14
查看全文
CUDA2026/01/14
查看全文