Deprecated: Creation of dynamic property Typecho\Widget\Request::$feed is deprecated in /www/wwwroot/blog.iletter.top/var/Widget/Archive.php on line 246
白荼日记 - DelLevin https://blog.iletter.top/author/1/ DelLevin 1+ACE2系统优化笔记 https://blog.iletter.top/archives/495/ 2025-11-01T21:01:00+08:00 记录一下系统的优化记录系统版本C13.1 (cn01)版本。机型1+ace2系统版本:冻结的应用:其中,发现我的system_server里面一直高负载,时不时跳到150%以上。于是采用adb抓包形式。抓包命令.\adb logcat -v time > D:\UserData\Desktop\logcat.log第一次日志抓取11-01 18:31:44.931 W/ActivityManager( 3189): Unable to start service Intent { act=com.oplus.onet.service.INTENT_SDK_BIND_SERVICE pkg=com.oplus.onet } U=0: not found 11-01 18:31:44.931 W/ContextImpl( 4912): Calling a method in the system process without a qualified user: android.app.ContextImpl.bindService:1973 android.content.ContextWrapper.bindService:863 com.oplus.onet.case$do.run:142 android.os.Handler.handleCallback:942 android.os.Handler.dispatchMessage:99 11-01 18:31:44.932 W/ActivityManager( 3189): Unable to start service Intent { act=com.oplus.onet.service.INTENT_SDK_BIND_SERVICE pkg=com.oplus.onet } U=0: not found 11-01 18:31:44.933 W/ContextImpl( 4912): Calling a method in the system process without a qualified user: android.app.ContextImpl.bindService:1973 android.content.ContextWrapper.bindService:863 com.oplus.onet.case$do.run:142 android.os.Handler.handleCallback:942 android.os.Handler.dispatchMessage:99 11-01 18:31:44.934 W/ActivityManager( 3189): Unable to start service Intent { act=com.oplus.onet.service.INTENT_SDK_BIND_SERVICE pkg=com.oplus.onet } U=0: not found 11-01 18:31:44.935 W/ContextImpl( 4912): Calling a method in the system process without a qualified user: android.app.ContextImpl.bindService:1973 android.content.ContextWrapper.bindService:863 com.oplus.onet.case$do.run:142 android.os.Handler.handleCallback:942 android.os.Handler.dispatchMessage:99 11-01 18:31:44.936 W/ActivityManager( 3189): Unable to start service Intent { act=com.oplus.onet.service.INTENT_SDK_BIND_SERVICE pkg=com.oplus.onet } U=0: not found 11-01 18:31:44.937 W/ContextImpl( 4912): Calling a method in the system process without a qualified user: android.app.ContextImpl.bindService:1973 android.content.ContextWrapper.bindService:863 com.oplus.onet.case$do.run:142 android.os.Handler.handleCallback:942 android.os.Handler.dispatchMessage:99 11-01 18:31:44.938 W/ActivityManager( 3189): Unable to start service Intent { act=com.oplus.onet.service.INTENT_SDK_BIND_SERVICE pkg=com.oplus.onet } U=0: not found 11-01 18:31:44.938 W/ContextImpl( 4912): Calling a method in the system process without a qualified user: android.app.ContextImpl.bindService:1973 android.content.ContextWrapper.bindService:863 com.oplus.onet.case$do.run:142 android.os.Handler.handleCallback:942 android.os.Handler.dispatchMessage:99 11-01 18:31:44.939 W/ActivityManager( 3189): Unable to start service Intent { act=com.oplus.onet.service.INTENT_SDK_BIND_SERVICE pkg=com.oplus.onet } U=0: not found 11-01 18:31:44.939 W/ContextImpl( 4912): Calling a method in the system process without a qualified user: android.app.ContextImpl.bindService:1973 android.content.ContextWrapper.bindService:863 com.oplus.onet.case$do.run:142 android.os.Handler.handleCallback:942 android.os.Handler.dispatchMessage:99 这里疯狂唤醒com.oplus.onet 服务,同时com.oplus.virtualcomm,这个虚拟通信也疯狂调用。于是只好解冻这net服务。第二次抓包11-01 18:48:53.927 E/AdbDebuggingManager( 3189): Caught an exception opening the socket: java.io.IOException: No such file or directory 11-01 18:48:53.956 W/ActivityManager( 3189): Unable to start service Intent { act=com.heytap.accessory.action.BASE_FRAMEWORK_MANAGER pkg=com.heytap.accessory } U=0: not found 11-01 18:48:53.958 W/ActivityManager( 3189): Unable to start service Intent { act=com.heytap.accessory.action.BASE_FRAMEWORK_MANAGER pkg=com.heytap.accessory } U=0: not found 11-01 18:48:53.960 W/ActivityManager( 3189): Unable to start service Intent { act=com.heytap.accessory.ScanService pkg=com.heytap.accessory (has extras) } U=0: not found 11-01 18:48:53.960 W/ActivityManager( 3189): Unable to start service Intent { act=com.heytap.accessory.action.BASE_FRAMEWORK_MANAGER pkg=com.heytap.accessory } U=0: not found 11-01 18:48:53.960 W/ActivityManager( 3189): Unable to start service Intent { act=com.heytap.accessory.ScanService pkg=com.heytap.accessory (has extras) } U=0: not found 11-01 18:48:53.960 W/ActivityManager( 3189): Unable to start service Intent { act=com.heytap.accessory.ScanService pkg=com.heytap.accessory (has extras) } U=0: not found 11-01 18:48:53.962 W/ActivityManager( 3189): Unable to start service Intent { act=com.heytap.accessory.ScanService pkg=com.heytap.accessory (has extras) } U=0: not found 11-01 18:48:53.962 W/ActivityManager( 3189): Unable to start service Intent { act=com.heytap.accessory.action.BASE_FRAMEWORK_MANAGER pkg=com.heytap.accessory } U=0: not found 11-01 18:48:53.963 W/ActivityManager( 3189): Unable to start service Intent { act=com.heytap.accessory.action.BASE_FRAMEWORK_MANAGER pkg=com.heytap.accessory } U=0: not found 11-01 18:48:53.963 W/ActivityManager( 3189): Unable to start service Intent { act=com.heytap.accessory.ScanService pkg=com.heytap.accessory (has extras) } U=0: not found 11-01 18:48:53.964 W/ActivityManager( 3189): Unable to start service Intent { act=com.heytap.accessory.ScanService pkg=com.heytap.accessory (has extras) } U=0: not found 11-01 18:48:53.964 W/ActivityManager( 3189): Unable to start service Intent { act=com.heytap.accessory.action.BASE_FRAMEWORK_MANAGER pkg=com.heytap.accessory } U=0: not found 11-01 18:48:53.965 W/ActivityManager( 3189): Receiver with filter android.content.IntentFilter@56b32fa already registered for pid 16357, callerPackage is com.oplus.onet 11-01 18:48:53.965 W/ActivityManager( 3189): Unable to start service Intent { act=com.heytap.accessory.action.BASE_FRAMEWORK_MANAGER pkg=com.heytap.accessory } U=0: not found 11-01 18:48:53.966 W/ActivityManager( 3189): Unable to start service Intent { act=com.heytap.accessory.ScanService pkg=com.heytap.accessory (has extras) } U=0: not found 11-01 18:48:53.966 W/ActivityManager( 3189): Unable to start service Intent { act=com.heytap.accessory.ScanService pkg=com.heytap.accessory (has extras) } U=0: not found这里疯狂唤醒com.heytap.accessory,于是把这个解冻了。第三次抓包发现一直在唤醒com.nearme.statistics.rom这个玩意,但是频次不是很高。搜索发现这是哪个用户体验计划,索性就不管了。同时在阅读了https://www.coolapk.com/feed/66547164这个大佬的文章之后。也是选择性的禁用软件。删除了olc和反馈工具箱这俩应用。其实从18年入手的第一台小米8开始,就开始了我的root之路。到现在已经七年了。也从小米换到了一加。从一个无脑安装模块的脚本小子,到了开始解读源码写程序的程序员。自己蜕变了好多,心态也老了好多。沉下心来做事,安安静静的学习!加油吧! typecho添加附件功能如果是图片就可以预览 https://blog.iletter.top/archives/492/ 2025-10-28T19:29:00+08:00 定位文件file-upload.php和file-upload-js.php。修改之前记得备份文件。更改了一下排序顺序,刚上传的放在最前面。如果是图片就可以简单预览缩略图。更改file-upload.php<?php if(!defined('__TYPECHO_ADMIN__')) exit; ?> <?php if (isset($post) || isset($page)) { $cid = isset($post) ? $post->cid : $page->cid; if ($cid) { \Widget\Contents\Attachment\Related::alloc(['parentId' => $cid])->to($attachment); } else { \Widget\Contents\Attachment\Unattached::alloc()->to($attachment); } } ?> <div id="upload-panel" class="p"> <div class="upload-area" draggable="true"><?php _e('拖放文件到这里<br>或者 %s选择文件上传%s', '<a href="###" class="upload-file">', '</a>'); ?></div> <ul id="file-list"> <?php while ($attachment->next()): ?> <li data-cid="<?php $attachment->cid(); ?>" data-url="<?php echo $attachment->attachment->url; ?>" data-image="<?php echo $attachment->attachment->isImage ? 1 : 0; ?>"> <input type="hidden" name="attachment[]" value="<?php $attachment->cid(); ?>" /> <a class="insert" title="<?php _e('点击插入文件'); ?>" href="###"><?php $attachment->title(); ?></a> <div class="info"> <?php echo number_format(ceil($attachment->attachment->size / 1024)); ?> Kb <a class="file" target="_blank" href="<?php $options->adminUrl('media.php?cid=' . $attachment->cid); ?>" title="<?php _e('编辑'); ?>"><i class="i-edit"></i>编辑</a> <a href="###" class="delete" title="<?php _e('删除'); ?>"><i class="i-delete"></i>删除</a> </div> <?php if ($attachment->attachment->isImage): ?> <div class="image-preview"> <img src="<?php echo $attachment->attachment->url; ?>" alt="<?php $attachment->title(); ?>" /> </div> <?php endif; ?> </li> <?php endwhile; ?> </ul> </div> <style> /* 为包含图片的列表项设置基础样式 */ #file-list li { margin-bottom: 10px; /* 列表项之间的间距 */ padding: 8px; /* 内边距 */ border: 1px solid #eee; /* 边框 */ border-radius: 4px; /* 圆角 */ background-color: #fafafa; /* 背景色 */ list-style: none; /* 去除默认列表符号 */ } /* 标题样式 */ #file-list li .insert { display: block; /* 使其独占一行 */ font-weight: bold; /* 标题加粗 */ margin-bottom: 4px; /* 与下方 .info 的间距 */ color: #333; /* 标题颜色 */ text-decoration: none; /* 去除下划线 */ } #file-list li .insert:hover { text-decoration: underline; /* 悬停时添加下划线 */ } /* 信息栏样式 */ #file-list li .info { font-size: 0.9em; /* 信息栏字体稍小 */ color: #666; /* 信息栏颜色 */ margin-bottom: 8px; /* 与下方图片的间距 */ line-height: 1.4; /* 行高 */ } /* 信息栏内的链接和图标 */ #file-list li .info a { margin-right: 8px; /* 链接之间的间距 */ color: #999; /* 图标颜色 */ text-decoration: none; } #file-list li .info a:hover { color: #007cba; /* 悬停时的颜色 */ } /* 图片预览容器 */ .image-preview { text-align: center; /* 图片居中 */ margin-top: 5px; /* 与上方 .info 的间距 */ clear: both; /* 清除浮动(如果有的话) */ } /* 图片样式 */ .image-preview img { max-width: 150px; /* 设置最大宽度 */ max-height: 150px; /* 设置最大高度 */ height: auto; /* 保持宽高比 */ border: 1px solid #ddd; /* 图片边框 */ border-radius: 4px; /* 图片圆角 */ padding: 2px; /* 图片内边距 */ background-color: #fff; /* 图片背景色,防止透明图有背景色干扰 */ box-shadow: 0 1px 3px rgba(0,0,0,0.1); /* 添加轻微阴影 */ } /* 加载状态样式 */ #file-list li.loading { color: #999; font-style: italic; } /* 删除按钮悬停效果 */ #file-list li a.delete:hover { color: #e74c3c !important; /* 删除按钮悬停时变为红色 */ } /* 编辑按钮悬停效果 */ #file-list li a.file:hover { color: #3498db !important; /* 编辑按钮悬停时变为蓝色 */ } </style>更改file-upload-js.php<?php if(!defined('__TYPECHO_ADMIN__')) exit; ?> <?php if (isset($post) && $post instanceof \Typecho\Widget && $post->have()) { $fileParentContent = $post; } elseif (isset($page) && $page instanceof \Typecho\Widget && $page->have()) { $fileParentContent = $page; } $phpMaxFilesize = function_exists('ini_get') ? trim(ini_get('upload_max_filesize')) : 0; if (preg_match("/^([0-9]+)([a-z]{1,2})$/i", $phpMaxFilesize, $matches)) { $phpMaxFilesize = strtolower($matches[1] . $matches[2] . (1 == strlen($matches[2]) ? 'b' : '')); } ?> <script src="<?php $options->adminStaticUrl('js', 'moxie.js'); ?>"></script> <script src="<?php $options->adminStaticUrl('js', 'plupload.js'); ?>"></script> <script> $(document).ready(function() { function updateAttacmentNumber () { var btn = $('#tab-files-btn'), balloon = $('.balloon', btn), count = $('#file-list li .insert').length; if (count > 0) { if (!balloon.length) { btn.html($.trim(btn.html()) + ' '); balloon = $('<span class="balloon"></span>').appendTo(btn); } balloon.html(count); } else if (0 == count && balloon.length > 0) { balloon.remove(); } } $('.upload-area').bind({ dragenter : function () { $(this).parent().addClass('drag'); }, dragover : function (e) { $(this).parent().addClass('drag'); }, drop : function () { $(this).parent().removeClass('drag'); }, dragend : function () { $(this).parent().removeClass('drag'); }, dragleave : function () { $(this).parent().removeClass('drag'); } }); updateAttacmentNumber(); function fileUploadStart (file) { $('<li id="' + file.id + '" class="loading">' + file.name + '</li>').appendTo('#file-list'); } function fileUploadError (error) { var file = error.file, code = error.code, word; switch (code) { case plupload.FILE_SIZE_ERROR: word = '<?php _e('文件大小超过限制'); ?>'; break; case plupload.FILE_EXTENSION_ERROR: word = '<?php _e('文件扩展名不被支持'); ?>'; break; case plupload.FILE_DUPLICATE_ERROR: word = '<?php _e('文件已经上传过'); ?>'; break; case plupload.HTTP_ERROR: default: word = '<?php _e('上传出现错误'); ?>'; break; } var fileError = '<?php _e('%s 上传失败'); ?>'.replace('%s', file.name), li, exist = $('#' + file.id); if (exist.length > 0) { li = exist.removeClass('loading').html(fileError); } else { li = $('<li>' + fileError + '<br />' + word + '</li>').appendTo('#file-list'); } li.effect('highlight', {color : '#FBC2C4'}, 2000, function () { $(this).remove(); }); // fix issue #341 this.removeFile(file); } var completeFile = null; function fileUploadComplete (id, url, data) { // 根据是否为图片来构建列表项内容 var itemContent = '<input type="hidden" name="attachment[]" value="' + data.cid + '" />'; // 添加标题和信息 itemContent += '<a class="insert" target="_blank" href="###" title="<?php _e('点击插入文件'); ?>">' + data.title + '</a>' + '<div class="info">' + data.bytes + ' <a class="file" target="_blank" href="<?php $options->adminUrl('media.php'); ?>?cid=' + data.cid + '" title="<?php _e('编辑'); ?>"><i class="i-edit"></i>编辑</a>' + ' <a class="delete" href="###" title="<?php _e('删除'); ?>"><i class="i-delete"></i>删除</a></div>'; // 如果是图片,添加预览图 (注意:这里图片放在 .info 之后,与PHP模板保持一致) if (data.isImage) { itemContent += '<div class="image-preview"><img src="' + data.url + '" alt="' + data.title + '" /></div>'; } // 创建 jQuery 对象 li var li = $('#' + id).removeClass('loading').data('cid', data.cid) .data('url', data.url) .data('image', data.isImage) .html(itemContent); // 先设置内容 // 关键修改:将新 li 插入到 #file-list 的最前面,而不是留在原地或追加到末尾 // 1. 先从当前位置移除(如果它在列表中的话,虽然通常在上传开始时是添加到列表末尾的空li) // 2. 然后插入到 #file-list 的开头 li.prependTo('#file-list'); // prependTo 将元素插入到目标元素的开头 // 绑定事件 attachInsertEvent(li); attachDeleteEvent(li); updateAttacmentNumber(); if (!completeFile) { completeFile = data; } } var uploader = null, tabFilesEl = $('#tab-files').bind('init', function () { uploader = new plupload.Uploader({ browse_button : $('.upload-file').get(0), url : '<?php $security->index('/action/upload' . (isset($fileParentContent) ? '?cid=' . $fileParentContent->cid : '')); ?>', runtimes : 'html5,flash,html4', flash_swf_url : '<?php $options->adminStaticUrl('js', 'Moxie.swf'); ?>', drop_element : $('.upload-area').get(0), filters : { max_file_size : '<?php echo $phpMaxFilesize ?>', mime_types : [{'title' : '<?php _e('允许上传的文件'); ?>', 'extensions' : '<?php echo implode(',', $options->allowedAttachmentTypes); ?>'}], prevent_duplicates : true }, init : { FilesAdded : function (up, files) { for (var i = 0; i < files.length; i ++) { fileUploadStart(files[i]); } completeFile = null; uploader.start(); }, UploadComplete : function () { if (completeFile) { Typecho.uploadComplete(completeFile); } }, FileUploaded : function (up, file, result) { if (200 == result.status) { var data = $.parseJSON(result.response); if (data) { fileUploadComplete(file.id, data[0], data[1]); uploader.removeFile(file); return; } } fileUploadError.call(uploader, { code : plupload.HTTP_ERROR, file : file }); }, Error : function (up, error) { fileUploadError.call(uploader, error); } } }); uploader.init(); }); Typecho.uploadFile = function (file, name) { if (!uploader) { $('#tab-files-btn').parent().trigger('click'); } var timer = setInterval(function () { if (!uploader) { return; } clearInterval(timer); timer = null; uploader.addFile(file, name); }, 50); }; // function attachInsertEvent (el) { // $('.insert', el).click(function () { // var t = $(this), p = t.parents('li'); // Typecho.insertFileToEditor(t.text(), p.data('url'), p.data('image')); // return false; // }); // } // 修改 attachInsertEvent 函数,使其能处理标题链接和图片 function attachInsertEvent (el) { // 为标题链接和图片(或其父容器 .image-preview)绑定点击事件 $('.insert, .image-preview img', el).click(function (e) { // 防止事件冒泡到父级 <a> 标签(如果图片被另一个链接包裹的话) e.stopPropagation(); var t = $(this); // 查找当前点击元素的父级 <li>,然后从中获取数据 var p = t.closest('li'); // 使用 closest 更可靠,可以找到最近的祖先 <li> // 确保找到了包含数据的 <li> 元素 if (p.length > 0) { // 从 <li> 元素获取数据 var url = p.data('url'); var isImage = p.data('image'); var title = p.find('.insert').first().text(); // 获取标题文本 // 调用 Typecho 提供的插入函数 Typecho.insertFileToEditor(title, url, isImage); } return false; // 阻止默认链接行为 }); } function attachDeleteEvent (el) { var file = $('a.insert', el).text(); $('.delete', el).click(function () { if (confirm('<?php _e('确认要删除文件 %s 吗?'); ?>'.replace('%s', file))) { var cid = $(this).parents('li').data('cid'); $.post('<?php $security->index('/action/contents-attachment-edit'); ?>', {'do' : 'delete', 'cid' : cid}, function () { $(el).fadeOut(function () { $(this).remove(); updateAttacmentNumber(); }); }); } return false; }); } $('#file-list li').each(function () { attachInsertEvent(this); attachDeleteEvent(this); }); }); </script> 服务器状态监控开发(设计+初步规划) https://blog.iletter.top/archives/472/ 2025-10-27T16:19:00+08:00 项目说明简述用于监控服务器状态。api用于服务器状态上报,上报到admin里面的接口,通过token进行设备识别。部署方式需安装lombok插件,不然会提示找不到entity的get set方法创建数据库mydatabase,数据库编码为UTF-8执行db/mydatabase.sql文件,初始化数据修改application-dev.yml文件,更新MySQL账号和密码IDEA运行AdminApplication.java,则可启动项目【admin】vscode运行前端项目npm install安装依赖vscode运行前端项目npm run dev 运行项目前端访问路径:http://localhost:8001/admin接口文档路径:http://localhost:8080/admin/doc.htmlclient 接口文档路径:http://localhost:8081/api/doc.html账号密码:admin 密码应该是123456或者admin我也忘记了设计规划双端admin为服务端后台,sys_monitor_FrontEnd为服务器端前台项目client为客户端,仅需配置好客户端的server-monitor的内容即可功能规划 client作为数据主动推送,每隔1s(自定义时间)进行信息状态推送。api传输地址标识比如 传入服务器名称和识别token。 在线ssh功能/在线终端 frp穿透功能 点击服务器查看服务器详情信息,即查看该服务器的当前心跳信息及其基本信息 admin后端日志筛选方式:昨天/今天/最近七天/自定义事件 客户端单次上报基础信息/config/reporting服务器资源压力指数计算RPI = w_cpu × (CPU_usage / CPU_max) + w_mem × (Mem_usage / Mem_total) + N(w_disk x (Disk_usage / Disk_total))CPU_usage:当前 CPU 使用率(例如 45 表示 45%)CPU_max:通常为 100 × 核心数(但更推荐使用 整体使用率百分比,即 0~100% 范围,避免多核复杂化)Mem_usage:已用内存(单位 MB 或 GB)Mem_total:总物理内存N代表有几块磁盘,根据实际情况进行计算Disk_usage:已用磁盘空间(单位 MB 或 GB)Disk_total:总磁盘空间w_cpu 、w_mem 、w_disk :权重,满足 w_cpu + w_mem + w_disk = 1未涉及到使用swap和使用率超90%的阈值惩罚的功能。关键数据库结构服务器信息存储表字段名称类型注释idbigintid编号server_namevarchar服务器名称tokenvarchar与客户端一致的token(唯一性)可以自动生成isEmailvarchar是否启用邮件告警(1开启 0关闭)ip_addrvarcharip地址(map存储,公网ip和局域网ip,手动设置)server_pwdvarchar服务密码(map存储,ssh密码,桌面密码,mysql密码等保存方式)service_providervarchar提供厂商(阿里云/腾讯云/家用服务器)remarklongtext备注信息create_timedatetime创建时间create_uservarchar创建人update_timedatetime更新时间update_uservarchar更新人接收客户端心跳信息表字段名称类型注释 id编号(雪花算法) 主机名称 主机token 平均负载 当前负载 cpu负载 cpu温度 内存占比 剩余可用内存 磁盘占用 (当前容量/总容量) 磁盘IO (读取/写入/每秒读写/IO延迟) 网络IO (上行/下行/总发送/总接收) 当前进程所占用的进程top10(map存储)记录pid、进程名、cpu占用、内存占用 创建时间仓库地址:https://gitee.com/wonder19991209/sys-monitor wireguard组网搭建windows远程桌面可用但是无法ssh https://blog.iletter.top/archives/471/ 2025-10-22T15:33:00+08:00 因为wireguard搭建的组网是public的。所以但是open ssh允许的是私有网络的。所以在此需要改一下网络类型。Set-NetConnectionProfile -InterfaceAlias "winServer2025" -NetworkCategory PrivatewinServer2025为我的配置文件名称,你可以根据你的去变更变更完毕之后通过 Get-NetConnectionProfile 进行查看。此时在进行ssh链接即可成功。其实还有一种方式就是直接关闭防火墙简单暴力。。。 开机显示windows无法完成安装,解决方法 https://blog.iletter.top/archives/470/ 2025-10-21T21:41:00+08:00 1.等待报错出现2.按住shift+F10 进入cmd界面3.输入regedit编辑注册表4.找到路径 计算机\HKEY_LOCAL_MACHINE\SYSTEM\Setup5.编辑内部数据OOBEInProgress 设置为 0CmdLine 设置为空,即删除里面的数据SetupPhase 设置为 0SetupType 设置为 0SystemSetupInProgress 设置为 06.再次打开 cmd 窗口 输入以下命令行net user administrator /active:yes然后重启系统即可正常进入系统。 再聚 · 共饮 https://blog.iletter.top/archives/469/ 2025-10-03T08:54:00+08:00 构建AI个人知识库的一些思考 https://blog.iletter.top/archives/468/ 2025-09-25T21:51:00+08:00 最近在使用obsidian+Copilot虽然使用确实不错,但是总感觉差点味道。今天试了试python搞得rag向量数据库+ai模型,跑起来还是不错,但感觉和obsidian+Copilot大差不差。但至于差在哪里,却一眼难尽。单篇文章分析,都是可以的。多文章分析就报废了。所以有个思路针对md文档必须有严格的限制,在此使用markdown文章的yaml标签案例。例如--- 标题: git拆分分支和合并分支 日期: 2025-09-24 作者: Del Levin 分类: - 技术笔记 - 其他 tags: - 技术笔记 - git - 运维 - windows --- 构建数据库->检索 结构化检索方式:指定统计方式,分析方式非结构化检索方式:ai分析检索方式:分类词:{classification[分类词1,分类词2]}标签 :{tags[标签1,标签2]}指定文章:{title[文章名称1,文章名称2]}提问方式为:1.根据{classification[分类词1,分类词2]}分类总结一下我这个人2.根据{tags[标签1,标签2]}标签总结一下我的技术栈3.{title[文章名称1,文章名称2]}总结一下这两篇文章4.{title[文章名称1]}总结一下这一篇文章理想很美好,现实很骨感,知识库的容量参考文件不支持那么多。要想真正实现,只能拿自己的笔记进行模型训练。可是模型数据基数不足,成为一个问题。我也不知道该怎么做了。。。。 利用wireduard实现windows远控macos https://blog.iletter.top/archives/466/ 2025-09-17T23:13:00+08:00 wireduard之前搭建过。在此不做赘述。图简单的话,可以拉docker的wg-easy进行运行。搭建好之后,服务器给windows生成配置。[Interface] PrivateKey = 私钥 Address = 10.8.0.3/24 [Peer] PublicKey = 公钥 PresharedKey = Xtz5vzzicOncQe3Dt8LMFIbdxa/XUepY9hAllrJ3k30= AllowedIPs = 10.8.0.0/24 Endpoint = 152.136.153.72:51820然后开始macos的操作,首先,你需要有一个Homebrew来用于安装软件。macos安装wireguard步骤1. 安装 WireGuard使用 Homebrew 安装 WireGuard 工具包:brew install wireguard-tools3. 配置 WireGuard使用下面的命令创建配置文件:sudo vim /opt/homebrew/etc/wireguard/wg0.conf编辑配置文件,添加以下内容:[Interface] PrivateKey = 私钥 Address = 10.8.0.7/24 MTU = 1540 [Peer] PublicKey = 公钥 PresharedKey = AllowedIPs = 10.8.0.0/24 Endpoint = 152.136.153.72:51820 PersistentKeepalive = 25一切配置好之后,安装图形化界面WireGuardStatusbar去https://github.com/aequitas/macos-menubar-wireguard这个链接下载文件安装。安装完毕之后,启动wg0这个就可以了。不想安装的话可以使用这个命令去开启sudo wg-quick up wg0关闭sudo wg-quick down wg0 git拆分分支和合并分支 https://blog.iletter.top/archives/465/ 2025-09-03T14:02:00+08:00 如果有test分支和master分支的话,如何合并呢?使用merge即可完成。(merge:保留完整的分支历史,生成一个合并提交)# 1. 切换到master分支 git checkout master # 2. 将test分支合并到master git merge test如果有冲突需要解决如果在合并过程中出现冲突,需要手动解决:# 1. 查看冲突文件 git status # 2. 手动编辑冲突文件,解决冲突 # 3. 添加解决后的文件 git add . # 4. 完成合并 git commit查看本地分支git branch查看所有分支(包括远程分支)git branch -a查看远程分支git branch -r查看分支的详细信息git branch -v在你的项目中运行 git branch,应该能看到类似这样的输出:* master test遇到分离HEAD 的情况DELLEVIN@DESKTOP-HISDDCH D:\Proj_Dev\Other\xyjq\xyjq-mp-vue git:6afbbee ❯❯❯ git branch * (HEAD detached from d7244e3) master test方法一:将当前更改合并到master分支# 1. 切换到master分支 git checkout master # 2. 将之前分离HEAD状态下的更改合并过来 # 如果你知道那个commit的hash(比如d7244e3),可以这样: git merge d7244e3方法二:直接基于当前状态创建新分支# 1. 基于当前状态创建并切换到新分支 git checkout -b new_feature # 2. 切换到master git checkout master # 3. 合并新分支 git merge new_feature # 4. 删除临时分支(可选) git branch -d new_feature 让typecho的access插件使用ip2region 地址库 https://blog.iletter.top/archives/459/ 2025-08-28T22:42:00+08:00 旧版本的typecho的access插件记录的ip太过于落后了。判断也有很多问题,所以需要在此更新一下。定位到地址文件是lib下面的ipipfree.ipdb,删掉这个就好,用不到了。这个最近的时间是2019年的。真的很无语的。接下来定位到所在位置是Access_Core.php这个文件的这里代码。(Access_IpDb.php这个也可以删除) try { $ipdb = new Access_IpDb(dirname(__file__).'/lib/ipipfree.ipdb'); $city = $ipdb->findInfo($ip, 'CN'); // 写入日志 error_log("IP: {$ip}\nCity Info: " . print_r($city, true), 3, '/tmp/access_debug.log'); $ip_country = $city->country_name; if($ip_country == '中国') { $ip_province = $city->region_name; $ip_city = $city->city_name; } else { $ip_province = $ip_city = NULL; } } catch(Exception $e) { $ip_country = $ip_province = $ip_city = '未知'; } 然后根据数据格式,改成他的数据样式的。try { // 检查必要的文件是否存在 $dbFile = dirname(__FILE__) . '/lib/ip2region.xdb'; $classFile = dirname(__FILE__) . '/lib/XdbSearcher.php'; if (!file_exists($dbFile)) { throw new Exception("Ip2region database file not found: {$dbFile}"); } if (!file_exists($classFile)) { throw new Exception("XdbSearcher class file not found: {$classFile}"); } require_once $classFile; $searcher = XdbSearcher::newWithFileOnly($dbFile); $region = $searcher->search($ip); if ($region === null) { throw new Exception("IP2Region search failed for IP: {$ip}"); } // 调试日志 error_log("IP: {$ip}\nRegion Info: " . print_r($region, true), 3, '/tmp/access_debug.log'); // 解析数据 (格式: 国家|区域|省份|城市|ISP) $regionArray = explode('|', $region); // 清理数据 $cleanData = function($data) { return (!empty($data) && $data !== '0') ? $data : ''; }; $country = $cleanData($regionArray[0]); $region_info = $cleanData($regionArray[1]); $province = $cleanData($regionArray[2]); $city = $cleanData($regionArray[3]); // 设置最终保存到数据库的字段 $ip_country = !empty($country) ? $country : '未知'; // 无论国内外都保存区域和城市信息 $ip_province = ''; $ip_city = ''; if (!empty($province)) { $ip_province = $province; } elseif (!empty($region_info)) { // 如果省份为空,但区域不为空,可以用区域代替 $ip_province = $region_info; } if (!empty($city)) { $ip_city = $city; } } catch(Exception $e) { error_log("IP解析异常:" . $e->getMessage(), 3, '/tmp/access_debug.log'); $ip_country = '未知'; $ip_province = ''; $ip_city = ''; }这样就可以了。