tmp
yaoye Lv5

tmp

0005

1
2
3
4
5
6
7
8
9
10
11
12
13
14
# 1. 克隆原仓库到一个新的目录
git clone git@github.com:kongshan4219/go.git
cd ManyProject_hexo_util

# 2. 使用 git filter-repo 提取并重命名文件夹
git filter-repo --path qq_send_msg/ --path-rename qq_send_msg/:

# 3. 创建新的远程仓库(以 GitHub 为例)
# 在 GitHub 上创建一个新的空仓库,获取其 URL

# 4. 将提取的历史推送到新仓库
git remote add origin git@github.com:kongshan4219/qq_bot_util.git
git branch -m master main
git push -u origin main

dadd

1
s%CUDA_PATH%\lib;%CUDA_PATH%\include;%CUDA_PATH%\bin;%CUDA_PATH%\libnvvp;D:\Application\Develop\CUDA\v11.8\bin;D:\Application\Develop\CUDA\v11.8\libnvvp;D:\Application\Develop\CUDA\v11.7\bin;D:\Application\Develop\CUDA\v11.7\libnvvp;D:\Application\Develop\CUDA\v12.0\lib;D:\Application\Develop\CUDA\v12.0\include;D:\Application\Develop\CUDA\v12.0\bin;D:\Application\Develop\CUDA\v12.0\libnvvp;D:\Application\Develop\Tesseract-OCR\tessdata;D:\Application\Develop\PowerShell;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;%SYSTEMROOT%\System32\OpenSSH\;C:\Program Files\dotnet\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;%GIT_HOME%;%GIT_HOME%\bin;%GIT_HOME%\usr\bin;D:\Application\AndroidPlayer\leidian\LDPlayer9;D:\Application\Develop\NetSarang\Xshell 8\;D:\Application\Develop\NetSarang\Xftp 8\;C:\opencv\build\install\x64\mingw\bin;D:\Application\Develop\mingw64\bin;D:\Application\Develop\cmake\bin;C:\opencv\build\install\x64\mingw\staticlib;%SystemRoot%\system32;D:\Application\Tool\EasyShare\x86\;D:\Application\Tool\EasyShare\x64\;%NVM_HOME%;%NVM_SYMLINK%;D:\Application\Develop\wix;%JAVA_HOME%;D:\Application\Develop\pyenv\pyenv-win\shims;D:\Application\Develop\pyenv\pyenv-win\;D:\Application\Develop\pyenv\pyenv-win\bin;D:\Application\Develop\Tesseract-OCR;D:\User\yaoye\Downloads\paddle_inference_c\paddle\include;D:\User\yaoye\Downloads\paddle_inference_c\paddle\lib;C:\Program Files\NVIDIA Corporation\Nsight Compute 2022.3.0\;;C:\Program Files\NVIDIA Corporation\NVIDIA app\NvDLISR
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// 系统思考:Golang项目结构设计
/*
项目结构:
.
├── cmd
│ └── ocrmanager
│ └── main.go // 主程序入口
├── internal
│ ├── callback // 回调处理模块
│ │ └── default.go // 默认回调实现
│ ├── mojo // Mojo通信模块
│ │ ├── dll.go // DLL封装
│ │ ├── environment.go // Mojo环境管理
│ │ └── message.go // 消息处理
│ ├── ocr // OCR核心模块
│ │ ├── manager.go // OCR管理器
│ │ ├── task.go // 任务管理
│ │ └── result.go // 结果处理
│ └── winapi // Windows API封装
│ ├── process.go // 进程操作
│ ├── memory.go // 内存操作
│ └── window.go // 窗口操作
├── pkg
│ ├── protobuf // Protobuf协议
│ │ ├── ocr_protobuf.pb.go
│ │ └── utility_protobuf.pb.go
│ └── types // 类型定义
│ ├── callback.go // 回调类型
│ ├── mojo.go // Mojo类型
│ └── ocr.go // OCR类型
├── go.mod
└── go.sum

设计要点:
1. 模块化设计,职责分离
2. 保持与Python项目功能对等
3. 优化错误处理机制
4. 增强类型安全性
5. 改进并发处理
6. 优化资源管理
7. 增强可测试性
8. 保持与Windows API的良好交互
*/
// 系统思考结束
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
- 分析代码
- 我看不懂这几行代码
- callback_def = default_callback.callbacks_def[fname]
- SetMMMojoEnvironmentCallbacks = self._dll.func_def("SetMMMojoEnvironmentCallbacks", void, *(c_void_p, c_int, callback_def))
- self._callbacks_refer[fname] = callback_def(callback)
- SetMMMojoEnvironmentCallbacks(self.m_mmmojo_env_ptr, i.value, self._callbacks_refer[fname])
- 帮我xiang'x
def SetDefaultCallbaks(self):
for i in MMMojoEnvironmentCallbackType:
fname = i.name
if fname == "kMMUserData":
continue
callback = self.m_callbacks.get(fname, None) or getattr(default_callback, f"Default{fname[3:]}")
callback_def = default_callback.callbacks_def[fname]
SetMMMojoEnvironmentCallbacks = self._dll.func_def("SetMMMojoEnvironmentCallbacks", void, *(c_void_p, c_int, callback_def))
self._callbacks_refer[fname] = callback_def(callback)
SetMMMojoEnvironmentCallbacks(self.m_mmmojo_env_ptr, i.value, self._callbacks_refer[fname])
callbacks_def = {
# static void DefaultReadOnPush(uint32_t request_id, const void* request_info, void* user_data);
'kMMReadPush': CFUNCTYPE(void, c_uint32, c_void_p, c_void_p),
# static void DefaultReadOnPull(uint32_t request_id, const void* request_info, void* user_data);
'kMMReadPull': CFUNCTYPE(void, c_uint32, c_void_p, c_void_p),
# static void DefaultReadOnShared(uint32_t request_id, const void* request_info, void* user_data);
'kMMReadShared': CFUNCTYPE(void, c_uint32, c_void_p, c_void_p),
# static void DefaultRemoteOnConnect(bool is_connected, void* user_data);
'kMMRemoteConnect': CFUNCTYPE(void, c_bool, c_void_p),
# static void DefaultRemoteOnDisConnect(void* user_data);
'kMMRemoteDisconnect': CFUNCTYPE(void, c_void_p),
# static void DefaultRemoteOnProcessLaunched(void* user_data);
'kMMRemoteProcessLaunched': CFUNCTYPE(void, c_void_p),
# static void DefaultRemoteOnProcessLaunchFailed(int error_code, void* user_data);
'kMMRemoteProcessLaunchFailed': CFUNCTYPE(void, c_int, c_void_p),
# static void DefaultRemoteOnMojoError(const void* errorbuf, int errorsize, void* user_data);
'kMMRemoteMojoError': CFUNCTYPE(void, c_void_p, c_int, c_void_p)
}
def func_def(self, *args):
return func_def(*args, dll=self._dll)
# 定义函数定义器,用于包装Windows API函数
def func_def(name, restype, *argtypes, dll=kernel32):
def errcheck(result, func, args):
if not result:
raise WinError(get_last_error())
return result
cfunc = getattr(dll, name)
cfunc.argtypes = argtypes
cfunc.restype = restype
# cfunc.errcheck = errcheck
return cfunc
1
git filter-branch --force --index-filter 'git rm --cached --ignore-unmatch -r PaddleOCR' --prune-empty --tag-name-filter cat -- --all
1
python GOT/demo/run_ocr_2.0.py --model-name "D:\Application\Develop\Project\python\GOT-OCR2.0\GOT-OCR-2.0-master\GOT\GOT_weights" --image-file "D:\User\yaoye\Pictures\QQ20241227-222529.png" --type ocr
1
python GOT/demo/run_ocr_2.0.py  --model-name  \GOT-OCR2.0-main\GOT-OCR-2.0-master\GOT_weights\  --image-file  \GOT-OCR2.0-main\GOT-OCR-2.0-master\test\jpg\test1.jpg  --type ocr

dds

1
2
3
4
5
6
7
8
-many
--push
---push.go
-Uitl.go
push.go的包声明为package main
Util.go的包声明为package many
怎么在push.go调用Util.go的方法

1
2
3
4
5
myproject/
many/
Util.go
push/
push.go
1
2
#cgo LDFLAGS:     -LC:/opencv/build/install/x64/mingw/staticlib -lopencv_stereo4100 -lopencv_tracking4100 -lopencv_superres4100 -lopencv_stitching4100 -lopencv_optflow4100 -lopencv_gapi4100 -lopencv_face4100 -lopencv_dpm4100 -lopencv_dnn_objdetect4100 -lopencv_ccalib4100 -lopencv_bioinspired4100 -lopencv_bgsegm4100 -lopencv_aruco4100 -lopencv_xobjdetect4100 -lopencv_ximgproc4100 -lopencv_xfeatures2d4100 -lopencv_videostab4100 -lopencv_video4100 -lopencv_structured_light4100 -lopencv_shape4100 -lopencv_rgbd4100 -lopencv_rapid4100 -lopencv_objdetect4100 -lopencv_mcc4100 -lopencv_highgui4100 -lopencv_datasets4100 -lopencv_calib3d4100 -lopencv_videoio4100 -lopencv_text4100 -lopencv_line_descriptor4100 -lopencv_imgcodecs4100 -lopencv_img_hash4100 -lopencv_hfs4100 -lopencv_fuzzy4100 -lopencv_features2d4100 -lopencv_dnn_superres4100 -lopencv_dnn4100 -lopencv_xphoto4100 -lopencv_wechat_qrcode4100 -lopencv_surface_matching4100 -lopencv_reg4100 -lopencv_quality4100 -lopencv_plot4100 -lopencv_photo4100 -lopencv_phase_unwrapping4100 -lopencv_ml4100 -lopencv_intensity_transform4100 -lopencv_imgproc4100 -lopencv_flann4100 -lopencv_core4100 -lade -lquirc -llibprotobuf -lIlmImf -llibpng -llibopenjp2 -llibwebp -llibtiff -llibjpeg-turbo -lzlib -lkernel32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 -luser32

1
#cgo LDFLAGS:    --static -LC:/opencv/build/install/x64/mingw/staticlib -lopencv_stereo4100 -lopencv_tracking4100 -lopencv_superres4100 -lopencv_stitching4100 -lopencv_optflow4100 -lopencv_gapi4100 -lopencv_face4100 -lopencv_dpm4100 -lopencv_dnn_objdetect4100 -lopencv_ccalib4100 -lopencv_bioinspired4100 -lopencv_bgsegm4100 -lopencv_aruco4100 -lopencv_xobjdetect4100 -lopencv_ximgproc4100 -lopencv_xfeatures2d4100 -lopencv_videostab4100 -lopencv_video4100 -lopencv_structured_light4100 -lopencv_shape4100 -lopencv_rgbd4100 -lopencv_rapid4100 -lopencv_objdetect4100 -lopencv_mcc4100 -lopencv_highgui4100 -lopencv_datasets4100 -lopencv_calib3d4100 -lopencv_videoio4100 -lopencv_text4100 -lopencv_line_descriptor4100 -lopencv_imgcodecs4100 -lopencv_img_hash4100 -lopencv_hfs4100 -lopencv_fuzzy4100 -lopencv_features2d4100 -lopencv_dnn_superres4100 -lopencv_dnn4100 -lopencv_xphoto4100 -lopencv_wechat_qrcode4100 -lopencv_surface_matching4100 -lopencv_reg4100 -lopencv_quality4100 -lopencv_plot4100 -lopencv_photo4100 -lopencv_phase_unwrapping4100 -lopencv_ml4100 -lopencv_intensity_transform4100 -lopencv_imgproc4100 -lopencv_flann4100 -lopencv_core4100 -lade -lquirc -llibprotobuf -lIlmImf -llibpng -llibopenjp2 -llibwebp -llibtiff -llibjpeg-turbo -lzlib -lkernel32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 -luser32
1
2
3
D:\Application\Develop\pyenv\pyenv-win\shims
D:\Application\Develop\pyenv\pyenv-win\
D:\Application\Develop\pyenv\pyenv-win\bin
1
2
3
4
acme.sh --install-cert -d yaoye.me \
--key-file /path/to/keyfile/in/nginx/key.pem \
--fullchain-file /path/to/fullchain/nginx/cert.pem \
--reloadcmd "service nginx reload"

curl https://get.acme.sh | sh -s email=2996014561@qq.com

1
acme.sh --issue --nginx -d yaoye.me -d alist.yaoye.me

/www/server/nginx/conf/

acme.sh –issue –nginx -d yaoye.me -d alist.yaoye.me –nginx-conf /www/server/nginx/conf/nginx.conf

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
user  www www;
worker_processes auto;
error_log /www/wwwlogs/nginx_error.log crit;
pid /www/server/nginx/logs/nginx.pid;
worker_rlimit_nofile 51200;

stream {
log_format tcp_format '$time_local|$remote_addr|$protocol|$status|$bytes_sent|$bytes_received|$session_time|$upstream_addr|$upstream_bytes_sent|$upstream_bytes_received|$upstream_connect_time';

access_log /www/wwwlogs/tcp-access.log tcp_format;
error_log /www/wwwlogs/tcp-error.log;
include /www/server/panel/vhost/nginx/tcp/*.conf;
}

events
{
use epoll;
worker_connections 51200;
multi_accept on;
}

http
{
#AAPANEL_FASTCGI_CONF_BEGIN
fastcgi_cache_key "$scheme$request_method$host$request_uri";
fastcgi_cache_path /dev/shm/nginx-cache/wp levels=1:2 keys_zone=WORDPRESS:100m inactive=60m max_size=1g;
fastcgi_cache_use_stale error timeout invalid_header http_500;
fastcgi_ignore_headers Cache-Control Expires Set-Cookie;
#AAPANEL_FASTCGI_CONF_END

include mime.types;
#include luawaf.conf;

include proxy.conf;
lua_package_path "/www/server/nginx/lib/lua/?.lua;;";

default_type application/octet-stream;

server_names_hash_bucket_size 512;
client_header_buffer_size 32k;
large_client_header_buffers 4 32k;
client_max_body_size 50m;

sendfile on;
tcp_nopush on;

keepalive_timeout 60;

tcp_nodelay on;

fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
fastcgi_buffer_size 64k;
fastcgi_buffers 4 64k;
fastcgi_busy_buffers_size 128k;
fastcgi_temp_file_write_size 256k;
fastcgi_intercept_errors on;

gzip on;
gzip_min_length 1k;
gzip_buffers 4 16k;
gzip_http_version 1.1;
gzip_comp_level 2;
gzip_types text/plain application/javascript application/x-javascript text/javascript text/css application/xml application/json image/jpeg image/gif image/png font/ttf font/otf image/svg+xml application/xml+rss text/x-js;
gzip_vary on;
gzip_proxied expired no-cache no-store private auth;
gzip_disable "MSIE [1-6]\.";

limit_conn_zone $binary_remote_addr zone=perip:10m;
limit_conn_zone $server_name zone=perserver:10m;

server_tokens off;
access_log off;

server
{
listen 888;
server_name phpmyadmin;
index index.html index.htm index.php;
root /www/server/phpmyadmin;

#error_page 404 /404.html;
include enable-php.conf;

location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}

location ~ .*\.(js|css)?$
{
expires 12h;
}

location ~ /\.
{
deny all;
}

access_log /www/wwwlogs/access.log;
}

server
{
listen 80;
server_name alist.yaoye.me;

location / {
proxy_pass http://127.0.0.1:5244;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}

server
{
listen 80;
server_name kongshan.cc yaoye.me;

location / {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Credentials' true;
add_header 'Access-Control-Allow-Headers' *;
add_header 'Access-Control-Allow-Methods' *;
add_header 'Access-Control-Expose-Headers' *;
root /opt/application/hexo/public; # 打包后的文件目
index index.html index.htm;
try_files $uri $uri/ /index.html; # 防止刷新出现404
}

error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}

server
{
listen 8080; # 修改端口为8080

location / {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Credentials' true;
add_header 'Access-Control-Allow-Headers' *;
add_header 'Access-Control-Allow-Methods' *;
add_header 'Access-Control-Expose-Headers' *;
root /opt/application/hexo/public; # 打包后的文件目录
index index.html index.htm;
try_files $uri $uri/ /index.html; # 防止刷新出现404
}

error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}


include /www/server/panel/vhost/nginx/*.conf;
}

使用java编写一个程序,实现以下功能
代码需要添加详细的中文注释,使用jdk17,使用maven管理依赖

  • 以”D:\User\yaoye\Documents\Article\yaoye1”为根目录

  • 遍历根目录下所有子目录及md文件

  • 读取md文件开头用—包裹的YAML元信息

  • 如果没有则创建用—包裹的YAML元信息

  • 操作YAML信息时不要使用YAML工具,需要直接一行一行读取和写入文本

  • 读取文件第一行,判断是否为“—”,是则表明md文件有YAML元信息,不是则表明md文件没有YAML元信息

  • md文件有YAML元信息时继续读取直到下一个“—”

  • 检查是否包含以下数据

    1
    2
    3
    4
    5
    6
    title: tmp
    date: 2024-11-28 15:07:18
    category:
    - 默认
    tag:
    - 默认
    • title为文件名

    • date为当前时间

    • categary为md文件的分类,具体为md文件相对于根目录的文件夹层级,如果md文件位于根目录则categary设置为默认

    • tag为md文件的标签,需要在原有的标签基础上讲categary也作为标签添加进tag

    例子1:D:\User\yaoye\Documents\Article\yaoye1\foder1\foder2\test1.md

    1
    2
    3
    4
    5
    6
    7
    8
    title: test1
    date: 2024-11-28 15:07:18
    category:
    - foder1
    - foder2
    tag:
    - foder1
    - foder2

    例子2:D:\User\yaoye\Documents\Article\yaoye1\test2.md

    1
    2
    3
    4
    5
    6
    7
    title: test2
    date: 2024-11-28 15:07:18
    category:
    - 默认
    tag:
    - 默认
    - tag1
  • 注意,categary是覆盖,tag是在原有基础上添加