利用常量表达式和模板元编程实现了各种类型颜色空间的像素
原本是打算实现成这样的:
using RGB24 = Pixel<"RGB">
using RGBA32 = Pixel<"RGBA32">但是模板的非类型参数只能是整数或者指向具名变量的指针
| // gcc main.c -lX11 -lXss | |
| #include <stdio.h> | |
| #include <X11/extensions/scrnsaver.h> | |
| int main(void) | |
| { | |
| Display* dpy = XOpenDisplay(NULL); | |
| if (!dpy) | |
| return 1; |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <errno.h> | |
| #include <string.h> | |
| #include <stdbool.h> | |
| #include <pulse/pulseaudio.h> | |
| #ifdef DEBUG | |
| #define LOG(...) printf(__VA_ARGS__) | |
| #else |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <string.h> | |
| #include <errno.h> | |
| #include <stdint.h> | |
| #include <stdbool.h> | |
| #include <unistd.h> | |
| #include <fcntl.h> |
| // apt install libasound2-dev | |
| // LDFLAGS := -lasound | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <alsa/asoundlib.h> | |
| int main(int argc, char* argv[]) | |
| { | |
| if(argc != 2) | |
| { |
利用常量表达式和模板元编程实现了各种类型颜色空间的像素
原本是打算实现成这样的:
using RGB24 = Pixel<"RGB">
using RGBA32 = Pixel<"RGBA32">但是模板的非类型参数只能是整数或者指向具名变量的指针
| #! /usr/bin/env python3 | |
| import torch | |
| from torch import nn | |
| from torch.utils.data import DataLoader | |
| from torchvision import datasets | |
| from torchvision.transforms import ToTensor | |
| # 配置 | |
| batch_size:int = 64 # 一次处理多少数据 |
| // 获取窗口事件 | |
| #include <stdio.h> | |
| #include <xcb/xcb.h> | |
| int main() | |
| { | |
| // 连接到X11 Server | |
| xcb_connection_t* conn = xcb_connect(NULL, NULL); | |
| // 获取screen |
安装 AMD-APP-SDK 或 ROCm
sudo apt install intel-gpu-tools
sudo intel_gpu_top参考: https://wiki.archlinux.org/title/Hardware_video_acceleration