[{"content":"icon icon 推荐库 nutui taro reactnative Ant Design Vue 静态资源 CDN uiverse 组件库 css 效果库 质料库 lodashjs ","date":"2026-04-18T00:00:00Z","permalink":"/p/ui/","title":"ui"},{"content":"Css To UnoCss 中文网 icon uniapp 参考 动画 Tailwind CSS 备忘清单 ","date":"2026-04-18T00:00:00Z","permalink":"/p/unocss/","title":"unocss"},{"content":"https://ziyuan.baidu.com/property/index?site=https://kecaicloud.com/#/ https://tongji.baidu.com/web5/welcome/login https://www.lecaiyun.com/ ","date":"2026-04-18T00:00:00Z","permalink":"/p/%E7%99%BE%E5%BA%A6/","title":"百度"},{"content":"一流导航 ","date":"2026-04-18T00:00:00Z","permalink":"/p/%E5%AF%BC%E8%88%AA/","title":"导航"},{"content":"EasyTier https://openid.13a.com/login cf 其他 ","date":"2026-04-18T00:00:00Z","permalink":"/p/%E5%86%85%E7%BD%91%E7%A9%BF%E9%80%8F/","title":"内网穿透"},{"content":"测速 cloudflare 科学技术大学 测试 https://ipw.cn/ https://test-ipv6.com/ https://ifconfig.co/ https://ipv6ready.me/index.html.zh_CN 纯净度 https://ippure.com/ https://ipleak.net/ https://iplark.com/ 免费公共 DNS 服务器大全 https://dns.icoa.cn/ https://dns.iui.im/ipv6/ nat https://natchecker.com/zh 大全 https://www.itdog.cn/ ","date":"2026-04-13T00:00:00Z","permalink":"/p/ip/","title":"ip"},{"content":"规范参考 git历史合并（Simple） 拉取项目删除git 创建新的git并且推送 合并远程\n1 2 3 控制台找到命令 加上 --allow-unrelated-histories git -c credential.helper= -c core.quotepath=false -c log.showSignature=false merge yc/main --allow-unrelated-histories 解决冲突 git commit :q 退出 可以推送了\nGit 搜索\nin:name springboot stars:\u0026gt;4000 pushed:\u0026gt;2020-01-01 language:java forks:\u0026gt;1000\n证书问题 1 2 3 4 5 git config --get http.sslCAInfo git config http.sslCAInfo \u0026#34;D:/must/Git/mingw64/etc/ssl/certs/ca-bundle.crt\u0026#34; git config --system http.sslCAInfo \u0026#34;D:/must/Git/mingw64/etc/ssl/certs/ca-bundle.crt\u0026#34; 初始化仓库 git init\n2)、设置Git签名： git config user.name zhangsan git config user.email zhangsan@163.com git config --global user.name lisi git config --global user.email lisi@163.com 3)、查看本地库的状态： git status 4)、把工作区中的文件添加到暂存区： git add 文件名或者 . 5)、从暂存区撤回文件： git rm \u0026ndash;cached 文件名 6)、把文件提交到本地库： git commit 文件名 -m 日志 7)、查看git的提交日志： git log 8)、回退到指定版本： git reset \u0026ndash;hard 版本号\n​\tgit reset \u0026ndash;hard HEAD^^ 上两个版本\n​\t9)、还原文件（磁盘中没有，仓库中有）\n​\tgit checkout 文件\n​\t删除仓库中的文件 git rm \u0026ndash;cached 文件\n​\t10)、彻底删除文件\n​\tgit rm 文件\ngit 忽略文件配置 .gitignore\n【!】文件\n【!】文件夹\n分支管理 1)、查看分支： git branch -v 2)、创建分支： git branch 分支名称 3)、切换分支： git checkout 分支名 4)、合并分支：(合并到主干分支) 首先，切换到主干分支； 然后，执行命令：git merge 被合并分支名 5)、删除分支： git branch -d 分支名\n使用Github 1)、注册账号： 2)、在Github上创建一个远程仓库： 3)、把本地库中的工程上传到远程仓库： 1)、给远程仓库的url起别名： git remote -v git remote add mygithub https://github.com/yangaofei/init-repository.git ​ 2)、把本地库中的工程上传到远程仓库： ​ git push mygithub master\n获取一次分支\n​ git push mygithub master:本地分支名称\n删除远程分支 git push -d mygithub 分支\n从远程仓库中克隆工程到本地库 ​ git clone 【-d 指定远程仓库分支】 连接 【自定义名字】\n5)、从远程仓库更新文件： 第一种方式：分两步 第一步：从远程仓库抓取数据 git fetch origin master 第二步：合并数据 git merge origin/master 第二种方式：一步拉取 git pull origin 远程分支名称:本地分支名称\n撤销提交log日志 CRM-project # 撤销本地最后一条记录，如果需要撤销最后提交的N条记录，将“1”替换为一个具体的数字“N”即可。 git reset \u0026ndash;hard HEAD~1\n# 显示每次修改的文件列表及修改状态 git log \u0026ndash;name-status\n# 显示每次修改的文件列表 git log \u0026ndash;name-only\n# 显示每次修改的文件列表及文件修改的统计 git log \u0026ndash;stat\n# 显示每次修改的文件列表 git whatchanged\n# 显示每次修改的文件列表及统计信息 git whatchanged \u0026ndash;stat\n# 显示最后一次的文件改变的具体内容 git show\nidea集成git 1)、idea集成git：File\u0026mdash;\u0026gt;Settings\u0026ndash;\u0026gt;Version Control\u0026mdash;\u0026gt;Git 2)、设置全局签名： 3)、把idea的工程转化为本地库： 4)、把idea工程添加到暂存区 5)、把idea工程提交到本地库 6)、把idea工程分享到远程库 7)、把idea本地更新推送到远程库 8)、从远程库克隆工程到idea 9)、从远程库更新数据到idea工程\ngitlab系统查看及设置等相关命令 sudo gitlab-ctl start # 启动所有 gitlab 组件；\nsudo gitlab-ctl stop # 停止所有 gitlab 组件；\nsudo gitlab-ctl restart # 重启所有 gitlab 组件；\nsudo gitlab-ctl status # 查看服务状态；\nsudo gitlab-ctl reconfigure # 启动服务；\nsudo vim /etc/gitlab/gitlab.rb # 修改默认的配置文件；\nsudo gitlab-ctl tail # 查看日志；\n","date":"2026-04-12T00:00:00Z","permalink":"/p/git/","title":"git"},{"content":"下载 rabbitmq基于erlang语言需要erlang环境\nerlang官网下载地址 个人下载网站 https://www.erlang.org/downloads rabbitmq官网下载地址 https://www.rabbitmq.com/download.html Windows Installer\nwindows进去后还要下拉到中间位置点击这个下载 Direct Downloads\n安装 erlang无脑一下步就行了，可以自己配置一下安装目录\n配置rabbitmq环境变量 %ERLANG_HOME%\\bin\nrabbitmq无脑一下步就行了，可以自己配置一下安装目录\n安装RabbitMQ-Plugins 有了这个就能在浏览器中查看 RabbitMQ 了 cmd进入 /sbin 下，输入\n1 rabbitmq-plugins enable rabbitmq_management 浏览器中输入 http://localhost:15672 就能看到 RabbitMQ的首页，默认账号与密码为 guest\n","date":"2026-04-12T00:00:00Z","permalink":"/p/mq/","title":"mq"},{"content":"参考 使用 Service worker 实现加速/离线访问博客 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 \u0026lt;!-- 注册 Service Worker 加速访问 --\u0026gt; \u0026lt;script\u0026gt; if (\u0026#39;serviceWorker\u0026#39; in navigator) { window.addEventListener(\u0026#39;load\u0026#39;, function() { navigator.serviceWorker.register(\u0026#39;/sw.js?v=22\u0026#39;); }); } \u0026lt;/script\u0026gt;\u0026lt;/div\u0026gt; \u0026lt;div style=\u0026#34;margin-top:2px; margin-top:6px;\u0026#34;\u0026gt; GMT+8, 2021-11-18 20:27, PE: 0.011677s , QE: 3, Redis On.\u0026lt;/div\u0026gt; \u0026lt;/div\u0026gt; \u0026lt;/div\u0026gt; \u0026lt;!-- 百度统计 --\u0026gt; \u0026lt;script\u0026gt; var _hmt = _hmt || []; _hmt.push([\u0026#39;_setUserId\u0026#39;, window.discuz_uid]); (function() { var hm = document.createElement(\u0026#34;script\u0026#34;); hm.src = \u0026#34;https://hm.baidu.com/hm.js?8cf683f51eb4795c5d09446e920329c3\u0026#34;; var s = document.getElementsByTagName(\u0026#34;script\u0026#34;)[0]; s.parentNode.insertBefore(hm, s); })(); \u0026lt;/script\u0026gt; \u0026lt;!-- Google 统计 --\u0026gt; \u0026lt;script src=\u0026#34;https://www.googletagmanager.com/gtag/js?id=UA-17880378-3\u0026#34; type=\u0026#34;text/javascript\u0026#34;\u0026gt;\u0026lt;/script\u0026gt; \u0026lt;script\u0026gt; window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag(\u0026#39;js\u0026#39;, new Date()); gtag(\u0026#39;config\u0026#39;, \u0026#39;UA-17880378-3\u0026#39;, { \u0026#39;user_id\u0026#39;: window.discuz_uid }); \u0026lt;/script\u0026gt; \u0026lt;/div\u0026gt; \u0026lt;script src=\u0026#34;home.php?mod=misc\u0026amp;ac=sendmail\u0026amp;rand=1637238465\u0026#34; type=\u0026#34;text/javascript\u0026#34;\u0026gt;\u0026lt;/script\u0026gt; ","date":"2026-04-12T00:00:00Z","permalink":"/p/ssr/","title":"ssr"},{"content":"google 谷歌书签无法及时同步问题解决 下载（待测） 1 2 win11 cmd winget install Google.Chrome ","date":"2026-04-12T00:00:00Z","permalink":"/p/google/","title":"谷歌 google"},{"content":"OSI模型 开放式系统互联通信参考模型（英语：Open System Interconnection Reference Model，缩写为 OSI），简称为OSI模型（OSI model），一种概念模型，由国际标准化组织提出，一个试图使各种计算机在世界范围内互连为网络的标准框架。定义于ISO/IEC 7498-1。\nOSI/RM协议是由ISO(国际标准化组织）制定的，它有三个基本的功能：提供给开发者一个必须的、通用的概念以便开发完善、可以用来解释连接不同系统的框架。 [1]\nOSI将计算机网络体系结构(architecture）划分为以下七层：\n物理层 : 将数据转换为可通过物理介质传送的电子信号 相当于邮局中的搬运工人。\n数据链路层 : 决定访问网络介质的方式。\n在此层将数据分帧，并处理流控制。本层指定拓扑结构并提供硬件寻址，相当于邮局中的装拆箱工人。\n网络层 : 使用权数据路由经过大型网络 相当于邮局中的排序工人。\n传输层 : 提供终端到终端的可靠连接 相当于公司中跑邮局的送信职员。\n会话层 : 允许用户使用简单易记的名称建立连接 相当于公司中收寄信、写信封与拆信封的秘书。\n表示层 : 协商数据交换格式 相当公司中简报老板、替老板写信的助理。\n应用层 : 用户的应用程序和网络之间的接口。\n根据建议X.200，OSI将计算机网络体系结构划分为以下七层，标有1～7，第1层在底部。 现“OSI/RM”是英文 “Open Systems Interconnection Reference Model”的缩写。\n第7层 应用层 主条目：应用层 应用层（Application Layer）提供为应用软件而设的接口，以设置与另一应用软件之间的通信。例如: HTTP，HTTPS，FTP，TELNET，SSH，SMTP，POP3等。\n第6层 表达层 主条目：表达层\n表达层（Presentation Layer）把数据转换为能与接收者的系统格式兼容并适合传输的格式。\n第5层 会话层 主条目：会话层 会话层（Session Layer）负责在数据传输中设置和维护计算机网络中两台计算机之间的通信连接。\n第4层 传输层 主条目：传输层 传输层（Transport Layer）把传输表头（TH）加至数据以形成数据包。传输表头包含了所使用的协议等发送信息。例如:传输控制协议（TCP）等。\n第3层 网络层 主条目：网络层 网络层（Network Layer）决定数据的路径选择和转寄，将网络表头（NH）加至数据包，以形成分组。网络表头包含了网络数据。例如:互联网协议（IP）等。\n第2层 数据链路层 主条目：数据链路层 数据链路层（Data Link Layer）负责网络寻址、错误侦测和改错。当表头和表尾被加至数据包时，会形成帧。数据链表头（DLH）是包含了物理地址和错误侦测及改错的方法。数据链表尾（DLT）是一串指示数据包末端的字符串。例如以太网、无线局域网（Wi-Fi）和通用分组无线服务（GPRS）等。\n分为两个子层：逻辑链路控制（logic link control，LLC）子层和介质访问控制（media access control，MAC）子层。\n第1层 物理层 主条目：物理层 物理层（Physical Layer）在局部局域网上传送数据帧 （data frame），它负责管理计算机通信设备和网络媒体之间的互通。包括了针脚、电压、线缆规范、集线器、中继器、网卡、主机适配器等。\nTCP/IP协议（面向连接的可靠的传输协议） SYN：代表请求创建连接，所以在三次握手中前两次要SYN=1，表示这两次用于建立连接，至于第三次什么用，在疑问三里解答。\nFIN：表示请求关闭连接，在四次分手时，我们发现FIN发了两遍。这是因为TCP的连接是双向的，所以一次FIN只能关闭一个方向。\nACK：代表确认接受，从上面可以发现，不管是三次握手还是四次分手，在回应的时候都会加上ACK=1，表示消息接收到了，并且在建立连接以后的发送数据时，都需加上ACK=1,来表示数据接收成功。\nseq:序列号，什么意思呢？当发送一个数据时，数据是被拆成多个数据包来发送，序列号就是对每个数据包进行编号，这样接受方才能对数据包进行再次拼接。\n初始序列号是随机生成的，这样不一样的数据拆包解包就不会连接错了。（例如：两个数据都被拆成1，2，3和一个数据是1，2，3一个是101，102，103，很明显后者不会连接错误）\n**ack:**这个代表下一个数据包的编号，这也就是为什么第二请求时，ack是seq+1\n三次握手 SYN SYN+ACK ACK\n在创建连接时，\n1.客户端首先要SYN=1,表示要创建连接，\n2.服务端接收到后，要告诉客户端：我接受到了！所以加个ACK=1，就变成了ACK=1,SYN=1\n3.理论上这时就创建连接成功了，但是要防止一个意外（见疑问三），所以客户端要再发一个消息给服务端确认一下，这时只需要ACK=1就行了。\n三次握手完成！\n四次分手 FIN ACK FIN+ACK ACK\n在四次分手时，\n1.首先客户端请求关闭客户端到服务端方向的连接，这时客户端就要发送一个FIN=1，表示要关闭一个方向的连接（见上面四次分手的图）\n2.服务端接收到后是需要确认一下的，所以返回了一个ACK=1\n3.这时只关闭了一个方向，另一个方向也需要关闭，所以服务端也向客户端发了一个FIN=1 ACK=1\n4.客户端接收到后发送ACK=1，表示接受成功\n四次分手完成！\nSocket 套接字\n插座\n四元组 ip:port + ip:port\n端口默认有：65535\n","date":"2026-04-12T00:00:00Z","permalink":"/p/network/","title":"网络 network"},{"content":"fitgirl byrut ","date":"2026-04-12T00:00:00Z","permalink":"/p/game/","title":"游戏 game"},{"content":"使用idea 无法下载源码 解决 Sources not found for: 解决方案：在对应的pom.xml 文件中打开 terminal，执行 mvn命令：\n1 2 mvn dependency:sources mvn dependency:resolve -Dclassifier=javadoc 下载源配置 idea maven 参考 修改idea 默认maven配置\n1 安装目录下 IntelliJ IDEA\\plugins\\maven\\lib\\maven3\\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 \u0026lt;settings xmlns=\u0026#34;http://maven.apache.org/SETTINGS/1.0.0\u0026#34; xmlns:xsi=\u0026#34;http://www.w3.org/2001/XMLSchema-instance\u0026#34; xsi:schemaLocation=\u0026#34;http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd\u0026#34;\u0026gt; \u0026lt;!-- 本地仓库配置 --\u0026gt; \u0026lt;localRepository\u0026gt;D:\\BianCheng\\Repositories\\Maven\u0026lt;/localRepository\u0026gt; \u0026lt;pluginGroups\u0026gt; \u0026lt;/pluginGroups\u0026gt; \u0026lt;proxies\u0026gt; \u0026lt;/proxies\u0026gt; \u0026lt;servers\u0026gt; \u0026lt;/servers\u0026gt; \u0026lt;mirrors\u0026gt; \u0026lt;!-- nexus-aliyun 首选，放第一位,有不能下载的包，再去做其他镜像的选择 --\u0026gt; \u0026lt;!-- 阿里云镜像 --\u0026gt; \u0026lt;mirror\u0026gt; \u0026lt;id\u0026gt;nexus-aliyun\u0026lt;/id\u0026gt; \u0026lt;mirrorOf\u0026gt;central\u0026lt;/mirrorOf\u0026gt; \u0026lt;name\u0026gt;Nexus aliyun\u0026lt;/name\u0026gt; \u0026lt;url\u0026gt;http://maven.aliyun.com/nexus/content/groups/public\u0026lt;/url\u0026gt; \u0026lt;/mirror\u0026gt; \u0026lt;!-- maven官方2号镜像 --\u0026gt; \u0026lt;mirror\u0026gt; \u0026lt;id\u0026gt;repo2\u0026lt;/id\u0026gt; \u0026lt;name\u0026gt;Mirror from Maven Repo2\u0026lt;/name\u0026gt; \u0026lt;url\u0026gt;http://repo2.maven.org/maven2/\u0026lt;/url\u0026gt; \u0026lt;mirrorOf\u0026gt;central\u0026lt;/mirrorOf\u0026gt; \u0026lt;/mirror\u0026gt; \u0026lt;!-- maven的UK镜像 --\u0026gt; \u0026lt;mirror\u0026gt; \u0026lt;id\u0026gt;ui\u0026lt;/id\u0026gt; \u0026lt;name\u0026gt;Mirror from UK\u0026lt;/name\u0026gt; \u0026lt;url\u0026gt;http://uk.maven.org/maven2/\u0026lt;/url\u0026gt; \u0026lt;mirrorOf\u0026gt;central\u0026lt;/mirrorOf\u0026gt; \u0026lt;/mirror\u0026gt; \u0026lt;!-- JBoss 镜像 --\u0026gt; \u0026lt;mirror\u0026gt; \u0026lt;id\u0026gt;jboss-public-repository-group\u0026lt;/id\u0026gt; \u0026lt;mirrorOf\u0026gt;central\u0026lt;/mirrorOf\u0026gt; \u0026lt;name\u0026gt;JBoss Public Repository Group\u0026lt;/name\u0026gt; \u0026lt;url\u0026gt;http://repository.jboss.org/nexus/content/groups/public\u0026lt;/url\u0026gt; \u0026lt;/mirror\u0026gt; \u0026lt;mirror\u0026gt; \u0026lt;id\u0026gt;mirrorId\u0026lt;/id\u0026gt; \u0026lt;mirrorOf\u0026gt;central\u0026lt;/mirrorOf\u0026gt; \u0026lt;name\u0026gt;Human Readable Name for this Mirror.\u0026lt;/name\u0026gt; \u0026lt;url\u0026gt;http://central.maven.org/maven2/\u0026lt;/url\u0026gt; \u0026lt;/mirror\u0026gt; \u0026lt;/mirrors\u0026gt; \u0026lt;profiles\u0026gt; \u0026lt;/profiles\u0026gt; \u0026lt;/settings\u0026gt; scope各种取值详解 scope取值 有效范围（compile, runtime, test） 依赖传递 例子 compile all 是 spring-core provided compile, test 否 servlet-api runtime runtime, test 是 JDBC驱动 test\ttest 否 JUnit system compile, test 是 compile ：为默认的依赖有效范围。如果在定义依赖关系的时候，没有明确指定依赖有效范围的话，则默认采用该依赖有效范围。此种依赖，在编译、运行、测试时均有效。\nprovided ：在编译、测试时有效，但是在运行时无效。例如：servlet-api，运行项目时，容器已经提供，就不需要Maven重复地引入一遍了。\nruntime ：在运行、测试时有效，但是在编译代码时无效。例如：JDBC驱动实现，项目代码编译只需要JDK提供的JDBC接口，只有在测试或运行项目时才需要实现上述接口的具体JDBC驱动。\ntest ：只在测试时有效，例如：JUnit。\nsystem ：在编译、测试时有效，但是在运行时无效。和provided的区别是，使用system范围的依赖时必须通过systemPath元素显式地指定依赖文件的路径。由于此类依赖不是通过Maven仓库解析的，而且往往与本机系统绑定，可能造成构建的不可移植，因此应该谨慎使用。systemPath元素可以引用环境变量。\n排除jar 参考1 ","date":"2026-04-02T00:00:00Z","permalink":"/p/maven/","title":"maven"},{"content":"mysql null count 参考 count(1)、count()、count（字段） 推荐count() 参考 mybatis plus 热更新 参考 参考 参考 备份恢复xbstream 1 2 3 4 5 6 7 8 9 10 11 12 yum -y install https://repo.percona.com/yum/percona-release-latest.noarch.rpm yum -y install percona-xtrabackup-24 yum -y install qpress innobackupex -version # 解压 xbstream -x -C ./simple/ \u0026lt; **.xbstream # 再次解压 innobackupex --decompress --parallel=6 --compress-threads=6 ./simple/ # 然后新建数据库 表 alter table xxx DISCARD TABLESPACE; alter table xxx IMPORT TABLESPACE; # 放入ibd 完成！ typeHandler问题 JsonArrayTypeHandler 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 import com.baomidou.mybatisplus.core.toolkit.Assert; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.JavaType; import com.fasterxml.jackson.databind.type.TypeFactory; import com.simple.common.json.utils.JsonUtils; import lombok.extern.slf4j.Slf4j; import org.apache.ibatis.type.JdbcType; import org.apache.ibatis.type.MappedJdbcTypes; import org.apache.ibatis.type.MappedTypes; import org.springframework.core.ResolvableType; import java.io.IOException; import java.lang.reflect.Type; /** * 自定义json类型处理类(支持泛型) * * @author Simple */ @Slf4j @MappedTypes({Object.class}) @MappedJdbcTypes(JdbcType.VARCHAR) public class JsonArrayTypeHandler\u0026lt;T\u0026gt; extends AbstractJsonTypeHandler\u0026lt;T\u0026gt; { private final JavaType javaType; public JsonArrayTypeHandler() { ResolvableType resolvableType = ResolvableType.forClass(getClass()); Type type = resolvableType.as(JsonArrayTypeHandler.class).getGeneric().getType(); javaType = constructType(type); } public static JavaType constructType(Type type) { Assert.notNull(type, \u0026#34;[Assertion failed] - type is required; it must not be null\u0026#34;); return TypeFactory.defaultInstance().constructType(type); } @Override protected T parse(String json) { try { System.out.println(javaType); return JsonUtils.getObjectMapper().readValue(json, javaType); } catch (IOException e) { throw new RuntimeException(e); } } @Override protected String toJson(T obj) { try { return JsonUtils.getObjectMapper().writeValueAsString(obj); } catch (JsonProcessingException e) { throw new RuntimeException(e); } } } 使用 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 import com.baomidou.mybatisplus.extension.handlers.JsonArrayTypeHandler; import x.domain.x; import org.apache.ibatis.type.JdbcType; import org.apache.ibatis.type.MappedJdbcTypes; import org.apache.ibatis.type.MappedTypes; import java.util.ArrayList; import java.util.List; /** * @author Simple */ @MappedJdbcTypes(JdbcType.VARCHAR) @MappedTypes(ArrayList.class) public class xTypeHandler extends JsonArrayTypeHandler\u0026lt;List\u0026lt;x\u0026gt;\u0026gt; { } Mysql数据库导出导入中GTID引发的问题 参考 修改密码 参考 环境变量 lower_case_table_names(推荐1) 参考 参考 UML图 StarUML汉化版 参考 explicit_defaults_for_timestamp 参考 安装 ①安装服务：mysqld \u0026ndash;install\n②初始化：　mysqld \u0026ndash;initialize \u0026ndash;console\n③开启服务：net start mysql\n④关闭服务：net stop mysql\n⑤登录mysql：mysql -u root -p\nEnter PassWord：(密码)\n⑥修改密码：alter user \u0026lsquo;root\u0026rsquo;@\u0026rsquo;localhost\u0026rsquo; identified by \u0026lsquo;root\u0026rsquo;;(by 接着的是密码)\n⑦标记删除mysql服务：sc delete mysql\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 [mysql] # 设置mysql客户端默认字符集 default-character-set=utf8mb4 [mysqld] # 设置3306端口 port = 3306 # 设置mysql的安装目录 basedir=E:\\must\\mysql-8.0.30-winx64 # 设置mysql数据库的数据的存放目录 datadir=E:\\must\\mysql-8.0.30-winx64\\data # 允许最大连接数 max_connections=200 # 设置mysql服务端默认字符集 character-set-server=utf8mb4 # 创建新表时将使用的默认存储引擎 default-storage-engine=INNODB 8个 character_set 变量说明 参考文档 Mysql引擎概述+索引+sql优化 详情 MySql 重置/修改表自增ID值 详情 mysql 缓存 详情 查询缓存功能在 MySQL 8.0 中已经被删除，have_query_cache 的值永远都是 NO，将来会被删除 删除原因 proxysql 官网 使用 通用属性 1 2 3 4 5 6 7 `create_by` bigint unsigned NOT NULL COMMENT \u0026#39;创建者\u0026#39;, `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT \u0026#39;创建时间\u0026#39;, `update_by` bigint unsigned DEFAULT NULL COMMENT \u0026#39;更新者\u0026#39;, `update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT \u0026#39;更新时间\u0026#39;, `status` int unsigned NOT NULL COMMENT \u0026#39;状态\u0026#39;, `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT \u0026#39;备注\u0026#39;, `del_flag` tinyint unsigned NOT NULL DEFAULT \u0026#39;0\u0026#39; COMMENT \u0026#39;删除标志（0没有，1已删除）\u0026#39;, 修改表方法 参考 参考 MySQL 树化的条件是数组长度大于64并且，链表节点到达8个才会树化，否则是扩容\n红黑树的平均查找长度是log(n)，如果长度为8，平均查找长度为log(8)=3，链表的平均查找长度为n/2，当长度为8时，平均查找长度为8/2=4，红黑树的查找效率更高，这才有转换成树的必要； 链表长度如果是小于等于6，6/2=3，而log(6)=2.6，虽然速度也很快的，但是转化为树结构和生成树的时间并不会太短\n缓存 一级缓存区域是根据SqlSession为单位划分的\nSqlSession执行insert、update、delete等操作commit后会清空该SQLSession缓存\n二级缓存是mapper级别的。Mybatis默认是没有开启二级缓存\n如果调用相同namespace（命名空间）下的mapper映射文件中的增删改SQL，并执行了commit操作。此时会清空该namespace下的二级缓存\n一对一映射 association\n一对多映射 collection\nmysql语句详细信息 EXPLAIN\nid select查询的序列号，包含一组数字，表示查询中执行select子句或操作表的顺序\n进入数据库 mysql \u0026ndash;hip -P端口 u名字 -p密码\n强制使用索引 表名 force index(字段)\n命令分类 对库操作：\tDDL\n增删改操作：\tDML\n查询操作：\tMQL\n事务操作：\tTCL\n权限控制：\tDCL\n数据库外操作 创建库：\tcreate database 库名字 删除库：\tdrop database 库名字 进入库：\tuse 库名字 查看所有库：\tshow databases 查看当前库表：\tshow tables 添加本地表（导入sql需要先创建库进入库）：\tsource 路径 显示表结构：\tdesc 表名称 查看表数据：\tselect 字段名称{,字段名称} from 表名称\n优先级 where和having只能存在一个 查询：\tselect 表：\tfrom\n筛选：\twhere 分组：\tgroup by 筛选：\thaving 条件：\torder by 分页：\tlimit\n运行顺序 from where group by having select order by limit\nhaving必须和分组group by 一起出现 where是分组之前进行筛选 having是分组之后进行筛选\n增加删除修改 查询：select * from 表名 增加：insert into 表名（，，，）values（，，，），（，，，） 修改：update 表名 set 字段=值，，， {where条件} 删除：delete from 表名 {where条件} insert into 表名 select * 表2 where 函数 位置：select having后面 最大值：\tmax 最小值：\tmin 和：\tsum 平均数：\tavg 统计数量：count\n转换大写：\tlower 转换小写：\tupper 取子串(数据，下标，长度)：\tsubstr 取长度：\tlength 去空格：\ttrim 字符串转换日期：\tstr_to_dare 格式化日期：\tdata_format 设置千分位：(数据，需要长度)\tformat 四舍五入：(数据，需要长度)\tround09 生成随机数：(种子)\trand 把null转换为具体值：(数据,0)\tifnull 获取当前时间：\tnow 返回一个不小于原数据的整数：\tceil\n字符串转换成为数字cast(字符串 as signed integer)\n条件查询 from 表名 where 条件！ and\t并且 or\t或者 between … and …. 两个值之间 is null\t不为空where后面 in() 包含 like\t模糊查询 (%表示0到多个)如：like \u0026lsquo;%a%\u0026rsquo; (_下划线表示1个字符)\n排序：from 表名 ordre by 排序字段 默认正序asc 倒序desc\n分组：\tgroup by 分组之后进行条件筛选：having\n连接有关 内连接：inner join on() | join 外连接： 左外连接：left outer join on 右外连接：right outer jion on\n全连接：union 不去重复：union all\ndistinct 去除重复的记录\n结论：如果外键不能为空，使用内连接; 如果外键即使可以为空，但是要查询的数据要求在两张表中都要有相对应的记录，也使用内连接； 如果外键可以为空，又要把某一张表中所有符合条件的记录都查出来，即使在另一张表中没有相对应的记录，使用外间接。\n主键 不为空：not null 不重复：unique\n主键：primary\n事务 commit 提交\nrollback 回滚\nstart transaction 临时性 set auto_commit = true/false no/yes 永久性\n特性 A：原子性 说明事务是最小的工作单元。不可再分。 C：一致性 所有事务要求，在同一个事务当中，所有操作必须同时成功，或者同时失败， 以保证数据的一致性。 I：隔离性 A事务和B事务之间具有一定的隔离。 教室A和教室B之间有一道墙，这道墙就是隔离性。 A事务在操作一张表的时候，另一个事务B也操作这张表会那样？？？ D：持久性 事务最终结束的一个保障。事务提交，就相当于将没有保存到硬盘上的数据 保存到硬盘上！ 隔离性 查看；SELECT @@tx_isolation\n读未提交：read uncommitted（最低的隔离级别）《没有提交就读到了》 什么是读未提交？ 事务A可以读取到事务B未提交的数据。 这种隔离级别存在的问题就是： 脏读现象！(Dirty Read) 我们称读到了脏数据。 这种隔离级别一般都是理论上的，大多数的数据库隔离级别都是二档起步！\n读已提交：read committed《提交之后才能读到》 什么是读已提交？ 事务A只能读取到事务B提交之后的数据。 这种隔离级别解决了什么问题？ 解决了脏读的现象。 这种隔离级别存在什么问题？ 不可重复读取数据。 什么是不可重复读取数据呢？ 在事务开启之后，第一次读到的数据是3条，当前事务还没有 结束，可能第二次再读取的时候，读到的数据是4条，3不等于4 称为不可重复读取。\n这种隔离级别是比较真实的数据，每一次读到的数据是绝对的真实。 oracle数据库默认的隔离级别是：read committed\n可重复读：repeatable read《提交之后也读不到，永远读取的都是刚开启事务时的数据》 什么是可重复读取？ 事务A开启之后，不管是多久，每一次在事务A中读取到的数据 都是一致的。即使事务B将数据已经修改，并且提交了，事务A 读取到的数据还是没有发生改变，这就是可重复读。 可重复读解决了什么问题？ 解决了不可重复读取数据。 可重复读存在的问题是什么？ 可以会出现幻影读。 每一次读取到的数据都是幻象。不够真实！\n早晨9点开始开启了事务，只要事务不结束，到晚上9点，读到的数据还是那样！ 读到的是假象。不够绝对的真实。\nmysql中默认的事务隔离级别就是这个！！！！！！！！！！！\n序列化/串行化：serializable（最高的隔离级别） 这是最高隔离级别，效率最低。解决了所有的问题。 这种隔离级别表示事务排队，不能并发！ synchronized，线程同步（事务同步） 每一次读取到的数据都是最真实的，并且效率是最低的。\n存储引擎 show engines \\G\n它管理的表具有以下特征： 使用三个文件表示每个表： 格式文件 — 存储表结构的定义（mytable.frm） 数据文件 — 存储表行的内容（mytable.MYD） 索引文件 — 存储表上索引（mytable.MYI）：索引是一本书的目录，缩小扫描范围，提高查询效率的一种机制。 可被转换为压缩、只读表来节省空间\n提示一下： 对于一张表来说，只要是主键， 或者加有unique约束的字段上会自动创建索引。 MyISAM存储引擎特点： 可被转换为压缩、只读表来节省空间 这是这种存储引擎的优势！！！！ MyISAM不支持事务机制，安全性低。 InnoDB存储引擎？ ​\t这是mysql默认的存储引擎，同时也是一个重量级的存储引擎。 ​\tInnoDB支持事务，支持数据库崩溃后自动恢复机制。 ​\tInnoDB存储引擎最主要的特点是：非常安全。\n适用场景：\n1）经常更新的表，适合处理多重并发的更新请求。\n2）支持事务。\n3）可以从灾难中恢复（通过bin-log日志等）。\n4）外键约束。只有他支持外键。\n5）支持自动增加列属性auto_increment。\n这里顺便提一下事务的特点(ACID)：\nA 事务的原子性(Atomicity)：指一个事务要么全部执行,要么不执行.也就是说一个事务不可能只执行了一半就停止了.比如你从取款机取钱,这个事务可以分成两个步骤:1划卡,2出钱.不可能划了卡,而钱却没出来.这两步必须同时完成.要么就不完成.\nC 事务的一致性(Consistency)：指事务的运行并不改变数据库中数据的一致性.例如,完整性约束了a+b=10,一个事务改变了a,那么b也应该随之改变.\nI 独立性(Isolation）:事务的独立性也有称作隔离性,是指两个以上的事务不会出现交错执行的状态.因为这样可能会导致数据不一致.\nD 持久性(Durability）:事务的持久性是指事务执行成功以后,该事务所对数据库所作的更改便是持久的保存在数据库之中，不会无缘无故的回滚.\n它管理的表具有下列主要特征： – 每个 InnoDB 表在数据库目录中以.frm 格式文件表示 – InnoDB 表空间 tablespace 被用于存储表的内容（表空间是一个逻辑名称。表空间存储数据+索引。） – 提供一组用来记录事务性活动的日志文件 – 用 COMMIT(提交)、SAVEPOINT 及ROLLBACK(回滚)支持事务处理 – 提供全 ACID 兼容 – 在 MySQL 服务器崩溃后提供自动恢复 – 多版本（MVCC）和行级锁定 – 支持外键及引用的完整性，包括级联删除和更新 InnoDB最大的特点就是支持事务： 以保证数据的安全。效率不是很高，并且也不能压缩，不能转换为只读， 不能很好的节省存储空间。 MyIsam内存引擎 MyIASM是MySQL默认的引擎，但是它没有提供对数据库事务的支持，也不支持行级锁和外键，因此当INSERT(插入)或UPDATE(更新)数据时即写操作需要锁定整个表，效率便会低一些。\nMyIsam 存储引擎独立于操作系统，也就是可以在windows上使用，也可以比较简单的将数据转移到linux操作系统上去。\n适用场景：\n1）不支持事务的设计，但是并不代表着有事务操作的项目不能用MyIsam存储引擎，可以在service层进行根据自己的业务需求进行相应的控制。\n2）不支持外键的表设计。\n3）查询速度很快，如果数据库insert和update的操作比较少的话比较适用。\n4）整天 对表进行加锁的场景。\n5）MyISAM极度强调快速读取操作。\n6）MyIASM中存储了表的行数，于是SELECT COUNT(*) FROM TABLE时只需要直接读取已经保存好的值而不需要进行全表扫描。如果表的读操作远远多于写操作且不需要数据库事务的支持，那么MyIASM也是很好的选择。\nMEMORY存储引擎？ 使用存在内存中的内容来创建表。每个MEMORY表只实际对应一个磁盘文件。MEMORY类型的表访问非常得快，因为它的数据是放在内存中的，并且默认使用HASH索引。\n但是一旦服务关闭，表中的数据就会丢失掉。\n适用场景：\n1）那些内容变化不频繁的代码表，或者作为统计操作的中间结果表，便于高效地堆中间结果进行分析并得到最终的统计结果。\n2）目标数据比较小，而且非常频繁的进行访问，在内存中存放数据，如果太大的数据会造成内存溢出。可以通过参数max_heap_table_size控制Memory表的大小，限制Memory表的最大的大小。\n3）数据是临时的，而且必须立即可用得到，那么就可以放在内存中。\n4）存储在Memory表中的数据如果突然间丢失的话也没有太大的关系。\n​\t使用 MEMORY 存储引擎的表，其数据存储在内存中，且行的长度固定， ​\t这两个特点使得 MEMORY 存储引擎非常快。\nMEMORY 存储引擎管理的表具有下列特征： – 在数据库目录内，每个表均以.frm 格式的文件表示。 – 表数据及索引被存储在内存中。（目的就是快，查询快！） – 表级锁机制。 – 不能包含 TEXT 或 BLOB 字段。\nMEMORY 存储引擎以前被称为HEAP 引擎。\nMEMORY引擎优点：查询效率是最高的。不需要和硬盘交互。 MEMORY引擎缺点：不安全，关机之后数据消失。因为数据和索引都是在内存当中。\n索引 目前索引方式有HASH和BTREE索引，MyISAM存储引擎支持FULLTEXT索引。\n索引分类\n普通索引：MySQL中基本索引类型，没有什么限制，允许在定义索引的列中插入重复值和空值。\n唯一索引：索引列中的值必须是唯一的，但是允许为空值。\n主键索引：是一种特殊的唯一索引，不允许有空值。\n组合索引：在表中的多个字段组合上创建的索引，只有在查询条件中使用了这些字段的左边字段时，索引才会被使用，使用组合索引时遵循最左前缀集合。\n全文索引：全文索引，只有在MyISAM引擎上才能使用，只能在CHAR,VARCHAR,TEXT类型字段上使用全文索引。\n空间索引：空间索引是对空间数据类型的字段建立的索引，MySQL中的空间数据类型有四种，GEOMETRY、POINT、LINESTRING、POLYGON。在创建空间索引时，使用SPATIAL关键字。要求，引擎为MyISAM，创建空间索引的列，必须将其声明为NOT NULL。\n3.索引优化\n1）NULL值的列：只要列中包含有NULL值都将不会被包含在索引中，复合索引中只要有一列含有NULL值，那么这一列对于此复合索引就是无效的。所以我们在数据库设计时不要让字段的默认值为NULL。\n2）索引列排序：MySQL查询只使用一个索引，因此如果where子句中已经使用了索引的话，那么order by中的列是不会使用索引的。因此数据库默认排序可以符合要求的情况下不要使用排序操作；尽量不要包含多个列的排序，如果需要最好给这些列创建复合索引。\n3）like语句：like “%aaa%” 不会使用索引，而like “aaa%”可以使用索引，建议没有必要的话尽量不要使用like。\n4）避免在列上使用函数或运算：\n5）组合索引顺序：对多列进行索引(组合索引)，列的顺序非常重要，MySQL仅能对索引最左边的前缀进行有效的查找。例如： 假设存在组合索引indexc1c2(c1,c2)，查询语句select * from t1 where c1=1 and c2=2能够使用该索引。查询语句select * from t1 where c1=1也能够使用该索引。但是，查询语句select * from t1 where c2=2不能够使用该索引。\n值重复少的字段不适合建索引，例：性别。 7）用or分割的条件，如果or前的条件中的列有索引，而后面的列没有索引，那么涉及的索引都不会用到。\n\u0026lt;,\u0026lt;=,=,\u0026gt;,\u0026gt;=,between,in,以及不以通配符%或_开头的like才会使用索引。索引也不是越多越好，索引会占用空间和内存，多了维护成本也很高，更新数据时也会慢。\n4.其他sql方面的优化\n避免使用select *。\n用count(1) 或count(列)代替count(*)\n避免用or，可以用in或union代替。** **\n用join代替子查询。\n用exists代替in。\n尽量不用not in，\u0026lt;\u0026gt;，避免扫描全表。\n使用批量插入。\n避免数据类型不一致。\n批量插入更新 详情 全局变量 数据库中 PK FK UK CK DF 的意思 PK 主键 constraint primary key FK 主外键关系 constraint foreign references UK 唯一约束 constraint unique key CK 检查约束 constraint check DF 约束默认 constraint default for\n","date":"2026-04-02T00:00:00Z","permalink":"/p/mybatis/","title":"mybatis"},{"content":"抓包根证书 参考 参考 adb找不到设备 无法挂载system ","date":"2026-04-02T00:00:00Z","permalink":"/p/root/","title":"root"},{"content":"homeassistant智能家居 hacs 小米 \u0026ldquo;docker\u0026quot;版就是没有加载项商店，需要supervised或home assistant os版本\n主题 mushroom\n首页恢复默认 1 2 3 4 概览-\u0026gt;右上角三个小点-\u0026gt;编辑仪表盘-\u0026gt;再点三个小点-\u0026gt;raw configuration editor-\u0026gt;删除里面内容-\u0026gt;输入a strategy: type: original-states 保存，over 反向代理 configuration.yaml 最后添加\n1 2 3 4 5 http: use_x_forwarded_for: true trusted_proxies: - 127.0.0.1 - ::1/128 ","date":"2026-03-31T00:00:00Z","permalink":"/p/homeassistant/","title":"homeassistant"},{"content":"使用的是【apt】包管理器\nwifi 1 2 3 4 5 6 7 8 9 10 #!/bin/bash ping -c 1 \u0026#34;8.8.8.8\u0026#34; \u0026gt;/dev/null 2\u0026gt;\u0026amp;1 if [ $? -eq 0 ]; then echo \u0026#34;ok\u0026#34; else echo \u0026#34;fail\u0026#34; nmcli device wifi connect \u0026#34;CMCC-888\u0026#34; password \u0026#34;18200723687\u0026#34; fi wifi 省电模式 1 2 3 apt install iw ifconfig iw dev wlp2s0 get power_save 创建文件 /etc/NetworkManager/conf.d/default-wifi-powersave-on.conf\n1 2 [connection] wifi.powersave = 2 永久关闭??? 1 2 nmcli radio wifi nmcli connection show xxx 笔记本关屏不休眠 参考 参考 第三方商店 1 2 3 4 5 6 7 8 9 ignore 忽略 # 电池供电时合盖 HandleLidSwitch=ignore # 外接电源时合盖 HandleLidSwitchExternalPower=ignore # 连接扩展坞时合盖 HandleLidSwitchDocked=ignore LidSwitchIgnoreInhibited=yes docker问题 1 2 3 4 5 6 7 8 9 10 #!/bin/bash sed -i \u0026#39;10s/$/ -H tcp:\\/\\/0.0.0.0:2375/\u0026#39; /etc/systemd/system/docker.service sed -i \u0026#39;11s/^/#/\u0026#39; /etc/systemd/system/docker.service systemctl daemon-reload systemctl restart docker echo \u0026#34;ok\u0026#34; 蓝牙 1 2 3 4 5 # 进入bluetooth命令行交互模式 bluetoothctl # 列出设备及其mac地址 devices exit Nas NAS媒体库自动化管理工具 搭建NASToolS docker部署Clash与yacd 图形化V2Ray面板搭建透明代理服务 群晖docker安装dreamacro/clash + haishanh/yacd面板 iStoreOS passwall 青龙面板1 参考 库 参考 jd的直接用源代码下面的命令拉取\n1 2 docker run -dit -v D:/Docker/ql:/ql/data-p 5700:5700 --name qinglong --hostname qinglong -e TZ=Asia/Shanghai --restart unless-stopped whyour/qinglong:latest 一键安装依赖 仓库 1 2 3 4 5 curl -fsSL https://ghfast.top/https://raw.githubusercontent.com/FlechazoPh/QLDependency/main/Shell/QLOneKeyDependency.sh | bash ql raw https://ghfast.top/https://raw.githubusercontent.com/FlechazoPh/QLDependency/main/Shell/QLOneKeyDependency.sh got问题 nodejs 需要依赖 got@11 通知 变量 jd_CheckCK_notify\n脚本管理 项目库目录下的 sendNotify.js\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 // =======================================自定义通知设置区域=========================================== const push_config = { WEBHOOK_URL: \u0026#39;http://172.18.0.5:3000/send_private_msg\u0026#39;, // 自定义通知 请求地址 WEBHOOK_BODY: \u0026#39;message:$title$content\\nuser_id:2424585654\u0026#39;, // 自定义通知 请求体 WEBHOOK_HEADERS: \u0026#39;\u0026#39;, // 自定义通知 请求头 WEBHOOK_METHOD: \u0026#39;POST\u0026#39;, // 自定义通知 请求方法 WEBHOOK_CONTENT_TYPE: \u0026#39;application/json\u0026#39;, // 自定义通知 content-type } const body = parseBody(WEBHOOK_BODY, WEBHOOK_CONTENT_TYPE, (v) =\u0026gt; v ?.replaceAll(\u0026#39;$title\u0026#39;, text?.replaceAll(\u0026#39;\\n\u0026#39;, \u0026#39;\\\\n\u0026#39;) + \u0026#39;\\n\u0026#39;) ?.replaceAll(\u0026#39;$content\u0026#39;, desp), ); 需要函数 webhookNotify parseString parseHeaders parseBody formatBodyFun 青龙目录下有\n自动获取参考 1 2 3 4 5 6 7 8 命令 ql raw https://ghfast.top/https://raw.githubusercontent.com/FlechazoPh/QLDependency/main/Shell/QLOneKeyDependency.sh jd2 https://git.metauniverse-cn.com/https://github.com/shufflewzc/faker2.git 环境变量 JD_COOKIE 参考 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 // 仓库地址 https://gist.github.com/J3n5en/34e122cec18930983273a740025c63d8/revisions // frida -U -F -l Frida_JD_COOKIE.js // 或者使用jshook注入 //青龙地址 结尾不含/ // const BASE_URL = \u0026#34;http://127.0.0.1\u0026#34; const BASE_URL = \u0026#34;http://192.168.1.99:5700\u0026#34; // 青龙面板 - 系统设置 - 应用设置 中生成 const CLIENT_ID = \u0026#34;_NC9budHEHOZ\u0026#34; const CLIENT_SECRET = \u0026#34;A8nFOshKR1TnsEaPX9rmE-Et\u0026#34; const toast = (text) =\u0026gt; { Java.scheduleOnMainThread(function () { var toast = Java.use(\u0026#34;android.widget.Toast\u0026#34;); toast.makeText(Java.use(\u0026#34;android.app.ActivityThread\u0026#34;).currentApplication().getApplicationContext(), Java.use(\u0026#34;java.lang.String\u0026#34;).$new(text), 1).show(); }); } const updateWSCK = (value) =\u0026gt; { try { const OkHttpClient = Java.use(\u0026#34;okhttp3.OkHttpClient\u0026#34;).$new() const RequestBuilder = Java.use(\u0026#34;okhttp3.Request$Builder\u0026#34;) const RequestBody = Java.use(\u0026#34;okhttp3.RequestBody\u0026#34;); const MediaType = Java.use(\u0026#34;okhttp3.MediaType\u0026#34;); const loginResp = OkHttpClient.newCall( RequestBuilder.$new().url(`${BASE_URL}/open/auth/token?client_id=${CLIENT_ID}\u0026amp;client_secret=${CLIENT_SECRET}`).build() ).execute().body().string(); const token = JSON.parse(loginResp).data.token const envsResp = OkHttpClient.newCall( RequestBuilder.$new().url(`${BASE_URL}/open/envs`).addHeader(\u0026#34;Authorization\u0026#34;, `Bearer ${token}`).build() ).execute().body().string(); const cookie = JSON.parse(envsResp).data?.find(env =\u0026gt; env.name === \u0026#34;JD_COOKIE\u0026#34;) const updateEnvsResp = OkHttpClient.newCall( RequestBuilder.$new().url(`${BASE_URL}/open/envs`) .method(\u0026#34;PUT\u0026#34;, RequestBody.create(MediaType.parse(\u0026#34;application/json\u0026#34;), JSON.stringify({ \u0026#34;value\u0026#34;: value, \u0026#34;name\u0026#34;: cookie.name, \u0026#34;id\u0026#34;: cookie.id }))) .addHeader(\u0026#34;Authorization\u0026#34;, `Bearer ${token}`).build() ).execute().body().string(); const enableEnvsResp = OkHttpClient.newCall( RequestBuilder.$new().url(`${BASE_URL}/open/envs/enable`) .method(\u0026#34;PUT\u0026#34;, RequestBody.create(MediaType.parse(\u0026#34;application/json\u0026#34;), JSON.stringify([cookie.id]))) .addHeader(\u0026#34;Authorization\u0026#34;, `Bearer ${token}`).build() ).execute().body().string(); return JSON.parse(updateEnvsResp).code === 200 \u0026amp;\u0026amp; JSON.parse(enableEnvsResp).code === 200 } catch (error) { return false } } const hookJava = () =\u0026gt; Java.perform(function () { toast(\u0026#34;开始\u0026#34;) const cm = Java.use(\u0026#34;com.tencent.smtt.sdk.CookieManager\u0026#34;) console.log(cm); console.log(cm.getInstance()); console.log(cm.getInstance().acceptCookie()); let cookie = cm.getInstance().getCookie(\u0026#34;https://m.jd.com\u0026#34;) console.log(\u0026#34;https://m.jd.com\u0026#34;); console.log(cookie); if(cookie) { cookie = cm.getInstance().getCookie(\u0026#34;http://m.jd.com\u0026#34;) console.log(\u0026#34;https://m.jd.com\u0026#34;); console.log(cookie); } // const cookies = cm.getInstance().getCookie(\u0026#34;*\u0026#34;) // console.log(cookies); console.log(\u0026#39;---------------------\u0026#39;); if (cookie) { if (cookie.includes(\u0026#34;pt_key\u0026#34;) \u0026amp;\u0026amp; cookie.includes(\u0026#34;pt_pin\u0026#34;)) { if (updateWSCK(cookie)) { toast(\u0026#34;JD_COOKIE更新成功\u0026#34;) } else { toast(\u0026#34;JD_COOKIE更新失败\u0026#34;) } } } else { toast(\u0026#34;cookie为空\u0026#34;) } }); setTimeout(hookJava, 3000) ","date":"2026-03-29T00:00:00Z","permalink":"/p/nas/","title":"nas"},{"content":"准备 https://www.right.com.cn/forum/thread-8411714-1-1.html 查看架构 1 2 3 uname -a uname -m apk add lscpu \u0026amp;\u0026amp; lscpu 特殊 1 echo 0xDEADBEEF \u0026gt; /etc/config/google_fu_mode Turbo ACC 网络加速插件，开启 转发加速 和 BBR加速\nuboot 12m分区 uboot 仓库 更新 uboot 大小 17kb 17,408字节 md5 4E68B53B2646A4824AED74A4F5B656EA http://192.168.1.1/uboot.html\n大分区 帖子 软件包 全量解释 luci-app-openclash luci-app-upnp luci-app-ttyd\nluci-app-turboacc 不知道nss是否有效 appfilter 帖子 参考 https://www.right.com.cn/forum/thread-3682029-1-1.html 文件管理 fileassistant 好用 filemanager 还行\noaf OpenAppFilter 相关 参考 流量显示 nlbwmon 问题参考 https://www.right.com.cn/FORUM/thread-8463746-1-1.html bandix 硬件加速问题 可能问题 内核级透明代理Daed，满血NSS+无线中继+docker 帖子 仓库 配置参考 VIKINGYFY VIKINGYFY https://github.com/VIKINGYFY/OpenWRT-CI/releases LiBwrt LiBwrt V L 编译 VIKINGYFY LiBwrt kiddin9(没有nss 风评不好) https://github.com/kiddin9/KWrt https://dl.openwrt.ai/firmware/qualcommax-ipq60xx/jdcloud_re-ss-01/ ZqinKing lua opkg https://github.com/ZqinKing/wrt_release lede 无wifi BleachWrt 功能多 lua opkg https://openwrt.mpdn.fun/?dir=lede/qca 帖子 其他 TTL双分区刷机+回原厂+USB救砖教程 wifi不错(好像差不多，这个好久更新了) 帖子 主题 参考 aurora 上面的 argon 旁边的 软件源 参考 https://mirrors.cernet.edu.cn/immortalwrt https://mirrors.pku.edu.cn/immortalwrt OpenWRT apk安装问题 需要 aarch64_cortex-a53\nhttps://mirrors.vsean.net/openwrt/snapshots/packages/aarch64_cortex-a53/video/packages.adb 跳过签名验证 apk add \u0026ndash;allow-untrusted \u0026ndash;no-network xxx 参考1 ln -sf /bin/uclient-fetch /usr/bin/wget apk add wget-ssl\n镜像站 https://mirrors.cernet.edu.cn/ 华为 清华大学 emmc寿命 1 2 3 4 5 6 7 8 mmc extcsd read /dev/mmcblk0 | grep -e \u0026#34;Life Time\u0026#34; -e \u0026#34;EOL\u0026#34; grep -i \u0026#39;life\u0026#39; \u0026lt;(mmc extcsd read /dev/mmcblk0) # 或者 var=\u0026#34;$(cat /sys/kernel/debug/mmc0/mmc0\\:0001/ext_csd)\u0026#34; eol=${var:534:2};slc=${var:536:2};mlc=${var:538:2} echo \u0026#34;EOL:0x$eol SLC:0x$slc MLC:0x$mlc\u0026#34; 0x01 表示使用了0%-10%的设备寿命。 0x02 指10%-20%的设备使用寿命。 \u0026hellip; [EXT_CSD_DEVICE_LIFE_TIME_EST_TYP_B]: SLC引导分区擦除块的寿命估计，以10%的步长提供，例如: 0x01 表示使用了0%-10%的设备寿命。 0x02 指10%-20%的设备使用寿命。 \u0026hellip; [EXT_CSD_DEVICE_PRE_EOL_INFO]: 保留块的总体状态。可能的值有： 0x00 - 未定义。 0x01 - 正常：消耗了不到80%的保留块。 0x02 - 警告：已消耗80%的保留块。 0x03 - 紧急：消耗了90%的预留块。\n旁路由 参考 在“网络”→“接口”→“常规设置”中找到lan口的配置， 设置IPv4地址为固定静态地址，例如我的192.168.1.20， 并且将IPv4网关指向主路由，例如我的主路由192.168.1.1。 点击“DHCP服务器”，在“常规设置”中勾选忽略此接口并保存，从而阻止旁路由接管主路由的DHCP服务，避免影响主要网络拓扑。\n更换emmc(待测试) 参考 使用空闲空间 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 fdisk -l /dev/mmcblk0 cfdisk /dev/mmcblk0 你会看到一个图形化的分区表。用上下键选中标记为 “Free Space” 的区域。 用左右键选中下方的 [ New ] 选项，回车。 选择分区类型，默认的 Primary 即可，回车。 选择分区大小，如果你想把所有剩余空间都用一个分区来使用，直接回车确认默认最大值即可。 创建完成后，你会看到一个新的分区，比如 /dev/mmcblk0p27。 关键一步： 用左右键选中 [ Write ]，回车，然后输入 yes 确认写入分区表。 最后，选中 [ Quit ] 退出。 mkfs.ext4 /dev/mmcblk0p27 mount /dev/mmcblk0p27 /mnt/mmcblk0p27 方式2 1 mmc extcsd read /dev/mmcblk0 | grep -i life 其他 帖子 白名单上传限速 ","date":"2026-03-14T00:00:00Z","permalink":"/p/ax1800/","title":"ax1800"},{"content":"统一订阅管理 act 视频 转换 工具1 DNS泄露 网站1 测试？ clash 代理 tun模式 ","date":"2026-03-14T00:00:00Z","permalink":"/p/vpn/","title":"vpn"},{"content":"本节课程目标 了解shell中的通配符 熟悉grep、cut、sort等小工具和shell中的通配符的使用 一、文本处理工具 1.grep工具e grep是**==行==**过滤工具；用于根据关键字进行行过滤\n语法和选项\n语法：\n1 # grep [选项] \u0026#39;关键字\u0026#39; 文件名 常见选项：\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 OPTIONS: -i: 不区分大小写 -v: 查找不包含指定内容的行,反向选择 -w: 按单词搜索 -o: 打印匹配关键字 -c: 统计匹配到的行数 -n: 显示行号 -r: 逐层遍历目录查找 -A: 显示匹配行及后面多少行 -B: 显示匹配行及前面多少行 -C: 显示匹配行前后多少行 -l：只列出匹配的文件名 -L：列出不匹配的文件名 -e: 使用正则匹配 -E:使用扩展正则匹配 ^key:以关键字开头 key$:以关键字结尾 ^$:匹配空行 --color=auto ：可以将找到的关键词部分加上颜色的显示 颜色显示（别名设置）：\n1 2 3 4 5 6 7 8 9 10 11 12 13 临时设置： # alias grep=\u0026#39;grep --color=auto\u0026#39; //只针对当前终端和当前用户生效 永久设置： 1）全局（针对所有用户生效） vim /etc/bashrc alias grep=\u0026#39;grep --color=auto\u0026#39; source /etc/bashrc 2）局部（针对具体的某个用户） vim ~/.bashrc alias grep=\u0026#39;grep --color=auto\u0026#39; source ~/.bashrc 举例说明：\n==说明：不要直接使用/etc/passwd文件，将其拷贝到/tmp下做实验！==\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 # grep -i root passwd 忽略大小写匹配包含root的行 # grep -w ftp passwd 精确匹配ftp单词 # grep -w hello passwd 精确匹配hello单词;自己添加包含hello的行到文件 # grep -wo ftp passwd 打印匹配到的关键字ftp # grep -n root passwd 打印匹配到root关键字的行好 # grep -ni root passwd 忽略大小写匹配统计包含关键字root的行 # grep -nic root passwd 忽略大小写匹配统计包含关键字root的行数 # grep -i ^root passwd 忽略大小写匹配以root开头的行 # grep bash$ passwd 匹配以bash结尾的行 # grep -n ^$ passwd 匹配空行并打印行号 # grep ^# /etc/vsftpd/vsftpd.conf 匹配以#号开头的行 # grep -v ^# /etc/vsftpd/vsftpd.conf 匹配不以#号开头的行 # grep -A 5 mail passwd 匹配包含mail关键字及其后5行 # grep -B 5 mail passwd 匹配包含mail关键字及其前5行 # grep -C 5 mail passwd 匹配包含mail关键字及其前后5行 2.cut工具 cut是**==列==**截取工具，用于列的截取\n语法和选项\n语法：\n1 # cut 选项 文件名 常见选项：\n1 2 3 -c: 以字符为单位进行分割,截取 -d: 自定义分隔符，默认为制表符\\t -f: 与-d一起使用，指定截取哪个区域 举例说明:\n1 2 3 4 5 6 # cut -d: -f1 1.txt 以:冒号分割，截取第1列内容 # cut -d: -f1,6,7 1.txt 以:冒号分割，截取第1,6,7列内容 # cut -c4 1.txt 截取文件中每行第4个字符 # cut -c1-4 1.txt 截取文件中每行的1-4个字符 # cut -c4-10 1.txt 截取文件中每行的4-10个字符 # cut -c5- 1.txt 从第5个字符开始截取后面所有字符 课堂练习： 用小工具列出你当系统的运行级别。5/3\n如何查看系统运行级别 命令runlevel 文件/etc/inittab 如何过滤运行级别 1 2 3 4 5 6 7 8 9 10 runlevel |cut -c3 runlevel | cut -d \u0026#39; \u0026#39; -f2 grep -v \u0026#39;^#\u0026#39; /etc/inittab | cut -d: -f2 grep \u0026#39;^id\u0026#39; /etc/inittab |cut -d: -f2 grep \u0026#34;initdefault:$\u0026#34; /etc/inittab | cut -c4 grep -v ^# /etc/inittab |cut -c4 grep \u0026#39;id:\u0026#39; /etc/inittab |cut -d: -f2 cut -d\u0026#39;:\u0026#39; -f2 /etc/inittab |grep -v ^# cut -c4 /etc/inittab |tail -1 cut -d: -f2 /etc/inittab |tail -1 3. sort工具 sort工具用于排序;它将文件的每一行作为一个单位，从首字符向后，依次按ASCII码值进行比较，最后将他们按升序输出。\n语法和选项\n1 2 3 4 5 6 7 8 -u ：去除重复行 -r ：降序排列，默认是升序 -o : 将排序结果输出到文件中,类似重定向符号\u0026gt; -n ：以数字排序，默认是按字符排序 -t ：分隔符 -k ：第N列 -b ：忽略前导空格。 -R ：随机排序，每次运行的结果均不同 举例说明\n1 2 3 4 5 6 7 8 9 10 # sort -n -t: -k3 1.txt 按照用户的uid进行升序排列 # sort -nr -t: -k3 1.txt 按照用户的uid进行降序排列 # sort -n 2.txt 按照数字排序 # sort -nu 2.txt 按照数字排序并且去重 # sort -nr 2.txt # sort -nru 2.txt # sort -nru 2.txt # sort -n 2.txt -o 3.txt 按照数字排序并将结果重定向到文件 # sort -R 2.txt # sort -u 2.txt ##4.uniq工具\nuniq用于去除**==连续==的==重复==**行\n1 2 3 4 5 6 7 8 9 常见选项： -i: 忽略大小写 -c: 统计重复行次数 -d:只显示重复行 举例说明： # uniq 2.txt # uniq -d 2.txt # uniq -dc 2.txt 5.tee工具 tee工具是从标准输入读取并写入到标准输出和文件，即：双向覆盖重定向（屏幕输出|文本输入）\n1 2 3 4 5 6 7 8 选项： -a 双向追加重定向 # echo hello world # echo hello world|tee file1 # cat file1 # echo 999|tee -a file1 # cat file1 6.diff工具 diff工具用于逐行比较文件的不同\n注意：diff描述两个文件不同的方式是告诉我们==怎样改变第一个==文件之后==与第二个文件匹配==。\n语法和选项\n语法：\n1 diff [选项] 文件1 文件2 常用选项：\n选项 含义 备注 -b 不检查空格 -B 不检查空白行 -i 不检查大小写 -w 忽略所有的空格 \u0026ndash;normal 正常格式显示(默认) -c 上下文格式显示 -u 合并格式显示 举例说明：\n比较两个==普通文件==异同，文件准备： 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 [root@MissHou ~]# cat file1 aaaa 111 hello world 222 333 bbb [root@MissHou ~]# [root@MissHou ~]# cat file2 aaa hello 111 222 bbb 333 world 1）正常显示\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 diff目的：file1如何改变才能和file2匹配 [root@MissHou ~]# diff file1 file2 1c1,2 第一个文件的第1行需要改变(c=change)才能和第二个文件的第1到2行匹配 \u0026lt; aaaa 小于号\u0026#34;\u0026lt;\u0026#34;表示左边文件(file1)文件内容 --- ---表示分隔符 \u0026gt; aaa 大于号\u0026#34;\u0026gt;\u0026#34;表示右边文件(file2)文件内容 \u0026gt; hello 3d3 第一个文件的第3行删除(d=delete)后才能和第二个文件的第3行匹配 \u0026lt; hello world 5d4 第一个文件的第5行删除后才能和第二个文件的第4行匹配 \u0026lt; 333 6a6,7 第一个文件的第6行增加(a=add)内容后才能和第二个文件的第6到7行匹配 \u0026gt; 333 需要增加的内容在第二个文件里是333和world \u0026gt; world 2）上下文格式显示\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 [root@MissHou ~]# diff -c file1 file2 前两行主要列出需要比较的文件名和文件的时间戳；文件名前面的符号***表示file1，---表示file2 *** file1 2019-04-16 16:26:05.748650262 +0800 --- file2 2019-04-16 16:26:30.470646030 +0800 *************** 我是分隔符 *** 1,6 **** 以***开头表示file1文件，1,6表示1到6行 ! aaaa !表示该行需要修改才与第二个文件匹配 111 - hello world -表示需要删除该行才与第二个文件匹配 222 - 333 -表示需要删除该行才与第二个文件匹配 bbb --- 1,7 ---- 以---开头表示file2文件，1,7表示1到7行 ! aaa 表示第一个文件需要修改才与第二个文件匹配 ! hello 表示第一个文件需要修改才与第二个文件匹配 111 222 bbb + 333 表示第一个文件需要加上该行才与第二个文件匹配 + world 表示第一个文件需要加上该行才与第二个文件匹配 3）合并格式显示\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 [root@MissHou ~]# diff -u file1 file2 前两行主要列出需要比较的文件名和文件的时间戳；文件名前面的符号---表示file1，+++表示file2 --- file1 2019-04-16 16:26:05.748650262 +0800 +++ file2 2019-04-16 16:26:30.470646030 +0800 @@ -1,6 +1,7 @@ -aaaa +aaa +hello 111 -hello world 222 -333 bbb +333 +world 比较两个==目录不同== 1 2 3 4 5 6 7 8 9 10 11 12 默认情况下也会比较两个目录里相同文件的内容 [root@MissHou tmp]# diff dir1 dir2 diff dir1/file1 dir2/file1 0a1 \u0026gt; hello Only in dir1: file3 Only in dir2: test1 如果只需要比较两个目录里文件的不同，不需要进一步比较文件内容，需要加-q选项 [root@MissHou tmp]# diff -q dir1 dir2 Files dir1/file1 and dir2/file1 differ Only in dir1: file3 Only in dir2: test1 其他小技巧：\n有时候我们需要以一个文件为标准，去修改其他文件，并且修改的地方较多时，我们可以通过打补丁的方式完成。\n1 2 3 4 5 6 7 8 9 10 1）先找出文件不同，然后输出到一个文件 [root@MissHou ~]# diff -uN file1 file2 \u0026gt; file.patch -u:上下文模式 -N:将不存在的文件当作空文件 2）将不同内容打补丁到文件 [root@MissHou ~]# patch file1 file.patch patching file file1 3）测试验证 [root@MissHou ~]# diff file1 file2 [root@MissHou ~]# 7. paste工具 paste工具用于合并文件行\n1 2 3 常用选项： -d：自定义间隔符，默认是tab -s：串行处理，非并行 8. tr工具 tr用于字符转换，替换和删除；主要用于==删除文件中控制字符==或进行==字符转换==\n语法和选项\n语法：\n1 2 3 4 5 6 7 8 9 10 11 用法1：命令的执行结果交给tr处理，其中string1用于查询，string2用于转换处理 commands|tr \u0026#39;string1\u0026#39; \u0026#39;string2\u0026#39; 用法2：tr处理的内容来自文件，记住要使用\u0026#34;\u0026lt;\u0026#34;标准输入 tr \u0026#39;string1\u0026#39; \u0026#39;string2\u0026#39; \u0026lt; filename 用法3：匹配string1进行相应操作，如删除操作 tr [options] \u0026#39;string1\u0026#39; \u0026lt; filename 常用选项：\n1 2 -d 删除字符串1中所有输入字符。 -s 删除所有重复出现字符序列，只保留第一个；即将重复出现字符串压缩为一个字符串 常匹配字符串：\n字符串 含义 备注 ==a-z==或[:lower:] 匹配所有小写字母 所有大小写和数字[a-zA-Z0-9] ==A-Z==或[:upper:] 匹配所有大写字母 ==0-9==或[:digit:] 匹配所有数字 [:alnum:] 匹配所有字母和数字 [:alpha:] 匹配所有字母 [:blank:] 所有水平空白 [:punct:] 匹配所有标点符号 [:space:] 所有水平或垂直的空格 [:cntrl:] 所有控制字符 \\f Ctrl-L 走行换页\\n Ctrl-J 换行 \\r Ctrl-M 回车 \\t Ctrl-I tab键 举例说明：\n1 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 [root@MissHou shell01]# cat 3.txt 自己创建该文件用于测试 ROOT:x:0:0:root:/root:/bin/bash bin:x:1:1:bin:/bin:/sbin/nologin daemon:x:2:2:daemon:/sbin:/sbin/nologin adm:x:3:4:adm:/var/adm:/sbin/nologin lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin sync:x:5:0:sync:/sbin:/bin/sync shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown halt:x:7:0:halt:/sbin:/sbin/halt mail:x:8:12:mail:/var/spool/mail:/sbin/nologin uucp:x:10:14:uucp:/var/spool/uucp:/sbin/nologin boss02:x:516:511::/home/boss02:/bin/bash vip:x:517:517::/home/vip:/bin/bash stu1:x:518:518::/home/stu1:/bin/bash mailnull:x:47:47::/var/spool/mqueue:/sbin/nologin smmsp:x:51:51::/var/spool/mqueue:/sbin/nologin aaaaaaaaaaaaaaaaaaaa bbbbbb111111122222222222233333333cccccccc hello world 888 666 777 999 # tr -d \u0026#39;[:/]\u0026#39; \u0026lt; 3.txt 删除文件中的:和/ # cat 3.txt |tr -d \u0026#39;[:/]\u0026#39; 删除文件中的:和/ # tr \u0026#39;[0-9]\u0026#39; \u0026#39;@\u0026#39; \u0026lt; 3.txt 将文件中的数字替换为@符号 # tr \u0026#39;[a-z]\u0026#39; \u0026#39;[A-Z]\u0026#39; \u0026lt; 3.txt 将文件中的小写字母替换成大写字母 # tr -s \u0026#39;[a-z]\u0026#39; \u0026lt; 3.txt 匹配小写字母并将重复的压缩为一个 # tr -s \u0026#39;[a-z0-9]\u0026#39; \u0026lt; 3.txt 匹配小写字母和数字并将重复的压缩为一个 # tr -d \u0026#39;[:digit:]\u0026#39; \u0026lt; 3.txt 删除文件中的数字 # tr -d \u0026#39;[:blank:]\u0026#39; \u0026lt; 3.txt 删除水平空白 # tr -d \u0026#39;[:space:]\u0026#39; \u0026lt; 3.txt 删除所有水平和垂直空白 小试牛刀\n使用小工具分别截取当前主机IP；截取NETMASK；截取广播地址；截取MAC地址 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 # ifconfig eth0|grep \u0026#39;Bcast\u0026#39;|tr -d \u0026#39;[a-zA-Z ]\u0026#39;|cut -d: -f2,3,4 10.1.1.1:10.1.1.255:255.255.255.0 # ifconfig eth0|grep \u0026#39;Bcast\u0026#39;|tr -d \u0026#39;[a-zA-Z ]\u0026#39;|cut -d: -f2,3,4|tr \u0026#39;:\u0026#39; \u0026#39;\\n\u0026#39; 10.1.1.1 10.1.1.255 255.255.255.0 # ifconfig eth0|grep \u0026#39;HWaddr\u0026#39;|cut -d: -f2-|cut -d\u0026#39; \u0026#39; -f4 00:0C:29:25:AE:54 # ifconfig eth0|grep \u0026#39;HW\u0026#39;|tr -s \u0026#39; \u0026#39;|cut -d\u0026#39; \u0026#39; -f5 00:0C:29:B4:9E:4E # ifconfig eth1|grep Bcast|cut -d: -f2|cut -d\u0026#39; \u0026#39; -f1 # ifconfig eth1|grep Bcast|cut -d: -f2|tr -d \u0026#39;[ a-zA-Z]\u0026#39; # ifconfig eth1|grep Bcast|tr -d \u0026#39;[:a-zA-Z]\u0026#39;|tr \u0026#39; \u0026#39; \u0026#39;@\u0026#39;|tr -s \u0026#39;@\u0026#39;|tr \u0026#39;@\u0026#39; \u0026#39;\\n\u0026#39;|grep -v ^$ # ifconfig eth0|grep \u0026#39;Bcast\u0026#39;|tr -d [:alpha:]|tr \u0026#39;[ :]\u0026#39; \u0026#39;\\n\u0026#39;|grep -v ^$ # ifconfig eth1|grep HWaddr|cut -d \u0026#39; \u0026#39; -f11 # ifconfig eth0|grep HWaddr|tr -s \u0026#39; \u0026#39;|cut -d\u0026#39; \u0026#39; -f5 # ifconfig eth1|grep HWaddr|tr -s \u0026#39; \u0026#39;|cut -d\u0026#39; \u0026#39; -f5 # ifconfig eth0|grep \u0026#39;Bcast\u0026#39;|tr -d \u0026#39;a-zA-Z:\u0026#39;|tr \u0026#39; \u0026#39; \u0026#39;\\n\u0026#39;|grep -v \u0026#39;^$\u0026#39; 将系统中所有普通用户的用户名、密码和默认shell保存到一个文件中，要求用户名密码和默认shell之间用tab键分割 1 # grep \u0026#39;bash$\u0026#39; passwd |grep -v \u0026#39;root\u0026#39;|cut -d: -f1,2,7|tr \u0026#39;:\u0026#39; \u0026#39;\\t\u0026#39; |tee abc.txt 二、bash的特性 ##1、命令和文件自动补全\nTab只能补全==命令和文件== （RHEL6/Centos6）\n##2、常见的快捷键\n1 2 3 4 5 6 7 8 9 ^c 终止前台运行的程序 ^z 将前台运行的程序挂起到后台 ^d 退出 等价exit ^l 清屏 ^a |home 光标移到命令行的最前端 ^e |end 光标移到命令行的后端 ^u 删除光标前所有字符 ^k 删除光标后所有字符 ^r 搜索历史命令 ##3 、==常用的通配符（重点）==\n1 2 3 4 5 6 7 8 9 10 *: 匹配0或多个任意字符 ?: 匹配任意单个字符 [list]: 匹配[list]中的任意单个字符,或者一组单个字符 [a-z] [!list]: 匹配除list中的任意单个字符 {string1,string2,...}：匹配string1,string2或更多字符串 # rm -f file* # cp *.conf /dir1 # touch file{1..5} ##4、==bash中的引号（重点）==\n双引号\u0026quot;\u0026quot; :会把引号的内容当成整体来看待，允许通过$符号引用其他变量值 单引号\u0026rsquo;\u0026rsquo; :会把引号的内容当成整体来看待，禁止引用其他变量值，shell中特殊符号都被视为普通字符 反撇号`` :反撇号和$()一样，引号或括号里的命令会优先执行，如果存在嵌套，反撇号不能用 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 [root@MissHou dir1]# echo \u0026#34;$(hostname)\u0026#34; server [root@MissHou dir1]# echo \u0026#39;$(hostname)\u0026#39; $(hostname) [root@MissHou dir1]# echo \u0026#34;hello world\u0026#34; hello world [root@MissHou dir1]# echo \u0026#39;hello world\u0026#39; hello world [root@MissHou dir1]# echo $(date +%F) 2018-11-22 [root@MissHou dir1]# echo `echo $(date +%F)` 2018-11-22 [root@MissHou dir1]# echo `date +%F` 2018-11-22 [root@MissHou dir1]# echo `echo `date +%F`` date +%F [root@MissHou dir1]# echo $(echo `date +%F`) 2018-11-22 ","date":"2026-03-13T00:00:00Z","permalink":"/p/shell/","title":"shell"},{"content":"下载 ","date":"2026-03-13T00:00:00Z","permalink":"/p/vscode/","title":"vscode"},{"content":"RDB(文件快照) redis\nAOF(日志) 每执行一条指令就会记录\nAOP面向切面编程 典型的代理模式的体现\nIOP控制反转 典型的工厂模式，通过sessionfactory去注入实例。\nocp开闭原则 OSI模型 开放式系统互联通信参考模型（英语：Open System Interconnection Reference Model，缩写为 OSI），简称为OSI模型（OSI model），一种概念模型，由国际标准化组织提出，一个试图使各种计算机在世界范围内互连为网络的标准框架。定义于ISO/IEC 7498-1。\nOSI/RM协议是由ISO(国际标准化组织）制定的，它有三个基本的功能：提供给开发者一个必须的、通用的概念以便开发完善、可以用来解释连接不同系统的框架。 [1]\nOSI将计算机网络体系结构(architecture）划分为以下七层：\n[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-hHTvvXtx-1660568357741)(https://bkimg.cdn.bcebos.com/pic/77c6a7efce1b9d16a9ef96c9f2deb48f8c546469?x-bce-process=image/resize,m_lfit,w_220,h_220,limit_1)] 图1.OSI模型\n物理层 : 将数据转换为可通过物理介质传送的电子信号 相当于邮局中的搬运工人。\n数据链路层 : 决定访问网络介质的方式。\n在此层将数据分帧，并处理流控制。本层指定拓扑结构并提供硬件寻址，相当于邮局中的装拆箱工人。\n网络层 : 使用权数据路由经过大型网络 相当于邮局中的排序工人。\n传输层 : 提供终端到终端的可靠连接 相当于公司中跑邮局的送信职员。\n会话层 : 允许用户使用简单易记的名称建立连接 相当于公司中收寄信、写信封与拆信封的秘书。\n表示层 : 协商数据交换格式 相当公司中简报老板、替老板写信的助理。\n应用层 : 用户的应用程序和网络之间的接口。\n根据建议X.200，OSI将计算机网络体系结构划分为以下七层，标有1～7，第1层在底部。 现“OSI/RM”是英文 “Open Systems Interconnection Reference Model”的缩写。\n第7层 应用层 主条目：应用层 应用层（Application Layer）提供为应用软件而设的接口，以设置与另一应用软件之间的通信。例如: HTTP，HTTPS，FTP，TELNET，SSH，SMTP，POP3等。\n第6层 表达层 主条目：表达层\n表达层（Presentation Layer）把数据转换为能与接收者的系统格式兼容并适合传输的格式。\n第5层 会话层 主条目：会话层 会话层（Session Layer）负责在数据传输中设置和维护计算机网络中两台计算机之间的通信连接。\n第4层 传输层 主条目：传输层 传输层（Transport Layer）把传输表头（TH）加至数据以形成数据包。传输表头包含了所使用的协议等发送信息。例如:传输控制协议（TCP）等。\n第3层 网络层 主条目：网络层 网络层（Network Layer）决定数据的路径选择和转寄，将网络表头（NH）加至数据包，以形成分组。网络表头包含了网络数据。例如:互联网协议（IP）等。\n第2层 数据链路层 主条目：数据链路层 数据链路层（Data Link Layer）负责网络寻址、错误侦测和改错。当表头和表尾被加至数据包时，会形成帧。数据链表头（DLH）是包含了物理地址和错误侦测及改错的方法。数据链表尾（DLT）是一串指示数据包末端的字符串。例如以太网、无线局域网（Wi-Fi）和通用分组无线服务（GPRS）等。\n分为两个子层：逻辑链路控制（logic link control，LLC）子层和介质访问控制（media access control，MAC）子层。\n第1层 物理层 主条目：物理层 物理层（Physical Layer）在局部局域网上传送数据帧 （data frame），它负责管理计算机通信设备和网络媒体之间的互通。包括了针脚、电压、线缆规范、集线器、中继器、网卡、主机适配器等。\nTCP/IP协议（面向连接的可靠的传输协议） SYN：代表请求创建连接，所以在三次握手中前两次要SYN=1，表示这两次用于建立连接，至于第三次什么用，在疑问三里解答。\nFIN：表示请求关闭连接，在四次分手时，我们发现FIN发了两遍。这是因为TCP的连接是双向的，所以一次FIN只能关闭一个方向。\nACK：代表确认接受，从上面可以发现，不管是三次握手还是四次分手，在回应的时候都会加上ACK=1，表示消息接收到了，并且在建立连接以后的发送数据时，都需加上ACK=1,来表示数据接收成功。\nseq:序列号，什么意思呢？当发送一个数据时，数据是被拆成多个数据包来发送，序列号就是对每个数据包进行编号，这样接受方才能对数据包进行再次拼接。\n初始序列号是随机生成的，这样不一样的数据拆包解包就不会连接错了。（例如：两个数据都被拆成1，2，3和一个数据是1，2，3一个是101，102，103，很明显后者不会连接错误）\n**ack:**这个代表下一个数据包的编号，这也就是为什么第二请求时，ack是seq+1\n三次握手 SYN SYN+ACK ACK\n在创建连接时，\n1.客户端首先要SYN=1,表示要创建连接，\n2.服务端接收到后，要告诉客户端：我接受到了！所以加个ACK=1，就变成了ACK=1,SYN=1\n3.理论上这时就创建连接成功了，但是要防止一个意外（见疑问三），所以客户端要再发一个消息给服务端确认一下，这时只需要ACK=1就行了。\n三次握手完成！\n四次分手 FIN ACK FIN+ACK ACK\n在四次分手时，\n1.首先客户端请求关闭客户端到服务端方向的连接，这时客户端就要发送一个FIN=1，表示要关闭一个方向的连接（见上面四次分手的图）\n2.服务端接收到后是需要确认一下的，所以返回了一个ACK=1\n3.这时只关闭了一个方向，另一个方向也需要关闭，所以服务端也向客户端发了一个FIN=1 ACK=1\n4.客户端接收到后发送ACK=1，表示接受成功\n四次分手完成！\nSocket 套接字\n插座\n四元组 ip:port + ip:port\n端口默认有：65535\n","date":"2026-03-13T00:00:00Z","permalink":"/p/%E5%8D%95%E6%AC%A1%E7%BC%A9%E5%86%99/","title":"单次缩写"},{"content":"系统 官方下载 windows系统重装工具 rufus 微pe官网 我告诉你官网 原版软件官网 windows镜像 business editions和consumer editions说明（推荐Business editions） Consumer editions包括：家庭版、教育版、专业版； Business editions包括：企业版、教育版、专业版；\nntfs和fat32的区别（推荐ntfs） 参考 mbr和guid的区别（推荐guid） “MBR的意思是主引导记录，是传统分区类型，只支持一个硬盘上最多4个主分区，最大的缺点是不支持2TB以上硬盘容量， 而GUID就是新兴的GPT方式，支持的主分区数量没有限制；MBR支持win7版本系统以下的32位和64位， 而GUID支持win7版本以上的64位系统，不支持32位系统。”\n命令行工具 PowerShell 快捷方式 wt\n文件管理器默认打开当前 编辑JSON文件: 在 \u0026ldquo;profiles\u0026rdquo; 的 \u0026ldquo;default\u0026rdquo; 下添加 \u0026ldquo;startingDirectory\u0026rdquo;: \u0026ldquo;.\u0026rdquo;\nhost 文件位置 1 C:\\WINDOWS\\system32\\drivers\\etc 查看文件占用情况 文件查看/搜索 Everything WinTree Anytxt Searcher cmd在开始菜单创建快捷方式 参考 下载器 https://www.zhihu.com/question/19820075 哈希值 md5 不要再使用md5 1 Get-FileHash 文件 md5(可选) hyper-v创建win11虚拟机 参考 网络不连接 安全 设置 启用受信任的平台模块\n启动按回车 硬盘顺序可能要修改一下 启动后提示要【操作】【ctrl alt delete】 然后要多等等 跳过验证 联网界面按快捷键 Shift+F10 输入 start ms-cxh:localonly 按回车\n命令行编码 参考 1 2 3 4 5 6 7 8 # 查看 chcp # utf8 chcp 65001 # gbk chcp 936 bat bat 上传文件\n1 2 pscp -v -r -p -pw 密码 ./redis.conf root@106.55.239.122:/simple/redis/conf @REM scp.exe -r ./. root@106.55.239.122:/simple/redis/conf 取参 %0 %1\n加入 pause 可以不退出\nif写法\n1 2 3 4 5 if \u0026#34;%1%\u0026#34;==\u0026#34;redis\u0026#34; ( call ./redis/redis.bat ) else ( echo 11111111111 ) 查看指定端口是否占用 1 2 3 4 5 6 查看端口被哪个pid占用 netstat -aon|findstr 9090 查看名字 tasklist|findstr \u0026#34;9090\u0026#34; 杀死 taskkill /T /F /PID 9090 如果查询不到使用下面的方式\n查看动态端口范围 1 netsh int ipv4 show dynamicport tcp 设置动态端口范围 1 netsh int ipv4 set dynamicportrange tcp start=49152 num=16384 win脚本自动启动 添加文件 方式1\u0026mdash;\u0026gt;直接打开 C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\StartUp 方式2\u0026ndash;\u0026gt;通过打开菜单页面某一个快捷方式，在进入启动文件夹 方式3\u0026ndash;\u0026gt;通过任务管理器的启动页面打开文件地方\n文件名 start.vbs 1 2 set ws=wscript.createobject(\u0026#34;wscript.shell\u0026#34;) ws.run \u0026#34;D:\\Programme\\must\\minio\\minio.bat\u0026#34;,0 cpu 超频 参考 nmap(网络测试工具) 1 2 nmap -Pn --script ssl-enum-ciphers -p 443 113.104.126.249 pause 同步文件 Syncthing参考 远程观看 SyncPlay 参考 Aria2 参考 下载配置 /var/apps/aria2/shares/Download\nidm 下载器 参考 参考 压缩工具 rar弹窗 推荐 7-zip ","date":"2026-03-10T00:00:00Z","permalink":"/p/win/","title":"win电脑"},{"content":"中文网 烟雨OTA工具箱 rom站 手机 k90pm https://www.123865.com/s/NZ8uVv-N4EpH?notoken=1 屏幕 OPPOx9也是 ipts\n电池 电压 4.53 额定容量 7420mAh 典型电容量 7560mAh 标称电压 3.79 额定能量 28.13Wh 典型能量 28.66Wh\n模块 元模块 解释 需要第一个安装\nMagic Mount v1.0.1-sprout 这个是基础环境 不用安装\n推荐 hybrid_mount 环境隐藏 Zygisk Next-1.3.2-688-2c60cdd-release 5ec1cff 最新已内置隐藏环境（不需要shamiko）\nNeoZygisk 这个更新比较勤快\nShamiko-v1.2.5-414 LSPosed 目前看到最高 1.9.2-it(7469) github Dxandme JingMatrix/LSPosed 1.11.0 TrickyStore 仓库 Scene 9 吟婉兮调度(不推荐) 下载 AdGuardHomeForRoot dns 过滤广告 官方 其他个人修改版本 区别 AutoPurge 清理垃圾 1.0.12.0 InstallerX 安装器 下载 HyperCeiler 官网 下载 r1 oshape github 模块在 飞机\nHyperLight 液态玻璃 高光样式 下载 HookVip 官网 下面的不知道干嘛的 游戏完整性修复 下载 模块用于修改 Android Keystore 生成的 Android KeyAttestation 证书链 下载 magic_mount_rs 为KernelSU 提供 Systemless 修改功能 下载 lsp模块 隐藏应用列表 仓库 推荐 酷安 爱玩机工具箱(酷安下载)\nusb 头 黑(负) 绿(D+) 黄(cc) 白(D-) 红(正) 尾\n直供电（test） 重启 5.5v 法拉电容 10f 以上 输入线 并联 200uf 电解电容 其他 吾爱破解参考 高通9008模式 twrp ADB 调试手机的三种方式（USB、WLAN、WIFI） twrp下载地址 https://twrp.me/Devices 其他 吾爱破解参考 高通9008模式 Ubuntu 镜像 mount -o remount rw /\n参考 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 deb https://mirrors.aliyun.com/ubuntu/ xenial main deb-src https://mirrors.aliyun.com/ubuntu/ xenial main deb https://mirrors.aliyun.com/ubuntu/ xenial-updates main deb-src https://mirrors.aliyun.com/ubuntu/ xenial-updates main deb https://mirrors.aliyun.com/ubuntu/ xenial universe deb-src https://mirrors.aliyun.com/ubuntu/ xenial universe deb https://mirrors.aliyun.com/ubuntu/ xenial-updates universe deb-src https://mirrors.aliyun.com/ubuntu/ xenial-updates universe deb https://mirrors.aliyun.com/ubuntu/ xenial-security main deb-src https://mirrors.aliyun.com/ubuntu/ xenial-security main deb https://mirrors.aliyun.com/ubuntu/ xenial-security universe deb-src https://mirrors.aliyun.com/ubuntu/ xenial-security universe 小米4 根目录扩容\n1 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 #!/bin/sh # 此脚本会调整手机的根分区大小，请小心。 echo \u0026#34;调整根分区的大小，这可能需要一些时间。。。\u0026#34; echo \u0026#34;完成后，它将重新启动设备，确保您没有丢失任何工作！\u0026#34; cd /userdata echo \u0026#34;创建新的磁盘映像 4096\u0026#34; dd bs=1M count=6144 if=/dev/zero of=system2.img #这可能需要一段时间, put the kettle on #mount it as a loopback device losetup -f --show system2.img #copy from existing loopback to current one dd if=/dev/loop0 of=/dev/loop2 echo \u0026#34;然后调整我们新设备上的文件系统大小。这可能会发出警告，接受它\u0026#34; e2fsck -f /dev/loop2 resize2fs /dev/loop2 echo \u0026#34;现在把我们的新形象换成旧形象\u0026#34; mv system.img system.old mv system2.img system.img reboot echo \u0026#34;享受你的新 / space\u0026#34; df -h #清理旧文件 rm /userdata/system.old ","date":"2026-03-10T00:00:00Z","permalink":"/p/sj/","title":"手机"},{"content":"全局弹出对话框 详情 配置文件application AndroidManifest 详情1 详情2 安卓应用内打开其他软件的页面 详情 音视频对讲演示程序 官方地址 安卓编译报错 # Execution failed for task ‘:app:checkDebugDuplicateClasses‘. 详情 投屏 ARDC\nAndroid Studio 工具下载 地址 插件下载 地址 下载慢问题 参考 参考 参考 最小apk 参考 打包 参考 提高下载速度 修改build.gradle\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 buildscript { repositories { maven{ url \u0026#39;http://maven.aliyun.com/nexus/content/groups/public/\u0026#39; } maven{ url \u0026#39;http://maven.aliyun.com/nexus/content/repositories/jcenter\u0026#39;} } dependencies { classpath \u0026#39;com.android.tools.build:gradle:3.3.0-alpha13\u0026#39; } } allprojects { repositories { maven{ url \u0026#39;http://maven.aliyun.com/nexus/content/groups/public/\u0026#39;} maven{ url \u0026#39;http://maven.aliyun.com/nexus/content/repositories/jcenter\u0026#39;} } } task clean(type: Delete) { delete rootProject.buildDir } ","date":"2026-03-09T00:00:00Z","permalink":"/p/android/","title":"android"},{"content":"关于@media不生效的问题和meta总结 详情 Grid 网格布局 图表 参考 仓库 vue v-html 参考 文字小程序 参考 1 2 3 4 5 6 7 8 .text-deal{ overflow : hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; word-break: break-all; /* 追加这一行代码 */ } taro 参考（unplugin-auto-import） 前端 图片 1 aspect-ratio: 1/1 新用户引导库 driver.js introjs css sass less scss sass、scss、和css的关系 前端大数据 素材 素材 element-ui el-table多列同时排序且样式保留(多用于后台排序) CSS — BEM 命名规范 小程序登录解决方案（可能） 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 import auth from \u0026#39;./utils/auth\u0026#39;; const preCheckLogin = function () { return new Promise((resolve, rejects) =\u0026gt; { const app = getApp(); if (!app.globalData.isLogin()) { wx.login({ timeout: 30000, success(wr) { if (wr.code) { auth.authLogin(wr.code).then(res =\u0026gt; { if (res.status) { resolve(true); } else { rejects(\u0026#39;not login\u0026#39;); } }).catch(e =\u0026gt; { console.error(e); rejects(\u0026#39;not login\u0026#39;); }) } else { rejects(\u0026#39;not wx login\u0026#39;); } }, fail(e) { console.error(e); rejects(\u0026#39;not wx login fail\u0026#39;); } }) } else { resolve(true); } }) } // 对原有的Page进行装饰 const PageExtend = page =\u0026gt; { return obj =\u0026gt; { const {onReady} = obj; obj.onReady = function (options) { // 这里检查是否已登陆，如果没有登陆，则跳转到登陆页面 preCheckLogin() .then(() =\u0026gt; { if (typeof onReady === \u0026#39;function\u0026#39;) { onReady.call(this, options) } }) .catch((e) =\u0026gt; { wx.navigateTo({ url: \u0026#39;/pages/login/index\u0026#39;, }) }) } return page(obj); } } const originPage = Page Page = PageExtend(originPage); export default originPage; css动画 css动画 ","date":"2026-03-09T00:00:00Z","permalink":"/p/css/","title":"css"},{"content":"查看环境变量 1 go env 下载源 1 2 // direct表示如果在下载源找不到会回原来的地址去下载 go env -w GOPROXY=https://mirrors.aliyun.com/goproxy,direct ","date":"2026-03-09T00:00:00Z","permalink":"/p/go/","title":"go"},{"content":"icon iconPark https://yesicon.app/icon-park/?lang=zh-hans 前端UI 产品设计协作平台 蓝湖 更多的前端动画效果 参考1 参考2 参数3 新拟态 缓动函数 前沿的ui页面 图形化网站 echarts figmachina HTML代码中＜%%＞、＜%=%＞、＜%:%＞各是什么意思 详情 在head标签中动态创建script标签 详情 前端浏览器版本低升级提示 详情 关于CSRF 和 csrftoken 详情 浏览器兼容 -webkit 是表示针对 safari 浏览器支持 -ms 表示针对 IE 浏览器支持 -o 表示针对Opera浏览器 -moz 表示针对Firefox浏览器\n图片懒加载 参考 ","date":"2026-03-09T00:00:00Z","permalink":"/p/html/","title":"html"},{"content":"日志 XSLF4J 参考 p6Spy sql日志 这个有损性能 详情 private、protected、public和default的区别 参考 gradle 排除依赖包 VO、DTO、BO、PO、DO、POJO 的概念、区别和用处 https://blog.csdn.net/zjrbiancheng/article/details/6253232 图文 原文 @Order、@Priority、@Primary 三个注解和 Orderd 接口 @orderd @orderd接口，实现Oderd接口的话要实现int getOrder();这个方法，返回一个整数值，值越小优先级越高。\n@Order @Order里面存储了一个值，默认为Integer的最大值，同样值越小优先级越高。要注意@Order只能控制组件的加载顺序，不能控制注入的优先级。但是能控制List 里面存放的XXX的顺序，原因是当通过构造函数或者方法参数注入进某个List时，Spring的DefaultListableBeanFactory类会在注入时调用AnnotationAwareOrderComparator.sort(listA)帮我们去完成根据@Order或者Ordered接口序值排序。@Order更加适用于集合注入的排序。\n@Priority @Priority与@Order类似，@Order是Spring提供的注解，@Priority是JSR 250标准，同样是值越小优先级越高。但是两者还是有一定却别，@Priority能够控制组件的加载顺序，因此@Priority侧重于单个注入的优先级排序。此外@Priority优先级比@Order更高，两者共存时优先加载@Priority。\n@Primary是优先级最高的，如果同时有@Primary以及其他几个的话，@Primary注解的Bean会优先加载。\n@Inherited注解的作用 @Inherited注解的作用 随机数加快 -Djava.security.egd=file:/dev/urandom 作用\n参考 参考 警告 @SuppressWarnings注解 详情 前端参数判断 官网 字符串判断 详细介绍 详细介绍1 (里面有快速失败返回模式) 利用Filter和springAOP实现记录URL和方法的运行时间 记录URL运行时间 filter配置类 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 import lombok.Data; import lombok.RequiredArgsConstructor; import org.springframework.boot.web.servlet.FilterRegistrationBean; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; /** * Filter配置 */ @Data @Configuration @RequiredArgsConstructor public class FilterConfig { @Bean @SuppressWarnings({\u0026#34;rawtypes\u0026#34;, \u0026#34;unchecked\u0026#34;}) public FilterRegistrationBean timeMonitorFilterRegistration() { FilterRegistrationBean registration = new FilterRegistrationBean(); registration.addUrlPatterns(\u0026#34;/*\u0026#34;); registration.setName(\u0026#34;timeMonitorFilter\u0026#34;); registration.setFilter(new TimeMonitorFilter()); registration.setOrder(FilterRegistrationBean.HIGHEST_PRECEDENCE); return registration; } } 过滤器 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 import cn.hutool.core.date.StopWatch; import lombok.extern.slf4j.Slf4j; import javax.servlet.*; import javax.servlet.http.HttpServletRequest; import java.io.IOException; /** * 时间监视器过滤器 * 可以获取URL的运行时间 */ @Slf4j public class TimeMonitorFilter implements Filter { @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { StopWatch stopWatch = new StopWatch(); stopWatch.start(); String uri = ((HttpServletRequest) request).getRequestURI(); try { chain.doFilter(request, response); } finally { stopWatch.stop(); log.info(\u0026#34;访问网址 [{}], 花费时间 [{}] ms [{}] ns )\u0026#34;, uri, stopWatch.getLastTaskTimeMillis(), stopWatch.getLastTaskTimeNanos()); } } } 方法运行时间 注解 1 2 3 4 5 6 7 8 9 10 11 import java.lang.annotation.*; /** * 运行时间,方法使用此注解,可以查看方法的运行时间 */ @Target(ElementType.METHOD) @Retention(RetentionPolicy.RUNTIME) @Inherited @Documented public @interface RumTime { } AOP类 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 import cn.hutool.core.date.StopWatch; import lombok.extern.slf4j.Slf4j; import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.annotation.Around; import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Pointcut; import org.springframework.core.Ordered; import org.springframework.core.annotation.Order; import org.springframework.stereotype.Component; /** * 运行时间切面 * 可以获取方法的运行时间 */ @Slf4j @Aspect @Component @Order(Ordered.HIGHEST_PRECEDENCE) public class TimeAspect { @Pointcut(\u0026#34;@annotation(com.**.RumTime)\u0026#34;) public void timePointCut() { } /** * 环绕通知 */ @Around(\u0026#34;timePointCut()\u0026#34;) public Object doBefore(ProceedingJoinPoint joinPoint) throws Throwable { StopWatch stopWatch = new StopWatch(); stopWatch.start(); Object result = joinPoint.proceed(); stopWatch.stop(); log.info(\u0026#34;执行的类名 [{}] 方法名为 [{}], 花费时间 [{}] ms [{}] ns )\u0026#34; , joinPoint.getTarget().getClass().getName(), joinPoint.getSignature().getName() , stopWatch.getLastTaskTimeMillis(), stopWatch.getLastTaskTimeNanos()); return result; } } 音频流，视频流 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 public void test(HttpServletRequest request, HttpServletResponse response) throws Exception { //创建连接对象 URL url = new URL(\u0026#34;http://媒体文件url\u0026#34;); URLConnection conn = url.openConnection(); //设置超时 conn.setConnectTimeout(1000); conn.setReadTimeout(5000); //发起连接 conn.connect(); //获取流 InputStream inputStream = conn.getInputStream(); //流转换 IOUtils.copy(inputStream,response.getOutputStream()); //设置返回类型 response.addHeader(\u0026#34;Content-Type\u0026#34;, \u0026#34;audio/mpeg;charset=utf-8\u0026#34;); response.flushBuffer(); } html 您的浏览器不支持音频元素 计时器 1 2 3 4 5 6 7 8 9 10 11 12 13 public static void main(String[] args) { StopWatch clock = new StopWatch(); clock.start(\u0026#34;开始任务一\u0026#34;); doSomeThing(); clock.stop(); clock.start(\u0026#34;开始任务二\u0026#34;); doSomeThing(); clock.stop(); System.out.println(clock.prettyPrint()); } java类的生命周期 类加载顺序 (祖)(父)(自己)类静态代码块 \u0026ndash;\u0026gt; (祖)(父)(自己)实例化方法然后构造方法\n如果调用静态方法\n(祖)(父)类静态代码块 \u0026ndash;\u0026gt; (祖)(父)(自己)实例化方法然后构造方法 \u0026ndash;\u0026gt; (自己)类静态代码块\n结论：如果调用静态方法，静态方法最后执行\n注解 注解被用来修饰一个非静态的void（）方法 Constructor(构造方法) -\u0026gt; @Autowired(依赖注入) -\u0026gt; @PostConstruct(注释的方法)\n@PostConstruct 被修饰的方法会在服务器加载Servlet的时候运行，并且只会被服务器执行一次 通常用来初始化一些操作\n1 2 3 public void destroy(){ System.out.println(\u0026#34;类开始加载\u0026#34;); } @PreDestroy 被修饰的方法会在服务器销毁Servlet的时候运行，并且只会被服务器执行一次 通常用来处理一些关闭操作\n1 2 3 public void destroy(){ System.out.println(\u0026#34;类即将销毁\u0026#34;); } 缓冲队列BlockingQueue ArrayBlockingQueue（int i） 规定大小的BlockingQueue，其构造必须指定大小。其所含的对象是FIFO顺序排序的\nLinkedBlockingQueue（）或者（int i） 大小不固定的BlockingQueue，若其构造时指定大小，生成的BlockingQueue有大小限制，不指定大小，其大小有Integer.MAX_VALUE来决定。其所含的对象是FIFO顺序排序的。\nPriorityBlockingQueue（）或者（int i） 类似于LinkedBlockingQueue，但是其所含对象的排序不是FIFO，而是依据对象的自然顺序或者构造函数的Comparator决定。\nSynchronizedQueue（） 特殊的BlockingQueue，对其的操作必须是放和取交替完成\n线程状态 New(初始化状态) Runnable(就绪状态) Running(运行状态) Blocked(阻塞状态) sleep(Thread)(自动醒)、wait(Object)(需要唤醒，等待其它的业务场景)\nTerminated(终止状态) 线程池 参考 四种线程池 newCacheThreadPool 可缓存线程池，先查看池中有没有以前建立的线程，如果有，就直接使用。如果没有，就建一个新的线程加入池中，缓存型池子通常用于执行一些生存期很短的异步型任务\n线程池为无限大，当执行当前任务时上一个任务已经完成，会复用执行上一个任务的线程，而不用每次新建线程\nnewFixedThreadPool 创建一个可重用固定个数的线程池，以共享的无界队列方式来运行这些线程。\n因为线程池大小为3，每个任务输出打印结果后sleep 2秒，所以每两秒打印3个结果。 定长线程池的大小最好根据系统资源进行设置。如Runtime.getRuntime().availableProcessors()\nnewScheduledThreadPool 创建一个定长线程池，支持定时及周期性任务执行\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 //创建一个定长线程池，支持定时及周期性任务执行——延迟执行 ScheduledExecutorService scheduledThreadPool = Executors.newScheduledThreadPool(5); //延迟1秒执行 /*scheduledThreadPool.schedule(new Runnable() { public void run() { System.out.println(\u0026#34;延迟1秒执行\u0026#34;); } }, 1, TimeUnit.SECONDS);*/ //延迟1秒后每3秒执行一次 scheduledThreadPool.scheduleAtFixedRate(new Runnable() { public void run() { System.out.println(\u0026#34;延迟1秒后每3秒执行一次\u0026#34;); } }, 1, 3, TimeUnit.SECONDS); newSingleThreadExecutor 创建一个单线程化的线程池，它只会用唯一的工作线程来执行任务，保证所有任务按照指定顺序(FIFO, LIFO, 优先级)执行。\n线程池 ThreadPoolExecutor 文章 文章 名称 类型 含义 corePoolSize int 核心线程池大小 maximumPoolSize int 最大线程池大小 keepAliveTime long 线程最大空闲时间 unit TimeUnit 时间单位 workQueue BlockingQueue 线程等待队列 threadFactory ThreadFactory 线程创建工厂 handler RejectedExecutionHandler 拒绝策略 Java 17 参考 运行时错误 Unable to make protected final java.lang.Class java.lang.ClassLoader.defineClass 文章1 文章2 -Dfile.encoding=UTF-8 // 设置文件编码\n1 2 3 4 5 6 7 8 -Dfile.encoding=UTF-8 --add-opens java.base/java.math=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.lang.reflect=ALL-UNNAMED --add-opens java.base/java.lang.invoke=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.nio=ALL-UNNAMED --add-opens java.base/sun.nio.ch=ALL-UNNAMED private、protected、public和default的区别 参考 随机数加快 -Djava.security.egd=file:/dev/urandom 作用 参考 参考 开发格式规范 设计模式 工厂：Factory\n代理：Proxy\n观察；Observe\nmapper 选择：select\n插入：input\n更新：update\n删除：delete\n其他 详细：Detail\n可选择的：optional\n选择性的：selective\n多个：Multiple\nDao 接口命名 这里的方法名字最好对应着sql语句，这是最直接的。然后表示条件用By作为介词，表示查询列表用list前缀。\ninsert ：插入 batchInsert ：批量插入 selectOne ：查询一个数据 selectById ：查询通过xx条件 count ：计数 selectList ：查询多个数据 update ：更新 deleteById ：删除，通过某些条件\nService 接口命名 这里用的是解决人类的思维，查询就是find，添加是add，删除就是remove，修改是modify。然后条件也用by，大量用list后缀。\nadd ：添加数据 findById ：查找，也可以用query findByXXX ：查找 findXXXList ：批量查找 modify :修改 remove : 简单删除\nService/DAO层命名规约 1 2 3 4 5 6 1.获取单个对象的方法用get做前缀 2.获取多个对象的方法用list做前缀，如：listObjects 3.获取统计值的方法用count做前缀 4.插入方法用save/insert做前缀 5.删除方法用delete/remove做前缀 6.修改方法用update做前缀 其他命名规范 项目名全部小写. 包名全部小写. 类名:大驼峰，例如：UpperCamelCase 变量名,方法名：小驼峰：lowerCamelCase 常量名全部大写: public static final int REQUEST_KEY_CODE =1; 所有命名规则必须遵循以下规则 : 名称只能由字母、数字、下划线、$符号组成. 不能以数字开头. 名称不能使用Java中的关键字. 坚决不允许出现中文及拼音命名. 排序算法 冒泡排序的进行对比，然后交换 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 public static void BubbleSort(int[] arr) { //定义一个临时变量 int temp; //冒泡趟数 for (int i = 0; i \u0026lt; arr.length - 1; i++) { for (int j = 0; j \u0026lt; arr.length - i - 1; j++) { if (arr[j + 1] \u0026lt; arr[j]) { temp = arr[j]; arr[j] = arr[j + 1]; arr[j + 1] = temp; } } System.out.println(\u0026#34;第\u0026#34; + (i + 1) + \u0026#34;次：\u0026#34; + Arrays.toString(arr)); } } public static void main(String[] args) { int arr[] = new int[]{1, 6, 2, 2, 5}; 冒泡排序.BubbleSort(arr); System.out.println(Arrays.toString(arr)); } 一: 区别 1.冒泡排序是比较相邻位置的两个数，而选择排序是按顺序比较，找最大值或者最小值；\n2.冒泡排序每一轮比较后，位置不对都需要换位置，选择排序每一轮比较都只需要换一次位置；\n3.冒泡排序是通过数去找位置，选择排序是给定位置去找数；\n二: 冒泡排序优缺点 1.优点:比较简单,空间复杂度较低，是稳定的；\n2.缺点:时间复杂度太高，效率慢；\n三: 选择排序优缺点 1.优点：一轮比较只需要换一次位置；\n2.缺点：效率慢，不稳定（举个例子5，8，5，2，9 我们知道第一遍选择第一个元素5会和2交换，那么原序列中2个5的相对位置前后顺序就破坏了）。\njdk代理和CGLIB代理的区别 一、简单来说：\nJDK动态代理只能对实现了接口的类生成代理，而不能针对类，它的实现原理是通过InvocationHandler.invoke方法实现对实现类方法的调用（InvocationHandler实例已经持有了对实现类对象的引用了），然后实现方法前后的拦截。\nCGLIB是针对类实现代理，主要是对指定的类生成一个子类，覆盖其中的方法（继承），然后通过MethodIntercept.intercept方法来实现在调用父类方法的前后执行拦截。 jdk代理是通过持有实现类的引用来实现对实现类方法的调用的，而CGLIB是通过调用父类的方法来实现对被代理类的方法调用的。\n二、Spring在选择用JDK还是CGLiB的依据： (1)当Bean实现接口时，Spring就会用JDK的动态代理。 (2)当Bean没有实现接口时，Spring使用CGlib实现。 (3)可以强制使用CGlib（在spring配置中加入\u0026lt;aop:aspectj-autoproxy proxy-target-class=“true”/\u0026gt;） 三、CGlib比JDK快？ (1)使用CGLib实现动态代理，CGLib底层采用ASM字节码生成框架，使用字节码技术生成代理类，比使用Java反射效率要高。唯一需要注意的是，CGLib不能对声明为final的方法进行代理，因为CGLib原理是动态生成被代理类的子类。\n(2)在对JDK动态代理与CGlib动态代理的代码实验中看，1W次执行下，JDK7及8的动态代理性能比CGlib要好20%左右。\nSpringBoot在1.4版本后默认使用的是cglib动态代理,\n选择排序的选择最大的，然后放到最后\n1 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 public class 选择排序 { static int[] array = {3, 2, 4, 1, 5, 0}; public static void chooseSort(int[] a) { int max = 0; int index = 0; //外层循环，控制选择的次数，数组长度为6，一共需要选择5次 for (int i = 0; i \u0026lt; a.length - 1; i++) { for (int j = 0; j \u0026lt; a.length - i; j++) { if (max \u0026lt; a[j]) { max = a[j]; index = j; } } //每次选择完成后，max中存放的是该轮选出的最大值 //将max指向位置的元素和数组最后一个元素位置互换 int temp = a[a.length - i - 1]; a[a.length - i - 1] = max; a[index] = temp; //清空max和index，便于下次 max = 0; index = 0; System.out.println(\u0026#34;经过第\u0026#34; + (i + 1) + \u0026#34;轮选择后，数组为\u0026#34; + Arrays.toString(a)); } } public static void main(String[] args) { chooseSort(array); } } 配置环境变量 JAVA_HOME ——\u0026gt; +安装路径\npath\n%JAVA_HOME%\\bin\n%JAVA_HOME%\\jre\\bin\n八大数据类型 byte 字节型 short 短整型 int 整型 long 长整型 float 单精度 double 双精度 boolean 布尔型 char 字符型 反射获取class 类名.class Class.forName(类名) 通过类对象获取 通过类加载器获取 volatile 可见性 禁止指令重排序优化\n双亲委派机制的工作流程： 当前ClassLoader首先从自己已经加载的类中查询是否此类已经加载，如果已经加载则直接返回原来已经加载的类。 每个类加载器都有自己的加载缓存，当一个类被加载了以后就会放入缓存，等下次加载的时候就可以直接返回了。\n当前classLoader的缓存中没有找到被加载的类的时候，委托父类加载器去加载，父类加载器采用同样的策略，首先查看自己的缓存，然后委托父类的父类去加载，一直到bootstrp ClassLoader.\n当所有的父类加载器都没有加载的时候，再由当前的类加载器加载，并将其放入它自己的缓存中，以便下次有加载请求的时候直接返回。\n总结： “双亲委派”机制只是Java推荐的机制，并不是强制的机制。\n我们可以继承java.lang.ClassLoader类，实现自己的类加载器。如果想保持双亲委派模型，就应该重写findClass(name)方法；如果想破坏双亲委派模型，可以重写loadClass(name)方法\n类装载线程安全\n泛型 泛型的本质是参数化类型，这种参数类型可以用在类、接口和方法的创建中，分别称为泛型类、泛型接口、泛型方法。 在 Java SE 1.5 之前没有泛型的情况的下只能通过对类型 Object 的引用来实现参数的任意化，其带来的缺点是要做显式强制类型转换，而这种强制转换编译期是不做检查的，容易把问题留到运行时， 所以 泛型的好处是在编译时检查类型安全，并且所有的强制转换都是自动和隐式的，提高了代码的重用率，避免在运行时出现 ClassCastException。\n类加载顺序 (祖)(父)(自己)类静态代码块 \u0026ndash;\u0026gt; (祖)(父)(自己)实例化方法然后构造方法\n如果调用静态方法\n(祖)(父)类静态代码块 \u0026ndash;\u0026gt; (祖)(父)(自己)实例化方法然后构造方法 \u0026ndash;\u0026gt; (自己)类静态代码块\n结论：如果调用静态方法，静态方法最后执行\n设计模式描述 本质 维护性，通用性，扩展性，降低复杂度\n七大原则 单一职责原则 一个类负责一个功能\n接口隔离原则 接口细化\n依赖到转（到置）原则 依赖关系传递的三种方式 接口传递 构造方法传递 setter方式传递\n里氏替换原则 尽量不要重写夫类方法\n开闭原则（ocp）原则 对扩展方开放（提供方），对使用方关闭（消费方）使用接口，抽象\n迪米特法则原则 直接朋友 成员变量，方法参数，方法返回值 一个类不要有其他朋友的直接逻辑代码 把逻辑代码写到该类中（单一职责）\n合成复用原则 尽量不要用继承 使用方法传参（依赖） 类内部变量使用set方法（聚合） 类内部变量并创建对象（组合）\n三种类型，共23种 创建型（5种） 单例模式（8种写法） 饿汉式（两种） 写法简单 如果不用会浪费内存\n静态常量 静态代码块 懒汉式（三种） 线程不安全 线程安全（同步方法） 线程安全（同步代码块） 双重检查 静态内部类 枚举 抽象工厂模式（Factory） 逻辑判断代码，创建对象代码和执行方法分离 抽象工厂类创建抽象方法，由子类实现 执行方法分离抽象工厂类，调用抽象工厂方法 产品分离，工厂分离\n原型模式（克隆） 浅拷贝 实现接口Cloneable从写cloue()方法 属性里面有引用对象不会拷贝对象 会直接引用原类里引用对象的地址\n深拷贝 实现接口Cloneable从写cloue()方法 手写代码克隆引用对象 引用对象类需要实现克隆 属性里面有引用对象会重新拷贝一份对象\n序列化 实现接口Serializable\n代码实现 //创建字节输入流 bos = new ByteArrayOutputStream(); //创建对象输入流 oop = new ObjectOutputStream(bos); //写入对象 oop.writeObject(this); //创建字节输出流 bis = new ByteArrayInputStream(bos.toByteArray()); //创建对象输出流获取对象 oip = new ObjectInputStream(bis);\n建造者模式（产品差异性不大） 默认 执行流程和建造过程在同一个类中\n实现 分离执行流程和建造流程\n工厂模式 默认 逻辑判断代码，创建对象代码以及执行方法在一起\n简单 逻辑判断代码，创建对象代码和执行方法分离 方法调用或者静态方法调用\n方法 逻辑判断代码，创建对象代码和执行方法分离 工厂类创建执行方法 逻辑判断代码，创建对象代码由子类实现 执行方法分离工厂类，调用工厂方法 产品分离，工厂不分离\n结构型（7种） 适配器模式 类适配器 就是继承，然后调用方法\n对象适配器 构造函数传递类，调用类方法\n接口适配器 创建一个接口，写出方法 创建一个抽象类，重写方法 new一个抽象类，根据需要重写实现方法\n桥接模式（Bridge） 品牌手机：手机品牌，手机样式 手机接口： 多个手机品牌实现手机接口 手机样式抽象类： 组合手机接口，多个手机样式继承手机样式抽象类 创建手机样式，传递手机品牌，返回手机\n1）对于那些不希望使用继承或因为多层次继承导致系统类的个数急剧增加的系统，桥接模式无为适用. 2)常见的应用场景: -JDBc驱动程序 -银行转账系统 转账分类:网上转账,柜台转账，AMT车转专账 转账用户类型:普通用户，银卡用户,金卡用户.. -消息管理 消息类型:即时消息,延时消息 消息分类:手机短信，邮件消息，QQ消息\u0026hellip;\n装饰模式 装饰者包含被装饰者 动态的将新功能附加到对象上\n组合模式 外观模式 享元模式 代理模式 行为型（11种） 模版方法模式 命令模式 访问者模式 迭代器模式 万能时间格式化 1 2 3 4 5 6 7 8 public static void main(String[] args) { String pattern =\u0026#34;[[yyyy][yy][-][/][][MM][M][-][/][][dd][d][[\u0026#39;T\u0026#39;][ ][HH][H][:][mm][m][:][ss][s][.SSSSSSSz][.SSS[XXX][X]]]]\u0026#34;; [[yyyy][yy][-][/][.][][MM][M][-][/][.][][dd][d][[\u0026#39;T\u0026#39;][ ][HH][H][:][mm][m][:][ss][s][.SSSSSSS][.SSSSSSSz][.SSS[XXX][X]]]] String timeSample =\u0026#34;2018-5-04 3:\u0026#34;; DateTimeFormatter formatter = DateTimeFormatter.ofPattern(pattern); TemporalAccessor accessor = formatter.parse(timeSample); System.out.println(LocalDateTime.from(accessor).format(DateTimeFormatter.ofPattern(\u0026#34;yyyy-MM-dd HH:mm:ss\u0026#34;))); } Accessors // @Accessors(chain = true) // 导入不允许使用 会找不到set方法\n配置环境变量 JAVA_HOME ——\u0026gt; +安装路径\npath\n%JAVA_HOME%\\bin\n%JAVA_HOME%\\jre\\bin\n八大数据类型 byte 字节型 short 短整型 int 整型 long 长整型 float 单精度 double 双精度 boolean 布尔型 char 字符型 反射获取class 类名.class Class.forName(类名) 通过类对象获取 通过类加载器获取 @Inherited注解的作用 @Inherited注解的作用 JAVA volatile 可见性 禁止指令重排序优化\n双亲委派机制的工作流程： 当前ClassLoader首先从自己已经加载的类中查询是否此类已经加载，如果已经加载则直接返回原来已经加载的类。 每个类加载器都有自己的加载缓存，当一个类被加载了以后就会放入缓存，等下次加载的时候就可以直接返回了。\n当前classLoader的缓存中没有找到被加载的类的时候，委托父类加载器去加载，父类加载器采用同样的策略，首先查看自己的缓存，然后委托父类的父类去加载，一直到bootstrp ClassLoader.\n当所有的父类加载器都没有加载的时候，再由当前的类加载器加载，并将其放入它自己的缓存中，以便下次有加载请求的时候直接返回。\n总结：\n“双亲委派”机制只是Java推荐的机制，并不是强制的机制。\n我们可以继承java.lang.ClassLoader类，实现自己的类加载器。如果想保持双亲委派模型，就应该重写findClass(name)方法；如果想破坏双亲委派模型，可以重写loadClass(name)方法\n类装载线程安全\n泛型 泛型的本质是参数化类型，这种参数类型可以用在类、接口和方法的创建中，分别称为泛型类、泛型接口、泛型方法。 在 Java SE 1.5 之前没有泛型的情况的下只能通过对类型 Object 的引用来实现参数的任意化，其带来的缺点是要做显式强制类型转换，而这种强制转换编译期是不做检查的，容易把问题留到运行时， 所以 泛型的好处是在编译时检查类型安全，并且所有的强制转换都是自动和隐式的，提高了代码的重用率，避免在运行时出现 ClassCastException。\n上传文件问题 StandardMultipartHttpServletRequest parseRequest 文件上传慢\njava 混淆 allatori ","date":"2026-03-09T00:00:00Z","permalink":"/p/java/","title":"java"},{"content":"bun 下一代js bun webRtc 网站 参考 参考 参考 参考 虚拟表格 参考 对象复制 参考 集成 websocket 的四种方案 详情1 详情2 netty ws连接 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 public void ConnWebSocketServer() { EventLoopGroup client = new NioEventLoopGroup(); try { Bootstrap bootstrap = new Bootstrap(); URI wsUri = new URI(\u0026#34;ws://119.29.180.139:9503/ws\u0026#34;); bootstrap.group(client) .channel(NioSocketChannel.class) .handler(new ChannelInitializer\u0026lt;SocketChannel\u0026gt;() { @Override protected void initChannel(SocketChannel ch) { ChannelPipeline pipeline = ch.pipeline(); pipeline.addLast(new HttpClientCodec()); pipeline.addLast(new HttpObjectAggregator(1024 * 10)); pipeline.addLast(\u0026#34;WebSocketClientHandler\u0026#34;, new WebSocketClientHandler(WebSocketClientHandshakerFactory.newHandshaker(wsUri, WebSocketVersion.V13, null, true, new DefaultHttpHeaders()))); pipeline.addLast(new StringDecoder()); pipeline.addLast(new StringEncoder()); } }); ChannelFuture cf = bootstrap.connect(wsUri.getHost(), wsUri.getPort()).sync(); cf.channel().closeFuture().sync(); } catch (Exception ignored) { } finally { client.shutdownGracefully(); } } 回调类\n1 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 package com.wisdomsite.socket; import io.netty.channel.*; import io.netty.handler.codec.http.FullHttpResponse; import io.netty.handler.codec.http.websocketx.CloseWebSocketFrame; import io.netty.handler.codec.http.websocketx.TextWebSocketFrame; import io.netty.handler.codec.http.websocketx.WebSocketClientHandshaker; public class WebSocketClientHandler extends SimpleChannelInboundHandler\u0026lt;Object\u0026gt; { private WebSocketClientHandshaker webSocketClientHandshaker; private ChannelPromise handshakeFuture = null; public WebSocketClientHandler(WebSocketClientHandshaker webSocketClientHandshaker) { this.webSocketClientHandshaker = webSocketClientHandshaker; } @Override public void handlerAdded(ChannelHandlerContext ctx) { this.handshakeFuture = ctx.newPromise(); } /** * 当客户端主动链接服务端的链接后，调用此方法 * * @param channelHandlerContext ChannelHandlerContext */ @Override public void channelActive(ChannelHandlerContext channelHandlerContext) { Channel channel = channelHandlerContext.channel(); // 握手 webSocketClientHandshaker.handshake(channel); } @Override protected void channelRead0(ChannelHandlerContext ctx, Object msg) throws Exception { // 握手协议返回，设置结束握手 if (!this.webSocketClientHandshaker.isHandshakeComplete()) { FullHttpResponse response = (FullHttpResponse) msg; this.webSocketClientHandshaker.finishHandshake(ctx.channel(), response); this.handshakeFuture.setSuccess(); return; } if (msg instanceof TextWebSocketFrame) { TextWebSocketFrame textFrame = (TextWebSocketFrame) msg; System.out.println(textFrame); } if (msg instanceof CloseWebSocketFrame) { } } @Override public void channelInactive(ChannelHandlerContext ctx) throws Exception { // System.out.println(\u0026#34;WebSocketClientHandler::channelInactive 服务端连接成功\u0026#34;); } @Override public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { cause.printStackTrace(); ctx.channel().close(); } } RSA 公钥解密 版本: \u0026ldquo;jsencrypt\u0026rdquo;: \u0026ldquo;3.2.0\u0026rdquo;, 原地址 js文件\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 import JSEncrypt from \u0026#39;jsencrypt/bin/jsencrypt.min\u0026#39; // 密钥对生成 http://web.chacuo.net/netrsakeypair // 公钥 const publicKey = `` // 利用公钥对数据加密 export function encrypt(text) { const encryptor = new JSEncrypt() encryptor.setPublicKey(publicKey) return encryptor.encrypt(text) } // 利用公钥对私钥加密的数据进行解密 export function decrypt(text) { const encryptor = new JSEncrypt() encryptor.setPublicKey(publicKey) let decrypt = encryptor.decrypt(text) return decrypt ? decrypt : \u0026#39;\u0026#39; } RSA默认不支持公钥解密私钥 修改jsencrypt.js文件\n1 2 3 4 5 6 7 t.prototype.decrypt=function(t){ // var e=P(t,16),i=this.doPrivate(e); var e=P(t,16),i=this.doPublic(e); return null==i?null:function(t,e){ for(var i=t.toByteArray(),r=0;r\u0026lt;i.length\u0026amp;\u0026amp;0==i[r];)++r; // if(i.length-r!=e-1||2!=i[r])return null; for(++r;0!=i[r];)if(++r\u0026gt;=i.length)return null; 后台java文件\n1 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 import org.apache.commons.codec.binary.Base64; import javax.crypto.Cipher; import java.security.KeyFactory; import java.security.PrivateKey; import java.security.spec.PKCS8EncodedKeySpec; /** * rsa 密钥加密解密 */ public class RsaUtils { /** * Rsa 私钥 */ public static String privateKey = \u0026#34;\u0026#34;; /** * 私钥解密 * * @param text 待解密的文本 * @return 解密后的文本 */ public static String decryptByPrivateKey(String text) throws Exception { return decryptByPrivateKey(privateKey, text); } /** * 私钥加密 * * @param text 待加密的文本 * @return 加密后的文本 */ public static String decryptByPublicKey(String text) throws Exception { return encryptByPrivateKey(privateKey, text); } /** * 私钥加密 * * @param privateKeyString 私钥 * @param text 待加密的信息 * @return 加密后的文本 */ public static String encryptByPrivateKey(String privateKeyString, String text) throws Exception { PKCS8EncodedKeySpec pkcs8EncodedKeySpec = new PKCS8EncodedKeySpec(Base64.decodeBase64(privateKeyString)); KeyFactory keyFactory = KeyFactory.getInstance(\u0026#34;RSA\u0026#34;); PrivateKey privateKey = keyFactory.generatePrivate(pkcs8EncodedKeySpec); Cipher cipher = Cipher.getInstance(\u0026#34;RSA\u0026#34;); cipher.init(Cipher.ENCRYPT_MODE, privateKey); byte[] result = cipher.doFinal(text.getBytes()); return Base64.encodeBase64String(result); } /** * 私钥解密 * * @param privateKeyString 私钥 * @param text 待解密的文本 * @return 解密后的文本 */ public static String decryptByPrivateKey(String privateKeyString, String text) throws Exception { PKCS8EncodedKeySpec pkcs8EncodedKeySpec5 = new PKCS8EncodedKeySpec(Base64.decodeBase64(privateKeyString)); KeyFactory keyFactory = KeyFactory.getInstance(\u0026#34;RSA\u0026#34;); PrivateKey privateKey = keyFactory.generatePrivate(pkcs8EncodedKeySpec5); Cipher cipher = Cipher.getInstance(\u0026#34;RSA\u0026#34;); cipher.init(Cipher.DECRYPT_MODE, privateKey); byte[] result = cipher.doFinal(Base64.decodeBase64(text)); return new String(result); } } 异步 Promise详解（resolve,reject,catch） 详情 其他 // 获取描述信息（可查询不可修改）\n浅拷贝 Object.assign()\n深拷贝 Object.getOwnPropertyDescriptors()\n想要修改需要使用\nObject.defineProperties\nObject.defineProperties() 方法直接在一个对象上定义新的属性或修改现有属性，并返回该对象\n1 2 Object.defineProperties({},student对象) // 相当于拷贝一个新的student对象 在js中使用 = 为赋值对象的引用(指针)，并不能创建一个一模一样的对象\nmouseover(鼠标覆盖)mouseenter(鼠标进入)两个事件的区别 详情 剪切板复制粘贴 highlightjs前端代码高亮 官方 中文网站 vue使用highlight.js的坑 详情 Thymeleaf 时间 1 #dates.format(#dates.createNow(),\u0026#39;yyyy-MM-dd HH:mm:ss\u0026#39;) 保留小数 ${#numbers.formatDecimal(num,0,\u0026lsquo;COMMA\u0026rsquo;,2,\u0026lsquo;POINT\u0026rsquo;)}则显示 .00\n${#numbers.formatDecimal(num,1,\u0026lsquo;COMMA\u0026rsquo;,2,\u0026lsquo;POINT\u0026rsquo;)}则显示 0.00\nCOMMA：\u0026rsquo;,\u0026rsquo;\nPOINT：‘.’\n配置文件 spring.thymeleaf\n关闭缓存\ncache=false\n模板位置\nprefix=classpath:/**/\nsuffix=.html\nhtml属性 html头属性 xmlns:th=\u0026ldquo;http://www.thymeleaf.org \u0026rdquo;\nth:标签属性\n#{取值}\nth:text=\u0026quot;${}\u0026quot;\nth:object=\u0026quot;${}\u0026quot; \u0026ldquo;*{}\u0026rdquo;\n[[${取作用域的值}]]\nurl@{}\nth:each=\u0026ldquo;a:${**}\u0026rdquo;\naStat\n第一个 first\n最后一个 last\n奇数 even\n偶数 odd\n排除 th:unless\n使用工具包 1 #strings.isEmpty(msg) jsp攻略 a标签 1 2 //新页面 target=\u0026#34;_blank\u0026#34; 下拉框 1 2 3 4 //获取下拉框 已选择的值 alert($(\u0026#34;#create-transactionStage option:selected\u0026#34;).text()) //获取下拉框 已选择的内容 alert($(\u0026#34;#create-transactionStage option:selected\u0026#34;).val()) 禁止修改属性 1 readonly 1 disabled 用表单提交不了 是灰色的背景 输入的值只能是数字 1 oninput=\u0026#34;value=value.replace(/[^\\d]/g,\u0026#39;\u0026#39;)\u0026#34; 关于表单 中有一个输入框的时候回车默认触发action事件\n1 2 3 4 5 6 设置表单数据没有都不触发 action=\u0026#34;javascript:;\u0026#34; 设置输入框不提示缓存内容 autocomplete=\u0026#34;off\u0026#34; 选择多个文件 multiple 上传文件 1 2 3 4 enctype=\u0026#34;multipart/form-data\u0026#34; ajax new FormData($(\u0026#39;#dataForm\u0026#39;)[0]), 鼠标放上去的提示以及图片加载失败提示 1 2 3 4 鼠标放上去的提示 title=\u0026#34;没有图片\u0026#34; 图片加载失败图片 onerror=\u0026#34;onerror=null;src=\u0026#39;static/images/products/c_0001.jpg\u0026#39;\u0026#34; 1 2 获得焦点 $(\u0026#34;#name\u0026#34;).focus() 取整 1 parseInt（数值） 显示 1 juery对象.hide() 隐藏 1 juery对象.show() 元素追加 选择器.htm;()重新设置内部内容\n选择器.empty()删除元素内部内容\n选择器.append()元素内部\n选择器.after()元素外部后面\n选择器.before()元素外部前面\n判断不为空 1 ${not empty activity.startDate \u0026amp;\u0026amp; !(activity.startDate eq null)?activity.startDate:\u0026#34;未设置\u0026#34;} 正则表达式 /表达式/.test(变量)\n选择器 id：#id\nclass：.id\n标签：id\n表单：:id\n提示删除信息 1 if (!confirm(\u0026#34;确认删除吗\u0026#34;)) return; 过滤器(筛选器) $(\u0026ldquo;id:first\u0026rdquo;) //第一个\n$(\u0026ldquo;id:last\u0026rdquo;) //第后一个\n$(\u0026ldquo;id:eq(2)\u0026rdquo;) //按照下标查询\ntable 1 2 3 4 行 rowspan=\u0026#34;\u0026#34; 列 colspan=\u0026#34;\u0026#34; 空格 换行 1 \u0026lt;br/\u0026gt; 一行 JSTL标签库 for循环 1 \u0026lt;%@taglib prefix=\u0026#34;c\u0026#34; uri=\u0026#34;http://java.sun.com/jsp/jstl/core\u0026#34; %\u0026gt; 1 \u0026lt;c:forEach items=\u0026#34;${requestScope.list}\u0026#34; var=\u0026#34;emp\u0026#34;\u0026gt;\u0026lt;/c:forEach\u0026gt; 1 2 3 \u0026lt;c:if test=\u0026#34;${not empty 判断数据（对象）}\u0026#34;\u0026gt; //不为空 \u0026lt;/c:if\u0026gt; 1 2 \u0026lt;c:forEach items=\u0026#34;${集合(容器)}\u0026#34; var=\u0026#34;自定义名称\u0026#34;\u0026gt; \u0026lt;/c:forEach\u0026gt; and 和\nor 或者\n选择标签 1 2 3 4 5 6 7 8 \u0026lt;c:choose\u0026gt; \u0026lt;c:when test=\u0026#34;\u0026#34;\u0026gt; \u0026lt;%-- 选择标签--%\u0026gt; \u0026lt;/c:when\u0026gt; \u0026lt;c:otherwise\u0026gt; \u0026lt;%-- 都不成立执行这个--%\u0026gt; \u0026lt;/c:otherwise\u0026gt; \u0026lt;/c:choose\u0026gt; 判断回车按键 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 $(window).keydown(e =\u0026gt; { if (e.key == \u0026#34;Enter\u0026#34;) { if (!createClueModal.is(\u0026#34;:hidden\u0026#34;)) { //判断是否失去焦点 if (!($(\u0026#34;#noteContent\u0026#34;)[0] == document.activeElement)) { updateRemarkBtn.click() } createClueBtn.click() } } }) $(document).ready(function () { $(\u0026#34;:text\u0026#34;).keydown(function () { // 按键按下时触发的事件； $(\u0026#34;:text\u0026#34;).css(\u0026#34;background-color\u0026#34;, \u0026#34;green\u0026#34;); }); $(\u0026#34;:text\u0026#34;).keyup(function () { // 按键弹起时触发的事件； $(\u0026#34;:text\u0026#34;).css(\u0026#34;background-color\u0026#34;, \u0026#34;blue\u0026#34;); }); $(\u0026#34;button\u0026#34;).click(function () { $(\u0026#34;:text\u0026#34;).keyup(); // keyup()方法触发keyup事件； }); var i = 0; $(\u0026#34;:text\u0026#34;).keypress(function () { // keypress：输入框每获取一个字符，就触发一次该事件。 $(\u0026#34;span\u0026#34;).text(i++); }); }); 内置对象 request：请求\nresponse：响应\nsession：会话\napplication：ServletContext\nconfig：ServletConfing\nout：页面输出对象\npage：this\nexception：异常对象\npageContext：jsp核心，功能对象\n指令元素 \u0026lt;$@ 元素%\u0026gt;\npage里面的属性 pageEncoding:响应编码\ncontentType:相应类型\nlanguage: 指定语言java\nisErrorPage:是否接收异常\nerrorPage:\nimport:导包\ninclude:包含其他jsp taglib:引入其他标签库 脚本元素 \u0026lt;% %\u0026gt;定义jspService()方法内容\n\u0026lt;%! %\u0026gt;声明标签：定义类下的内容\n\u0026lt;%= %\u0026gt;输出标签：表达式标签\n\u0026lt;%\u0026ndash; \u0026ndash;%\u0026gt;注释标签\n动作元素 \u0026lt;jsp:include 包含其他jsp\n\u0026lt;jsp:forward 请求转发\n\u0026lt;jsp:param 传参数\n\u0026lt;jsp:useBean 类实例化\n\u0026lt;jsp:setProperty 属性设置\n\u0026lt;jspgetProperty 属性获取\nEL表达式 ${id}\n默认从四个作用域中获取\n从最小的page中开始获取\n内置对象(小\u0026gt;大) (6个作用域范围)\npageScope\nrequsetScope\nsessionScope\napplicationScope\n获取 ？后面的请求参数 ${param.id}\n获取同名的多个参数 ${param.id[0]}\n${param.id[1]}\n${param.id[2]}\n获取cookie内容 ${cookie.id}\n获取Map ${对象(键)}\n获取List ${对象[下标]}\najax 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 $.ajax({ url: \u0026#39;settings/qx/user/login.do\u0026#39;, data: { loginAct: loginAct, loginPwd: loginPwd, isRemPew: isRemPew, }, type: \u0026#39;post\u0026#39;, dataType: \u0026#39;json\u0026#39;, //如果你想要用传统的方式来序列化数据，那么就设置为true //用来上传数组 traditional:true, success: function (data) { if (data.code == \u0026#34;1\u0026#34;) { window.location.href = \u0026#34;workbench/index.do\u0026#34;; } else { $(\u0026#34;#msg\u0026#34;).text(data.message); } }, beforeSend:function () {//在发生ajax之前执行这个函数 } }) 截取字符串 str.substr(从哪里开始,截取的长度)\nstr.substr(从哪里开始) 截取到字符串最后\nstr.substring(从哪里开始,截取到哪里)\n获取某个值的下标 1 str.lastIndexOf(\u0026#34;.\u0026#34;) 返回上一页 1 onclick=\u0026#34;window.history.back();\u0026#34; 全选 方式1 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 var $chk = $(\u0026#34;:checkbox[name=chk]\u0026#34;); // 全选 $(\u0026#34;#selectAll\u0026#34;).click(function() { // 让所有复选框的选中状态和全选按钮的选中状态一致 $chk.prop(\u0026#34;checked\u0026#34;, this.checked); }); // 当取消选中某个商品，全选按钮也应该取消选中，即选择商品的复选框会影响全选按钮的选中状态 $chk.click(function() { /*// 先让全选按钮选中 $(\u0026#34;#selectAll\u0026#34;).prop(\u0026#34;checked\u0026#34;, true); // 遍历查找未选中的复选框，如果有，则全选按钮一定是未选中的 $chk.each(function() { if (!this.checked) { $(\u0026#34;#selectAll\u0026#34;).prop(\u0026#34;checked\u0026#34;, false); // 必须return false才可以结束each循环 return false; } });*/ // 判断选中的数量和总数据是否一致，如果一致，则全选按钮选中 //$(\u0026#34;#selectAll\u0026#34;).prop(\u0026#34;checked\u0026#34;, $chk.length == $(\u0026#34;:checkbox[name=chk]:checked\u0026#34;).length); // $(\u0026#34;#selectAll\u0026#34;).prop(\u0026#34;checked\u0026#34;, $chk.length == $chk.filter(\u0026#34;:checked\u0026#34;).length); $(\u0026#34;#selectAll\u0026#34;).prop(\u0026#34;checked\u0026#34;, !$chk.is(\u0026#34;:not(:checked)\u0026#34;)); }); 方式2 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 //单击全选按钮 $(\u0026#34;#selectAll\u0026#34;).click(function () { $(\u0026#34;#checkTable input[type=\u0026#39;checkbox\u0026#39;]\u0026#34;).prop(\u0026#39;checked\u0026#39;, $(\u0026#34;#selectAll\u0026#34;).prop(\u0026#39;checked\u0026#39;)) }) //给所有复选框添加单击事件 var arrayObj = $(\u0026#34;#checkTable input[type=\u0026#39;checkbox\u0026#39;]\u0026#34;) arrayObj.splice(0, 1) // console.log(arrayObj) arrayObj.click(function () { if ($(\u0026#34;#selectAll\u0026#34;).prop(\u0026#39;checked\u0026#39;)) { if (!($(\u0026#34;#checkTable input[type=\u0026#39;checkbox\u0026#39;]:checked\u0026#34;).size() == ($(\u0026#34;#checkTable input[type=\u0026#39;checkbox\u0026#39;]\u0026#34;).size()))) { $(\u0026#34;#selectAll\u0026#34;).prop(\u0026#39;checked\u0026#39;, false) } } else { if ($(\u0026#34;#checkTable input[type=\u0026#39;checkbox\u0026#39;]:checked\u0026#34;).size() == ($(\u0026#34;#checkTable input[type=\u0026#39;checkbox\u0026#39;]\u0026#34;).size() - 1)) { $(\u0026#34;#selectAll\u0026#34;).prop(\u0026#39;checked\u0026#39;, true) } } }) 老师笔记 1、js截取字符串： str.substr(startIndex,length); str.substr(startIndex);//从下标为startIndex的字符开始截取，截取到字符串的最后，得到目标字符串。 var str=\u0026ldquo;abcdef\u0026rdquo;; str.substr(2);//===\u0026gt;cdef\nstr.substring(startIndex,endIndex);\njs中获取指定字符在字符串中的下标：str.indexOf(\u0026quot;.\u0026quot;) js中获取指定的最后一个字符在字符串中的下标：str.lastIndexOf(\u0026quot;.\u0026quot;) js中把字符串中所有的字母统一转化成大写字母： str.toUpperCase(); 2、ajax发送异步请求： data:向后台提交参数，三种写法： 1)、{ name1:value2, name2:value2, \u0026hellip;.. } 只能用于提交文本数据 2)、name1=value1\u0026amp;name2=value2\u0026amp;\u0026hellip;. 只能用于提交文本数据 3)、FormData对象：FormData是ajax提供的一个接口，可以模拟name1-value1键值对向后台提交参数； FormData最大的优势是不但能提交文本数据，还能提交二进制数据。 var formData=new FormData(); formData.append(\u0026ldquo;activityFile\u0026rdquo;,activityFile); formData.append(\u0026ldquo;username\u0026rdquo;,\u0026ldquo;zhangsan\u0026rdquo;); 3、在页面中给元素添加事件的方式： 1)、使用事件属性： 2)、使用jquery的事件函数： 选择器.click(function(){ //\u0026hellip;.. }); 只能对固有元素添加事件，不能对动态生成的元素添加事件。 在页面加载过程中产生的元素，叫固有元素; 在页面加载完成之后产生的元素，叫动态生成的元素。 3)、使用jquery的on函数： 不但能给固有元素添加事件，还能给动态生成的元素添加事件，通常用来给动态生成的元素添加事件。 父选择器.on(事件类型,目标选择器,function(){ //\u0026hellip;. });\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 父选择器：要求父选择器必须是固有元素，不一定是直接父元素，但是要求必须是固有的。 \u0026lt;div id=\u0026#34;div2\u0026#34;\u0026gt;//固有 \u0026lt;div id=\u0026#34;div1\u0026#34;\u0026gt; \u0026lt;input type=\u0026#34;button\u0026#34;\u0026gt; \u0026lt;/div\u0026gt; \u0026lt;/div\u0026gt; $(\u0026#34;#div2\u0026#34;).on(); 事件类型:跟jquery的事件函数一致。 目标选择器：在父选择器基础之上查找目标元素。 \u0026lt;div id=\u0026#34;div2\u0026#34;\u0026gt;//固有 \u0026lt;div id=\u0026#34;div1\u0026#34;\u0026gt; \u0026lt;input type=\u0026#34;button\u0026#34;\u0026gt; \u0026lt;/div\u0026gt; \u0026lt;/div\u0026gt; \u0026lt;input type=\u0026#34;button\u0026#34;\u0026gt; $(\u0026#34;#div2\u0026#34;).on(\u0026#34;click\u0026#34;,\u0026#34;input[type=\u0026#39;button\u0026#39;]\u0026#34;); function:回调函数。 $(\u0026#34;#div2\u0026#34;).on(\u0026#34;click\u0026#34;,\u0026#34;input[type=\u0026#39;button\u0026#39;]\u0026#34;,function(){......}); bs分页 1 容器.bs_pagination(\u0026#39;getOption\u0026#39;, \u0026#39;rowsPerPage\u0026#39;) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 //分页插件 let totalPages = 0; if (data.data.totalRows % pageSize == 0) { totalPages = data.data.totalRows / pageSize } else { totalPages = parseInt(data.data.totalRows / pageSize) + 1 } $(\u0026#34;#demo_pag\u0026#34;).bs_pagination({ currentPage: pageNo,//当前页 rowsPerPage: pageSize,//每有显示条数 totalRows: data.data.totalRows,//总条数 totalPages: totalPages,//总页数 visiblePageLinks: 5,//显示的翻页卡片数 showGoToPage: true,//是否显示“跳转到第几页” showRowsPerPage: true,//是否显示“每页显示条数” showRowsInfo: true,//是否显示记录的信息 //每次切换页号对会触发函数，函数那返回切换后的页号和每页显示条数 onChangePage: (e, pageObj) =\u0026gt; { findTransaction(pageObj.currentPage, pageObj.rowsPerPage) } }) jquery 获取标签的元素值 选择器.attr(\u0026quot;\u0026quot;); 获取不是true|false\n选择器.prop(\u0026quot;\u0026quot;); 获取是true|false\njquery转换为dom对象 var j = $(\u0026quot;#id\u0026quot;)\n方式1：var is = j[0];\n方式2：var id = j.get[0];\ndom转换为jquery对象 $(dom对象)\n父子选择器 1 2 3 $(\u0026#34;#tBody input[type=\u0026#39;checkbox\u0026#39;]\u0026#34;) //tBody(id)选择器下的所有input标签 []表示input标签所有的type=\u0026#39;checkbox\u0026#39;属性 空格和\u0026gt;都可以表示父子选择器\n空格表示标签下的所有标签\n小于号(\u0026gt;)只能表示标签下的子标签(直接子标签)，孙子标签的表示不了\n[]表示根据属性过滤 实现复选框全选和取消全选 1 2 3 4 5 6 7 8 9 10 11 12 13 //实现全选和取消全选 $(\u0026#34;#chkedAll\u0026#34;).click(function () { //让列表中所有的复选框属性值和全选按钮的属性值一样 $(\u0026#34;#tBody input[type=\u0026#39;checkbox\u0026#39;]\u0026#34;).prop(\u0026#34;checked\u0026#34;, $(\u0026#34;#chkedAll\u0026#34;).prop(\u0026#34;checked\u0026#34;)) }) //给所有的复选框添加单击事件 $(\u0026#34;#tBody input[type=\u0026#39;checkbox\u0026#39;]\u0026#34;).click(function () { if ($(\u0026#34;#tBody input[type=\u0026#39;checkbox\u0026#39;]\u0026#34;).size() == $(\u0026#34;#tBody input[type=\u0026#39;checkbox\u0026#39;]:checked\u0026#34;).size()) { $(\u0026#34;#chkedAll\u0026#34;).prop(\u0026#34;checked\u0026#34;, true) } else { $(\u0026#34;#chkedAll\u0026#34;).prop(\u0026#34;checked\u0026#34;, false) } }) 遍历数组 1 2 3 4 $.each(需要遍历的数组, function (index(下标), object(每次遍历的内容)) { }) //遍历一次执行一次function 删除元素 1 数组.splice(下标,数量) equals 参考 人脸 参考 水印 微信小程序 动画 lax.js js多继承 参考 echarts双Y轴 参考 前端cdn 资源访问加速 icons资源 cdn jsdelivr bootcdn cdnjs icons 阿里云iconfont icons8 国内访问拒绝问题 图片拖拽 https://github.com/SortableJS/vue.draggable.next/issues/216 https://vueuse.org/integrations/usesortable/ axios 参考 cdn导入参考 npm pnpm node 多版本管理 参考 详情 换源 pnpm 运行以下命令设置新的存储路径\n1 pnpm config set store-dir \u0026lt;new path\u0026gt; //将\u0026lt;new path\u0026gt; 替换为目标存储路径(非中文) 3.输入命令验证是否修改成功\n1 pnpm store path 换源(npm 和 pnpm 一样) 1 2 3 4 5 6 7 8 9 10 11 12 # 查看源 pnpm get registry pnpm config get registry # 切换到淘宝镜像 pnpm config set registry https://registry.npmmirror.com/ # 切换到腾讯云镜像 http://mirrors.cloud.tencent.com/npm/ # 华为 https://mirrors.huaweicloud.com/repository/npm 命令 1 2 3 4 5 6 7 8 9 10 加 -g 为全局 install 安装 uninstall 卸载 update 更新 # 查看全局安装的包 npm list -g --depth 0 # 依赖包远程信息 npm into xxx ","date":"2026-03-09T00:00:00Z","permalink":"/p/js/","title":"js"},{"content":"定时器 详细介绍 emmc 1 2 3 var=\u0026#34;$(cat /sys/kernel/debug/mmc0/mmc0\\:0001/ext_csd)\u0026#34; eol=${var:534:2};slc=${var:536:2};mlc=${var:538:2} echo \u0026#34;EOL:0x$eol SLC:0x$slc MLC:0x$mlc\u0026#34; 流量监控 iftop 参考 Debian armbian 不同的版本名称 Debian 11 Bullseye Debian 12 Bookworm Ubuntu 22.04 LTS Jammy Jellyfish Ubuntu 24.04 LTS Noble Numbat\n换Debian源 命令 1 2 armbian-sync armbian-apt 1 /etc/apt/sources.list 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 # 默认注释了源码镜像以提高 apt update 速度，如有需要可自行取消注释 deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main contrib non-free non-free-firmware # deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main contrib non-free non-free-firmware deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware # deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware # deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware # 以下安全更新软件源包含了官方源与镜像站配置，如有需要可自行修改注释切换 deb https://security.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware # deb-src https://security.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware deb http://mirrors.tuna.tsinghua.edu.cn/armbian/ buster main buster-utils buster-desktop deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free deb https://mirrors.tuna.tsinghua.edu.cn/debian-security/ bullseye-security main contrib non-free #清华 deb https://mirrors.ustc.edu.cn/debian/ bullseye main non-free contrib deb-src https://mirrors.ustc.edu.cn/debian/ bullseye main non-free contrib deb https://mirrors.ustc.edu.cn/debian-security/ bullseye-security main deb-src https://mirrors.ustc.edu.cn/debian-security/ bullseye-security main deb https://mirrors.ustc.edu.cn/debian/ bullseye-updates main non-free contrib deb-src https://mirrors.ustc.edu.cn/debian/ bullseye-updates main non-free contrib deb https://mirrors.ustc.edu.cn/debian/ bullseye-backports main non-free contrib deb-src https://mirrors.ustc.edu.cn/debian/ bullseye-backports main non-free contrib #阿里源 deb https://mirrors.aliyun.com/debian/ bullseye main non-free contrib #deb-src https://mirrors.aliyun.com/debian/ bullseye main non-free contrib deb https://mirrors.aliyun.com/debian-security/ bullseye-security main #deb-src https://mirrors.aliyun.com/debian-security/ bullseye-security main deb https://mirrors.aliyun.com/debian/ bullseye-updates main non-free contrib #deb-src https://mirrors.aliyun.com/debian/ bullseye-updates main non-free contrib deb https://mirrors.aliyun.com/debian/ bullseye-backports main non-free contrib #deb-src https://mirrors.aliyun.com/debian/ bullseye-backports main non-free contrib Armbian默认 deb http://deb.debian.org/debian bookworm main contrib non-free non-free-firmware #deb-src http://deb.debian.org/debian bookworm main contrib non-free non-free-firmware deb http://deb.debian.org/debian bookworm-updates main contrib non-free non-free-firmware #deb-src http://deb.debian.org/debian bookworm-updates main contrib non-free non-free-firmware deb http://deb.debian.org/debian bookworm-backports main contrib non-free non-free-firmware #deb-src http://deb.debian.org/debian bookworm-backports main contrib non-free non-free-firmware deb http://security.debian.org/ bookworm-security main contrib non-free non-free-firmware #deb-src http://security.debian.org/ bookworm-security main contrib non-free non-free-firmware # 中科大 deb https://mirrors.ustc.edu.cn/debian/ bookworm main contrib non-free non-free-firmware deb-src https://mirrors.ustc.edu.cn/debian/ bookworm main contrib non-free non-free-firmware deb https://mirrors.ustc.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware deb-src https://mirrors.ustc.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware deb https://mirrors.ustc.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware deb-src https://mirrors.ustc.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware deb https://mirrors.ustc.edu.cn/debian-security/ bookworm-security main contrib non-free non-free-firmware deb-src https://mirrors.ustc.edu.cn/debian-security/ bookworm-security main contrib non-free non-free-firmware # 清华 deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main non-free non-free-firmware contrib deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main non-free non-free-firmware contrib deb https://mirrors.tuna.tsinghua.edu.cn/debian-security/ bookworm-security main deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security/ bookworm-security main deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main non-free non-free-firmware contrib deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main non-free non-free-firmware contrib deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-backports main non-free non-free-firmware contrib deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-backports main non-free non-free-firmware contrib # 阿里 deb https://mirrors.aliyun.com/debian/ bookworm main non-free non-free-firmware contrib deb-src https://mirrors.aliyun.com/debian/ bookworm main non-free non-free-firmware contrib deb https://mirrors.aliyun.com/debian-security/ bookworm-security main deb-src https://mirrors.aliyun.com/debian-security/ bookworm-security main deb https://mirrors.aliyun.com/debian/ bookworm-updates main non-free non-free-firmware contrib deb-src https://mirrors.aliyun.com/debian/ bookworm-updates main non-free non-free-firmware contrib deb https://mirrors.aliyun.com/debian/ bookworm-backports main non-free non-free-firmware contrib deb-src https://mirrors.aliyun.com/debian/ bookworm-backports main non-free non-free-firmware contrib # 腾讯 deb https://mirrors.tencent.com/debian/ bookworm main non-free non-free-firmware contrib deb-src https://mirrors.tencent.com/debian/ bookworm main non-free non-free-firmware contrib deb https://mirrors.tencent.com/debian-security/ bookworm-security main deb-src https://mirrors.tencent.com/debian-security/ bookworm-security main deb https://mirrors.tencent.com/debian/ bookworm-updates main non-free non-free-firmware contrib deb-src https://mirrors.tencent.com/debian/ bookworm-updates main non-free non-free-firmware contrib deb https://mirrors.tencent.com/debian/ bookworm-backports main non-free non-free-firmware contrib deb-src https://mirrors.tencent.com/debian/ bookworm-backports main non-free non-free-firmware contrib # 网易 deb https://mirrors.163.com/debian/ bookworm main non-free non-free-firmware contrib deb-src https://mirrors.163.com/debian/ bookworm main non-free non-free-firmware contrib deb https://mirrors.163.com/debian-security/ bookworm-security main deb-src https://mirrors.163.com/debian-security/ bookworm-security main deb https://mirrors.163.com/debian/ bookworm-updates main non-free non-free-firmware contrib deb-src https://mirrors.163.com/debian/ bookworm-updates main non-free non-free-firmware contrib deb https://mirrors.163.com/debian/ bookworm-backports main non-free non-free-firmware contrib deb-src https://mirrors.163.com/debian/ bookworm-backports main non-free non-free-firmware contrib # 华为 deb https://mirrors.huaweicloud.com/debian/ bookworm main non-free non-free-firmware contrib deb-src https://mirrors.huaweicloud.com/debian/ bookworm main non-free non-free-firmware contrib deb https://mirrors.huaweicloud.com/debian-security/ bookworm-security main deb-src https://mirrors.huaweicloud.com/debian-security/ bookworm-security main deb https://mirrors.huaweicloud.com/debian/ bookworm-updates main non-free non-free-firmware contrib deb-src https://mirrors.huaweicloud.com/debian/ bookworm-updates main non-free non-free-firmware contrib deb https://mirrors.huaweicloud.com/debian/ bookworm-backports main non-free non-free-firmware contrib deb-src https://mirrors.huaweicloud.com/debian/ bookworm-backports main non-free non-free-firmware contrib 更新 apt-get update \u0026amp;\u0026amp; apt-get upgrade\n错误 The following signatures couldn\u0026rsquo;t be verified because the public key is not available\n1 2 3 4 5 6ED0E7B82643E131 54404762BBB6E853 93D6889F9F0E78D5 sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 5523BAEEB01FA116 其中的5523BAEEB01FA116是根据错误提示写的 sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys trusted.gpg问题\n1 2 3 4 cd /etc/apt sudo cp trusted.gpg trusted.gpg.d sudo cp /etc/apt/trusted.gpg /etc/apt/trusted.gpg.d No sandbox user \u0026lsquo;_apt\u0026rsquo; on the system, can not drop privileges 参考 1 sudo adduser --force-badname --system --no-create-home _apt 交换区设置 参考 查大文件 1 find / -type f -size +1G 时区 1 2 3 4 # 查看 timedatectl # 设置 cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime 服务命令 防火墙 参考文档 service 命令只支持基础 LSB 动作 start（启动） stop（停止） restart（重启） try-restart(尝试重新启动) reload(重新加载)、 force-reload(强制重新加载)、 status（状态） 如: service firewalld status （查看防火墙状态，注意顺序: service 服务 状态）\nsystemctl 和service拥有一样的命令 如: systemctl status firewalld （查看防火墙状态，注意顺序: systemctl 状态 服务）\n清空文件 参考 1 2 3 cat /dev/null \u0026gt; /var/log/messages 推荐下面的 : \u0026gt; /var/log/messages 压缩解压缩 J(大写):使用压缩 .xz\nz:使用压缩 .gz\nc:创建\nv:显示\nf:指定文件\nx:解压缩\n压缩文件 tar -zcvf 名字.tar.gz 1~n个文件\n解压文件 tar -zxvf 文件 -C 地址\n动态输出日志 tail -f 文件\n全局配置颜色： 打开配置文件： sudo vim ~/.bashrc 在最后加一行： PS1='[\\[\\e[33;40m\\]\\u@\\h \\w \\t]$ ' 然后使之生效： source ~/.bashrc 快速查找文件 修改文件权限 修改文件权限使用chmod指令。该指令常用的有两种使用方式：\n1.chmod abc filename\n指令中的a、b、c分别表示一个数字，其中a对应文件所有者权限，b对应文件所有者所在组权限，c对应其他身份权限。\n对于a、b、c各自来讲，它们都是0~7的数字，对应r、w、x三个二进制位按序组成的二进制数，举个例子，如果是只可读，对应的二进制数就是“100”，也就是4；如果是可读可写不可执行，那么对应二进制数为“110”，也就是6……\n再举个最常见的chmod 777 xxxx指令，这里有3个7，但是每个7的含义是不同的。7的二进制形式为111，表示可读可写可执行，第1个7表示文件对于文件所有者来说可读可写可执行；第2个7表示文件对于文件所有者所在组来说可读可写可执行；第3个7表示文件对于其他身份的用户来说可读可写可执行。也就是说，通过chmod 777，文件就没有了读写执行权限限制了。\n如果我要将上述client.cpp文件权限改为“文件所有者可读可写可执行，其余身份只可读”，那么就可以使用如下指令：\n","date":"2026-03-09T00:00:00Z","permalink":"/p/linux/","title":"linux"},{"content":"介绍 EMQ X 消息服务器 官网 mqttx 工具 官网 简单的安装和使用 地址 oneNET 10086官方 ","date":"2026-03-09T00:00:00Z","permalink":"/p/mqtt/","title":"mqtt"},{"content":" 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 #配置worker进程运行用户 nobody也是一个linux用户，一般用于启动程序，没有密码 user nobody; #配置工作进程数目，根据硬件调整，通常等于CPU数量或者2倍于CPU数量 worker_processes 1; #配置全局错误日志及类型，[debug | info | notice | warn | error | crit]，默认是error error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; pid logs/nginx.pid; #配置进程pid文件 ###==================================================== #配置工作模式和连接数 events { worker_connections 1024; #配置每个worker进程连接数上限，nginx支持的总连接数就等于worker_processes * worker_connections } ###=================================================== #配置http服务器,利用它的反向代理功能提供负载均衡支持 http { #配置nginx支持哪些多媒体类型，可以在conf/mime.types查看支持哪些多媒体类型 include mime.types; #默认文件类型 流类型，可以理解为支持任意类型 default_type application/octet-stream; #配置日志格式 #log_format main \u0026#39;$remote_addr - $remote_user [$time_local] \u0026#34;$request\u0026#34; \u0026#39; # \u0026#39;$status $body_bytes_sent \u0026#34;$http_referer\u0026#34; \u0026#39; # \u0026#39;\u0026#34;$http_user_agent\u0026#34; \u0026#34;$http_x_forwarded_for\u0026#34;\u0026#39;; #配置access.log日志及存放路径，并使用上面定义的main日志格式 #access_log logs/access.log main; sendfile on; #开启高效文件传输模式 #tcp_nopush on; #防止网络阻塞 #keepalive_timeout 0; keepalive_timeout 65; #长连接超时时间，单位是秒 #gzip on; #开启gzip压缩输出 ###----------------------------------------------- #配置虚拟主机 server { listen 80; #配置监听端口 server_name localhost; #配置服务名 #charset koi8-r; #配置字符集 #access_log logs/host.access.log main; #配置本虚拟主机的访问日志 #默认的匹配斜杠/的请求，当访问路径中有斜杠/，会被该location匹配到并进行处理 location / { #root是配置服务器的默认网站根目录位置，默认为nginx安装主目录下的html目录 root html; #配置首页文件的名称 index index.html index.htm; }\t#error_page 404 /404.html; #配置404页面 # redirect server error pages to the static page /50x.html #error_page 500 502 503 504 /50x.html; #配置50x错误页面 #精确匹配 location = /50x.html { root html; } #PHP 脚本请求全部转发到Apache处理 # proxy the PHP scripts to Apache listening on 127.0.0.1:80 # #location ~ \\.php$ { # proxy_pass http://127.0.0.1; #} #PHP 脚本请求全部转发到FastCGI处理 # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # #location ~ \\.php$ { # root html; # fastcgi_pass 127.0.0.1:9000; # fastcgi_index index.php; # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; # include fastcgi_params; #} #禁止访问 .htaccess 文件 # deny access to .htaccess files, if Apache\u0026#39;s document root # concurs with nginx\u0026#39;s one # #location ~ /\\.ht { # deny all; #} } #配置另一个虚拟主机 # another virtual host using mix of IP-, name-, and port-based configuration # #server { # listen 8000; # listen somename:8080; # server_name somename alias another.alias; # location / { # root html; # index index.html index.htm; # } #} #配置https服务，安全的网络传输协议，加密传输，端口443，运维来配置 # # HTTPS server # #server { # listen 443 ssl; # server_name localhost; # ssl_certificate cert.pem; # ssl_certificate_key cert.key; # ssl_session_cache shared:SSL:1m; # ssl_session_timeout 5m; # ssl_ciphers HIGH:!aNULL:!MD5; # ssl_prefer_server_ciphers on; # location / { # root html; # index index.html index.htm; # } #} } 设置gzip压缩 web管理（部署后自带nginx无需自己部署） nginxwebui nginxproxymanager 配置文件 检测 docker exec nginx nginx -t 加载 docker exec nginx nginx -s reload\nnginx之location（root/alias） 参考 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 upstream kuaifuzhi{ server 127.0.0.1:8888 down; server 127.0.0.1:8889 ; } #################### 负载均衡（实现前端修改代码不间断运行） #################### server { listen 8888; server_name 127.0.0.1; location / { root /static/simplevue8888; index index.html index.htm; try_files $uri $uri/ /index.html; } location /prod-api/{ proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header REMOTE-HOST $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass http://119.23.211.46:8080/; } location /dev-api/{ proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header REMOTE-HOST $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass http://119.23.211.46:8080/; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } } server { listen 8889; server_name 127.0.0.1; location / { root /static/simplevue8889; index index.html index.htm; try_files $uri $uri/ /index.html; } location /prod-api/{ proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header REMOTE-HOST $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass http://119.23.211.46:8080/; } location /dev-api/{ proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header REMOTE-HOST $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass http://119.23.211.46:8080/; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } } 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 #################### kuaifuzhi.com #################### server { listen 80; server_name kuaifuzhi.com; return 301 https://$server_name$request_uri; } server { listen 443 ssl http2; server_name kuaifuzhi.com; ssl_certificate /etc/nginx/https/kuaifuzhi.com/full_chain.pem; ssl_certificate_key /etc/nginx/https/kuaifuzhi.com/private.key; ssl_session_timeout 5m; ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_prefer_server_ciphers on; #开启和关闭gzip模式 gzip on; #gizp压缩起点，文件大于1k才进行压缩 gzip_min_length 1k; # gzip 压缩级别，1-9，数字越大压缩的越好，也越占用CPU时间 gzip_comp_level 6; # 进行压缩的文件类型。application/vnd.ms-fontobject开始为字体类型 gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/xml text/javascript application/json image/png image/gif image/jpeg application/vnd.ms-fontobject font/ttf font/x-woff image/svg+xml; #nginx对于静态文件的处理模块，开启后会寻找以.gz结尾的文件，直接返回，不会占用cpu进行压缩，如果找不到则不进行压缩 # gzip_static on|off # 是否在http header中添加Vary: Accept-Encoding，建议开启 gzip_vary on; # 设置压缩所需要的缓冲区大小，以4k为单位，如果文件为7k则申请2*4k的缓冲区 # 缓冲(压缩在内存中缓冲几块? 每块多大?) gzip_buffers 32 4k; # 设置gzip压缩针对的HTTP协议版本，默认1.1 #\tgzip_http_version 1.1; #配置禁用gzip条件，支持正则。此处表示ie6及以下不启用gzip（因为ie低版本不支持） gzip_disable \u0026#34;MSIE [1-6]\\.\u0026#34;; location / { # 指定上游服务器负载均衡服务器 proxy_pass http://kuaifuzhi; index index.html index.htm; } location ~ .*.simplescript.* { root /static; } location ~ .*.simple.* { root /static; } #\tlocation ~ .*\\.(js|css|gif|jpg|jpeg|png|bmp|swf|ioc|rar|zip|txt|flv|mid|doc|ppt|pdf|xls|mp3|wma|apk) { #\troot /static; #\t} location ~ .*dny001.*\\.pdf { valid_referers none blocked *.kuaifuzhi.com kuaifuzhi.com; if ($invalid_referer) { #防盗链 return 404; break; } root /static; } } ","date":"2026-03-09T00:00:00Z","permalink":"/p/nginx/","title":"nginx"},{"content":"版本号详解(^和~区别) 详情 yarn npm 参考1 参考2 yarn使用 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 npm install -g yarn # 删除代理 npm config rm proxy npm config rm https-proxy # 指定源 yarn | npm config set registry https://registry.npm.taobao.org yarn | npm config set disturl https://npm.taobao.org/dist yarn config set sass-binary-site http://npm.taobao.org/mirrors/node-sass yarn ","date":"2026-03-09T00:00:00Z","permalink":"/p/nodejs/","title":"nodejs"},{"content":"查看安装路径 1 py -0p 版本切换 详细介绍 py 查看安装目录 参考 pip 命令 参考 pip换源 pip换源1 参考链接1 参考2 参考3 pip更新\n1 python -m pip install --upgrade pip httpx教程 网络请求库httpx详解 ","date":"2026-03-09T00:00:00Z","permalink":"/p/python/","title":"python"},{"content":"docker 中数据持久化配置 详情 实现分布式锁和等待序列 详情 win软件 AnotherRedisDesktopManager github Tiny RDM 官网 github 安装 下载安装 网页 win加入自启动运行命令 1 redis-server --service-install redis.windows-service.conf --loglevel verbose 执行之后重启或者去我的电脑哪里启动一次\n其他命令 1 2 3 4 5 6 7 常用的redis服务命令。 卸载服务：redis-server --service-uninstall 开启服务：redis-server --service-start 停止服务：redis-server --service-stop 配置文件 参考 数据类型 String 最大512M）（可以是任意值数据类型、可以是Object） 通常场景为：存储结果集（Hash可以取代），存储UUID（分布式锁ID）、计数器（点赞） 特殊功能： SETNX（判断是否可以进KEY，如果有KEY存在就不保存） INCR、DECR（自增、自减） SETRANGE （偏移量，就是截取字符串） MSET（批量设置）\nList 列表、堆栈、队列、可重复元素 通常场景为：新闻列表、各种列表、模拟队列、模拟堆栈、数据表的主键存储（与hash做关联关系） 特殊功能：（L+L和R+R都是堆栈、L+R是队列）（批量操作元素以空格隔开） LPUSH、LPOP （头部插入、弹出） RPUSH、RPOP （尾部插入、弹出） BLPOP、BLPOP（阻塞头或尾弹出【了解即可】） LRANGE（范围查找）\nHash hashTable 通常场景为：数据库每行数据的记录（数据集记录） 特殊功能： HSETNX（判断是否可以进KEY，如果有KEY存在就不保存） HMSET（批量插入） HKEYS（获取所有当前key中的所有字段） HVALS（获取所有当前key中的所有字段值） HGETALL（获取所有当前key中的所有字段和值） HSCAN（迭代哈希键中的键值对）\nSet 集合、不能重复、无序 通常场景为：投票（去重不能重复投票）、找共同好友（利用集合的交差并集） 特殊功能： SINTER（交集） SUNION（并集） SDIFF（差集） SSCAN（迭代）\nZSet 集合、不能重复（重复的数据加分值而已）、有序 通常场景为：排行榜 特殊功能： ZSCORE （返回分值） ZRANGE （返回范围数据，按照分值从小到大排序） ZREVRANGE （返回范围数据，按照分值从大到小排序） ZRANK（返回排名具体指，按照分值从小到大排序） ZREVRANK（返回排名具体指，按照分值从大到小排序） ZUNIONSTORE（并集） ZINTERSTORE（交集） ZSCAN（迭代）\n失效策略 定期删除 1——每个设置过期时间的key放到独立的hash，默认每秒定时遍历这个hash而不是整个空间 1-1——从过期key字典中，随机找20个key。 1-2——删除20个key中过期的key，过期的key超过25%，则再随机找20个KEY，每次处理时间都不会超过25MS\n惰性删除 1-1——客户端使用KEY时候，先检查如果过期就删除 1-2——惰性策略是对定时策略的补充，因为定时策略不会删除所有过期的key\n内存满 FIFO——最先进入的数据被首先清理 LFU——一直以来最少使用的元素,清理hit值最小的（需要设置元素的hit值） LRU——最近最少使用的（缓存的元素有一个时间戳）时间戳离当前时间最远将清理。\n持久化 RDB（默认开）快照 快照，通过fork子进程完成持久化） 设计时间范围内N个key变动，则持久化【会丢数据】 快照机制： 1)Redis开fork子进程。 2)子进程将快照写入到临时文件 3)临时文件替换老的文件(dump.rdb) 系统默认快照策略：key的数量值代表至少有N个改变 save 900 1 save 300 10 save 60 10000 口诀：(15分钟-\u0026gt;1个、5分钟-\u0026gt;10个、1分钟-\u0026gt;1万个)\nAOF（默认关）日志 每执行一条指令就会记录，因此AOF文件会变大，则遇到阈值会压缩AOF文件【不会丢数据，但是存储空间大】 三个同步策略（就是什么时候持久化）：\n每秒同步【默认】 每修改同步 不同步 文件过大策略（rewrite机制，就是压缩文件） 写入日志的时候宕机问题（redis重启，然后使用redis-check-aof修复即可） appendfsync always #每次有数据修改发生时都会写入AOF文件。 appendfsync everysec #每秒钟同步一次，该策略为AOF的缺省策略。 appendfsync no #从不同步。高效但是数据不会被持久化。\nRDB和AOF都开只会按照AOF恢复\nRedis与数据库一致性设计模式有四种 Cache aside 【读缓存，写数据库】【读不一致】【应该程序要与缓存和数据库打交道】【无需任何设计】 1（读取）——应用程序从redis取数据,没有得到,则从数据库中取数据,成功后，放到缓存中。【引发穿透、击穿】 2（使用）——应用程序从redis取数据，取到后返回应用 3（更新）——先把数据存到数据库中，成功后，再让缓存失效。\nRead through 【需要维护数据库和redis】【读不一致】【应该程序只需与缓存打交道】【需要设计redis与mysql数据一致性服务程序（读数据服务）】 流程与Cache aside一样，仅仅是读数据需要隔开设置一个redis读数据库数据服务\nWrite through 【读写都是缓存】【数据强一致】【应该程序只需与缓存打交道】【需要设计redis与mysql数据一致性服务程序（实时）】【银行系统】 程序只和缓存交互且只能通过缓存写数据。 每次向缓存中写数据，缓存把数据持久到数据库，且这两个操作在同一个事务。只有两次都写成功了才算成功（为了保证数据一致性）\nWrite behind caching 【读写都是缓存】【数据不一致】【需要设计redis与mysql数据一致性服务程序（非实时）】 Write behind caching的写数据库不是实时的。【缓存写和数据库写是异步的】\nredis使用lua的目的 Lua要么都执行要么都不执行，因此是为了原子性（有点类似事务）\nRedis（分布式技术栈） 主线程(使用Epoll同步io模型 非阻塞)持续监听客户端\nSDS 使用 len 数据长度判断字符串长度\n内存预分配 弹性扩容 free(剩余空间) (len+addlen)*2 超过1024 每次扩容1024\nstring类型最大存储512m string和hash区别，string是一个整体\n启动关闭连接 启动 redis-server【配置文件】 \u0026amp;\n关闭 shutdown\n连接 redis-cli -h ip地址 -p 端口\nredis锁 1 2 3 4 5 6 7 8 9 if (!(redisTemplate.opsForValue().setIfAbsent(\u0026#34;lockKsy\u0026#34;, \u0026#34;\u0026#34;, Duration.ofSeconds(60)))) { while (true) { if (redisTemplate.opsForValue().setIfAbsent(\u0026#34;lockKsy\u0026#34;, \u0026#34;\u0026#34;, Duration.ofSeconds(60))) { break; } } } 业务代码 redisTemplate.delete(\u0026#34;lockKsy\u0026#34;); 查看类型 object encoding key\n测试\nredis-benchmark\n查看详细\ninfo\n查看长度 strlen key\n切换库(select 下标)操作 查看当前数据库实例中所有key的数量：dbsize 查看当前数据库实例中所有的key：keys * 清空数据库实例：flushdb 清空所有的数据库实例：flushall 查看redis中所有的配置信息：config get * 查看redis中的指定的配置信息：config get parameter\nkey操作 匹配 keys * 0~n\nkeys ? 1\nksys [] 里面任意一个\n判断是否存在 exists key\n移动 move key 库（0-15）\n设置生存时间 expire key 时间（秒）\n查看生存时间 ttl key\n查看类型 type key\n重命名 rename key 新名\n删除（返回删除数量） del key\n数据操作 字符串 设置 set 数据 值\n获取 get key\n追加 append 数据 值\n加1运算 incr\n减一运算 decr\n加运算 incrby 数据 加什么\n减运算 decrby 数据 减什么\n闭区间获取字符串 getrange key 开始下标 结束下标\n下标自左至右，从0开始，依次往后，最后一个字符的下标是字符串长多-1； 字符串中每一个下标也可以是负数，负下标表示自右至左，从-1开始，依次往前，最右边一个字符的下标是-1\n用value覆盖从下标为startIndex开始的字符串，能覆盖几个字符就覆盖几个字符：setrange key 开始下标 值\n设置字符串数据的同时，设置它最大生命周期 setex key 时间 值\n当key不存在时设置成功，否则，则放弃设置：setnx key value\n批量设置 mset 键1 值1 键2 值2 \u0026hellip;.\n批量获取 mget 键1 键2 键3\u0026hellip;\n所有key都不存在时设置成功，否则(只要有一个已经存在！！！)，则全部放弃设置 msetnx 键1 值1 键2 值2 \u0026hellip;..\nlist 将一个或者多个值依次插入到列表的表头(左侧)：lpush key value [value value \u0026hellip;..] lpush list01 1 2 3 结果：3 2 1 lpush list01 4 5 结果：5 4 3 2 1\n获取指定列表中指定下标区间的元素：lrange key startIndex endIndex lrange list01 1 3 结果：4 3 2 lrange list01 1 -2 结果: 4 3 2 lrange list01 0 -1 结果：5 4 3 2 1\n将一个或者多个值依次插入到列表的表尾(右侧)：rpush key value [value value \u0026hellip;..] rpush list02 a b c 结果：a b c rpush list02 d e 结果：a b c d e lpush list02 m n 结果: n m a b c d e\n从指定列表中移除并且返回表头元素：lpop key lpop list02\n从指定列表中移除并且返回表尾元素：rpop key rpop list02\n获取指定列表中指定下标的元素：lindex key index lindex list01 2 结果：3\n获取指定列表的长度：llen key llen list01\n根据count值移除指定列表中跟value相等的数据：lrem key count value count\u0026gt;0：从列表的左侧移除count个跟value相等的数据； count\u0026lt;0：从列表的右侧移除count个跟vlaue相等的数据； count=0：从列表中移除所有跟value相等的数据\n截取指定列表中指定下标区间的元素组成新的列表，并且赋值给key：ltrim key startIndex endIndex lpush list04 1 2 3 4 5 结果：5 4 3 2 1 ltrim list04 1 3 lrange list04 0 -1 结果：4 3 2\n将指定列表中指定下标的元素设置为指定值 lset key 下标 新值\n将value插入到指定列表中位于pivot元素之前/之后的位置： linsert key before/after pivot vlaue linsert list04 before 10 50 linsert list04 after 10 60\nset redis中有关set类型数据的操作命令：单key-多无序value 一个key对应多个vlaue； value之间没有顺序，并且不能重复； 通过业务数据直接操作集合。 a)将一个或者多个元素添加到指定的集合中：sadd key value [value value \u0026hellip;.] *如果元素已经存在，则会忽略。 *返回成功加入的元素的个数 sadd set01 a b c a 结果：a b c sadd set01 b d e b)获取指定集合中所有的元素：smembers key smembers set01 c)判断指定元素在指定集合中是否存在:sismember key member *存在，返回1 *不存在，返回0 sismember set01 f sismember set01 a d)获取指定集合的长度：scard key scard set01 e)移除指定集合中一个或者多个元素：srem key member [member \u0026hellip;..] *不存在的元素会被忽略 *返回成功成功移除的个数 srem set01 b d m f)随机获取指定集合中的一个或者多个元素：srandmember key [count] |-\u0026gt;count\u0026gt;0：随机获取的多个元素之间不能重复 |-\u0026gt;count\u0026lt;0: 随机获取的多个元素之间可能重复 sadd set02 1 2 3 4 5 6 7 8 srandmember set02 srandmember set02 3 srandmember set02 -3 g)从指定集合中随机移除一个或者多个元素：spop key [count] spop set02 h)将指定集合中的指定元素移动到另一个元素:smove source dest member smove set01 set02 a i)获取第一个集合中有、但是其它集合中都没有的元素组成的新集合：sdiff key key [key key \u0026hellip;.] sdiff set01 set02 set03 j)获取所有指定集合中都有的元素组成的新集合：sinter key key [key key \u0026hellip;.] sinter set01 set02 set03 k)获取所有指定集合中所有元素组成的大集合：sunion key key [key key \u0026hellip;..] sunion set01 set02 set03\nhash 单key:field-value field-value \u0026hellip;.. studentzs:id-1001 name-zhangsan age-20 a)将一个或者多个field-vlaue对设置到哈希表中：hset key filed1 value1 [field2 value2 \u0026hellip;.] *如果key field已经存在，把value会把以前的值覆盖掉 hset stu1001 id 1001 hset stu1001 name zhangsan age 20 b)获取指定哈希表中指定field的值：hget key field hget stu1001 id hget stu1001 name c)批量将多个field-value对设置到哈希表中： hmset key filed1 value1 [field2 value2 \u0026hellip;.] hmset stu1002 id 1002 name lisi age 20 d)批量获取指定哈希表中的field的值：hmget key field1 [field2 field3 \u0026hellip;.] hmget stu1001 id name age e)获取指定哈希表中所有的field和value：hgetall key hgetall stu1002 f)从指定哈希表中删除一个或者多个field：hdel key field1 [field2 field3 \u0026hellip;.] hdel stu1002 name age g)获取指定哈希表中所有的filed个数：hlen key hlen stu1001 hlen stu1002 h)判断指定哈希表中是否存在某一个field：hexists key field hexists stu1001 name hexists stu1002 name i)获取指定哈希表中所有的field列表：hkeys key hkeys stu1001 hkeys stu1002 j)获取指定哈希表中所有的value列表：hvals key hvals stu1001 hvals stu1002 k)对指定哈希表中指定field值进行整数加法运算：hincrby key field int hincrby stu1001 age 5 l)对指定哈希表中指定field值进行浮点数加法运算：hincrbyfloat key field float hset stu1001 score 80.5 hincrbyfloat stu1001 score 5.5 m)将一个field-vlaue对设置到哈希表中，当key-field已经存在时，则放弃设置；否则，设置file-value：hsetnx key field value hsetnx stu1001 age 30\nzset 有序集合 本质上是集合，所有元素不能重复； 每一个元素都关联一个分数，redis会根据分数对元素进行自动排序； 分数可以重复； 既然有序集合中每一个元素都有顺序，那么也都有下标； 有序集合中元素的排序规则又列表中元素的排序规则不一样。 a)将一个或者多个member及其score值加入有序集合：zadd key score member [score member \u0026hellip;.] *如果元素已经存在，则把分数覆盖 zadd zset01 20 z1 30 z2 50 z3 40 z4 zadd zset01 60 z2 b)获取指定有序集合中指定下标区间的元素：zrange key startIndex endIndex [withscores] zrange zset01 0 -1 zrange zset01 0 -1 withscores c)获取指定有序集合中指定分数区间(闭区间)的元素：zrangebyscore key min max [withscores] zrangebyscore zset01 30 50 withscores d)删除指定有序集合中一个或者多个元素：zrem key member [member\u0026hellip;\u0026hellip;] zrem zset01 z3 z4 e)获取指定有序集合中所有元素的个数：zcard key zcard zset01 f)获取指定有序集合中分数在指定区间内的元素的个数：zcount key min max zcount zset01 20 50 g)获取指定有序集合中指定元素的排名(排名从0开始)： zrank key member zrank zset01 z4 ===\u0026gt;2 h)获取指定有序集合中指定元素的分数：zscore key member zscore zset01 z4 i)获取指定有序集合中指定元素的排名(按照分数从大到小的排名):zrevrank key member zrevrank zset01 z4 ===\u0026gt;1\n事务 watch保证一致性\nwatch 某个key：执行过程中监控某个key的值发生变化，结束放弃执行\nunwatch 放弃监控key\n开启：multi\n执行：exec\n取消：discard\n集群 info Replication\n设从不设主\nslaveof 127.0.0.1 6379\n让从机上位\n断开关系：slaveof no one\n消息订阅（简单了解） subscribe 订阅消息\npublis 发布消息\npsubcribe 支持通配符\n工具类 文章 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 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 package com.wf.ew.core.utils; import org.springframework.data.redis.connection.DataType; import org.springframework.data.redis.core.Cursor; import org.springframework.data.redis.core.ScanOptions; import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.data.redis.core.ZSetOperations.TypedTuple; import java.util.Collection; import java.util.Date; import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.Set; import java.util.concurrent.TimeUnit; /** * Redis工具类 * * @author WangFan * @date 2018-02-24 下午03:09:50 * @version 1.1 (GitHub文档: https://github.com/whvcse/RedisUtil ) */ public class RedisUtil { private StringRedisTemplate redisTemplate; public void setRedisTemplate(StringRedisTemplate redisTemplate) { this.redisTemplate = redisTemplate; } public StringRedisTemplate getRedisTemplate() { return this.redisTemplate; } /** -------------------key相关操作--------------------- */ /** * 删除key * * @param key */ public void delete(String key) { redisTemplate.delete(key); } /** * 批量删除key * * @param keys */ public void delete(Collection\u0026lt;String\u0026gt; keys) { redisTemplate.delete(keys); } /** * 序列化key * * @param key * @return */ public byte[] dump(String key) { return redisTemplate.dump(key); } /** * 是否存在key * * @param key * @return */ public Boolean hasKey(String key) { return redisTemplate.hasKey(key); } /** * 设置过期时间 * * @param key * @param timeout * @param unit * @return */ public Boolean expire(String key, long timeout, TimeUnit unit) { return redisTemplate.expire(key, timeout, unit); } /** * 设置过期时间 * * @param key * @param date * @return */ public Boolean expireAt(String key, Date date) { return redisTemplate.expireAt(key, date); } /** * 查找匹配的key * * @param pattern * @return */ public Set\u0026lt;String\u0026gt; keys(String pattern) { return redisTemplate.keys(pattern); } /** * 将当前数据库的 key 移动到给定的数据库 db 当中 * * @param key * @param dbIndex * @return */ public Boolean move(String key, int dbIndex) { return redisTemplate.move(key, dbIndex); } /** * 移除 key 的过期时间，key 将持久保持 * * @param key * @return */ public Boolean persist(String key) { return redisTemplate.persist(key); } /** * 返回 key 的剩余的过期时间 * * @param key * @param unit * @return */ public Long getExpire(String key, TimeUnit unit) { return redisTemplate.getExpire(key, unit); } /** * 返回 key 的剩余的过期时间 * * @param key * @return */ public Long getExpire(String key) { return redisTemplate.getExpire(key); } /** * 从当前数据库中随机返回一个 key * * @return */ public String randomKey() { return redisTemplate.randomKey(); } /** * 修改 key 的名称 * * @param oldKey * @param newKey */ public void rename(String oldKey, String newKey) { redisTemplate.rename(oldKey, newKey); } /** * 仅当 newkey 不存在时，将 oldKey 改名为 newkey * * @param oldKey * @param newKey * @return */ public Boolean renameIfAbsent(String oldKey, String newKey) { return redisTemplate.renameIfAbsent(oldKey, newKey); } /** * 返回 key 所储存的值的类型 * * @param key * @return */ public DataType type(String key) { return redisTemplate.type(key); } /** -------------------string相关操作--------------------- */ /** * 设置指定 key 的值 * @param key * @param value */ public void set(String key, String value) { redisTemplate.opsForValue().set(key, value); } /** * 获取指定 key 的值 * @param key * @return */ public String get(String key) { return redisTemplate.opsForValue().get(key); } /** * 返回 key 中字符串值的子字符 * @param key * @param start * @param end * @return */ public String getRange(String key, long start, long end) { return redisTemplate.opsForValue().get(key, start, end); } /** * 将给定 key 的值设为 value ，并返回 key 的旧值(old value) * * @param key * @param value * @return */ public String getAndSet(String key, String value) { return redisTemplate.opsForValue().getAndSet(key, value); } /** * 对 key 所储存的字符串值，获取指定偏移量上的位(bit) * * @param key * @param offset * @return */ public Boolean getBit(String key, long offset) { return redisTemplate.opsForValue().getBit(key, offset); } /** * 批量获取 * * @param keys * @return */ public List\u0026lt;String\u0026gt; multiGet(Collection\u0026lt;String\u0026gt; keys) { return redisTemplate.opsForValue().multiGet(keys); } /** * 设置ASCII码, 字符串\u0026#39;a\u0026#39;的ASCII码是97, 转为二进制是\u0026#39;01100001\u0026#39;, 此方法是将二进制第offset位值变为value * * @param key * @param postion * 位置 * @param value * 值,true为1, false为0 * @return */ public boolean setBit(String key, long offset, boolean value) { return redisTemplate.opsForValue().setBit(key, offset, value); } /** * 将值 value 关联到 key ，并将 key 的过期时间设为 timeout * * @param key * @param value * @param timeout * 过期时间 * @param unit * 时间单位, 天:TimeUnit.DAYS 小时:TimeUnit.HOURS 分钟:TimeUnit.MINUTES * 秒:TimeUnit.SECONDS 毫秒:TimeUnit.MILLISECONDS */ public void setEx(String key, String value, long timeout, TimeUnit unit) { redisTemplate.opsForValue().set(key, value, timeout, unit); } /** * 只有在 key 不存在时设置 key 的值 * * @param key * @param value * @return 之前已经存在返回false,不存在返回true */ public boolean setIfAbsent(String key, String value) { return redisTemplate.opsForValue().setIfAbsent(key, value); } /** * 用 value 参数覆写给定 key 所储存的字符串值，从偏移量 offset 开始 * * @param key * @param value * @param offset * 从指定位置开始覆写 */ public void setRange(String key, String value, long offset) { redisTemplate.opsForValue().set(key, value, offset); } /** * 获取字符串的长度 * * @param key * @return */ public Long size(String key) { return redisTemplate.opsForValue().size(key); } /** * 批量添加 * * @param maps */ public void multiSet(Map\u0026lt;String, String\u0026gt; maps) { redisTemplate.opsForValue().multiSet(maps); } /** * 同时设置一个或多个 key-value 对，当且仅当所有给定 key 都不存在 * * @param maps * @return 之前已经存在返回false,不存在返回true */ public boolean multiSetIfAbsent(Map\u0026lt;String, String\u0026gt; maps) { return redisTemplate.opsForValue().multiSetIfAbsent(maps); } /** * 增加(自增长), 负数则为自减 * * @param key * @param value * @return */ public Long incrBy(String key, long increment) { return redisTemplate.opsForValue().increment(key, increment); } /** * * @param key * @param value * @return */ public Double incrByFloat(String key, double increment) { return redisTemplate.opsForValue().increment(key, increment); } /** * 追加到末尾 * * @param key * @param value * @return */ public Integer append(String key, String value) { return redisTemplate.opsForValue().append(key, value); } /** -------------------hash相关操作------------------------- */ /** * 获取存储在哈希表中指定字段的值 * * @param key * @param field * @return */ public Object hGet(String key, String field) { return redisTemplate.opsForHash().get(key, field); } /** * 获取所有给定字段的值 * * @param key * @return */ public Map\u0026lt;Object, Object\u0026gt; hGetAll(String key) { return redisTemplate.opsForHash().entries(key); } /** * 获取所有给定字段的值 * * @param key * @param fields * @return */ public List\u0026lt;Object\u0026gt; hMultiGet(String key, Collection\u0026lt;Object\u0026gt; fields) { return redisTemplate.opsForHash().multiGet(key, fields); } public void hPut(String key, String hashKey, String value) { redisTemplate.opsForHash().put(key, hashKey, value); } public void hPutAll(String key, Map\u0026lt;String, String\u0026gt; maps) { redisTemplate.opsForHash().putAll(key, maps); } /** * 仅当hashKey不存在时才设置 * * @param key * @param hashKey * @param value * @return */ public Boolean hPutIfAbsent(String key, String hashKey, String value) { return redisTemplate.opsForHash().putIfAbsent(key, hashKey, value); } /** * 删除一个或多个哈希表字段 * * @param key * @param fields * @return */ public Long hDelete(String key, Object... fields) { return redisTemplate.opsForHash().delete(key, fields); } /** * 查看哈希表 key 中，指定的字段是否存在 * * @param key * @param field * @return */ public boolean hExists(String key, String field) { return redisTemplate.opsForHash().hasKey(key, field); } /** * 为哈希表 key 中的指定字段的整数值加上增量 increment * * @param key * @param field * @param increment * @return */ public Long hIncrBy(String key, Object field, long increment) { return redisTemplate.opsForHash().increment(key, field, increment); } /** * 为哈希表 key 中的指定字段的整数值加上增量 increment * * @param key * @param field * @param delta * @return */ public Double hIncrByFloat(String key, Object field, double delta) { return redisTemplate.opsForHash().increment(key, field, delta); } /** * 获取所有哈希表中的字段 * * @param key * @return */ public Set\u0026lt;Object\u0026gt; hKeys(String key) { return redisTemplate.opsForHash().keys(key); } /** * 获取哈希表中字段的数量 * * @param key * @return */ public Long hSize(String key) { return redisTemplate.opsForHash().size(key); } /** * 获取哈希表中所有值 * * @param key * @return */ public List\u0026lt;Object\u0026gt; hValues(String key) { return redisTemplate.opsForHash().values(key); } /** * 迭代哈希表中的键值对 * * @param key * @param options * @return */ public Cursor\u0026lt;Entry\u0026lt;Object, Object\u0026gt;\u0026gt; hScan(String key, ScanOptions options) { return redisTemplate.opsForHash().scan(key, options); } /** ------------------------list相关操作---------------------------- */ /** * 通过索引获取列表中的元素 * * @param key * @param index * @return */ public String lIndex(String key, long index) { return redisTemplate.opsForList().index(key, index); } /** * 获取列表指定范围内的元素 * * @param key * @param start * 开始位置, 0是开始位置 * @param end * 结束位置, -1返回所有 * @return */ public List\u0026lt;String\u0026gt; lRange(String key, long start, long end) { return redisTemplate.opsForList().range(key, start, end); } /** * 存储在list头部 * * @param key * @param value * @return */ public Long lLeftPush(String key, String value) { return redisTemplate.opsForList().leftPush(key, value); } /** * * @param key * @param value * @return */ public Long lLeftPushAll(String key, String... value) { return redisTemplate.opsForList().leftPushAll(key, value); } /** * * @param key * @param value * @return */ public Long lLeftPushAll(String key, Collection\u0026lt;String\u0026gt; value) { return redisTemplate.opsForList().leftPushAll(key, value); } /** * 当list存在的时候才加入 * * @param key * @param value * @return */ public Long lLeftPushIfPresent(String key, String value) { return redisTemplate.opsForList().leftPushIfPresent(key, value); } /** * 如果pivot存在,再pivot前面添加 * * @param key * @param pivot * @param value * @return */ public Long lLeftPush(String key, String pivot, String value) { return redisTemplate.opsForList().leftPush(key, pivot, value); } /** * * @param key * @param value * @return */ public Long lRightPush(String key, String value) { return redisTemplate.opsForList().rightPush(key, value); } /** * * @param key * @param value * @return */ public Long lRightPushAll(String key, String... value) { return redisTemplate.opsForList().rightPushAll(key, value); } /** * * @param key * @param value * @return */ public Long lRightPushAll(String key, Collection\u0026lt;String\u0026gt; value) { return redisTemplate.opsForList().rightPushAll(key, value); } /** * 为已存在的列表添加值 * * @param key * @param value * @return */ public Long lRightPushIfPresent(String key, String value) { return redisTemplate.opsForList().rightPushIfPresent(key, value); } /** * 在pivot元素的右边添加值 * * @param key * @param pivot * @param value * @return */ public Long lRightPush(String key, String pivot, String value) { return redisTemplate.opsForList().rightPush(key, pivot, value); } /** * 通过索引设置列表元素的值 * * @param key * @param index * 位置 * @param value */ public void lSet(String key, long index, String value) { redisTemplate.opsForList().set(key, index, value); } /** * 移出并获取列表的第一个元素 * * @param key * @return 删除的元素 */ public String lLeftPop(String key) { return redisTemplate.opsForList().leftPop(key); } /** * 移出并获取列表的第一个元素， 如果列表没有元素会阻塞列表直到等待超时或发现可弹出元素为止 * * @param key * @param timeout * 等待时间 * @param unit * 时间单位 * @return */ public String lBLeftPop(String key, long timeout, TimeUnit unit) { return redisTemplate.opsForList().leftPop(key, timeout, unit); } /** * 移除并获取列表最后一个元素 * * @param key * @return 删除的元素 */ public String lRightPop(String key) { return redisTemplate.opsForList().rightPop(key); } /** * 移出并获取列表的最后一个元素， 如果列表没有元素会阻塞列表直到等待超时或发现可弹出元素为止 * * @param key * @param timeout * 等待时间 * @param unit * 时间单位 * @return */ public String lBRightPop(String key, long timeout, TimeUnit unit) { return redisTemplate.opsForList().rightPop(key, timeout, unit); } /** * 移除列表的最后一个元素，并将该元素添加到另一个列表并返回 * * @param sourceKey * @param destinationKey * @return */ public String lRightPopAndLeftPush(String sourceKey, String destinationKey) { return redisTemplate.opsForList().rightPopAndLeftPush(sourceKey, destinationKey); } /** * 从列表中弹出一个值，将弹出的元素插入到另外一个列表中并返回它； 如果列表没有元素会阻塞列表直到等待超时或发现可弹出元素为止 * * @param sourceKey * @param destinationKey * @param timeout * @param unit * @return */ public String lBRightPopAndLeftPush(String sourceKey, String destinationKey, long timeout, TimeUnit unit) { return redisTemplate.opsForList().rightPopAndLeftPush(sourceKey, destinationKey, timeout, unit); } /** * 删除集合中值等于value得元素 * * @param key * @param index * index=0, 删除所有值等于value的元素; index\u0026gt;0, 从头部开始删除第一个值等于value的元素; * index\u0026lt;0, 从尾部开始删除第一个值等于value的元素; * @param value * @return */ public Long lRemove(String key, long index, String value) { return redisTemplate.opsForList().remove(key, index, value); } /** * 裁剪list * * @param key * @param start * @param end */ public void lTrim(String key, long start, long end) { redisTemplate.opsForList().trim(key, start, end); } /** * 获取列表长度 * * @param key * @return */ public Long lLen(String key) { return redisTemplate.opsForList().size(key); } /** --------------------set相关操作-------------------------- */ /** * set添加元素 * * @param key * @param values * @return */ public Long sAdd(String key, String... values) { return redisTemplate.opsForSet().add(key, values); } /** * set移除元素 * * @param key * @param values * @return */ public Long sRemove(String key, Object... values) { return redisTemplate.opsForSet().remove(key, values); } /** * 移除并返回集合的一个随机元素 * * @param key * @return */ public String sPop(String key) { return redisTemplate.opsForSet().pop(key); } /** * 将元素value从一个集合移到另一个集合 * * @param key * @param value * @param destKey * @return */ public Boolean sMove(String key, String value, String destKey) { return redisTemplate.opsForSet().move(key, value, destKey); } /** * 获取集合的大小 * * @param key * @return */ public Long sSize(String key) { return redisTemplate.opsForSet().size(key); } /** * 判断集合是否包含value * * @param key * @param value * @return */ public Boolean sIsMember(String key, Object value) { return redisTemplate.opsForSet().isMember(key, value); } /** * 获取两个集合的交集 * * @param key * @param otherKey * @return */ public Set\u0026lt;String\u0026gt; sIntersect(String key, String otherKey) { return redisTemplate.opsForSet().intersect(key, otherKey); } /** * 获取key集合与多个集合的交集 * * @param key * @param otherKeys * @return */ public Set\u0026lt;String\u0026gt; sIntersect(String key, Collection\u0026lt;String\u0026gt; otherKeys) { return redisTemplate.opsForSet().intersect(key, otherKeys); } /** * key集合与otherKey集合的交集存储到destKey集合中 * * @param key * @param otherKey * @param destKey * @return */ public Long sIntersectAndStore(String key, String otherKey, String destKey) { return redisTemplate.opsForSet().intersectAndStore(key, otherKey, destKey); } /** * key集合与多个集合的交集存储到destKey集合中 * * @param key * @param otherKeys * @param destKey * @return */ public Long sIntersectAndStore(String key, Collection\u0026lt;String\u0026gt; otherKeys, String destKey) { return redisTemplate.opsForSet().intersectAndStore(key, otherKeys, destKey); } /** * 获取两个集合的并集 * * @param key * @param otherKeys * @return */ public Set\u0026lt;String\u0026gt; sUnion(String key, String otherKeys) { return redisTemplate.opsForSet().union(key, otherKeys); } /** * 获取key集合与多个集合的并集 * * @param key * @param otherKeys * @return */ public Set\u0026lt;String\u0026gt; sUnion(String key, Collection\u0026lt;String\u0026gt; otherKeys) { return redisTemplate.opsForSet().union(key, otherKeys); } /** * key集合与otherKey集合的并集存储到destKey中 * * @param key * @param otherKey * @param destKey * @return */ public Long sUnionAndStore(String key, String otherKey, String destKey) { return redisTemplate.opsForSet().unionAndStore(key, otherKey, destKey); } /** * key集合与多个集合的并集存储到destKey中 * * @param key * @param otherKeys * @param destKey * @return */ public Long sUnionAndStore(String key, Collection\u0026lt;String\u0026gt; otherKeys, String destKey) { return redisTemplate.opsForSet().unionAndStore(key, otherKeys, destKey); } /** * 获取两个集合的差集 * * @param key * @param otherKey * @return */ public Set\u0026lt;String\u0026gt; sDifference(String key, String otherKey) { return redisTemplate.opsForSet().difference(key, otherKey); } /** * 获取key集合与多个集合的差集 * * @param key * @param otherKeys * @return */ public Set\u0026lt;String\u0026gt; sDifference(String key, Collection\u0026lt;String\u0026gt; otherKeys) { return redisTemplate.opsForSet().difference(key, otherKeys); } /** * key集合与otherKey集合的差集存储到destKey中 * * @param key * @param otherKey * @param destKey * @return */ public Long sDifference(String key, String otherKey, String destKey) { return redisTemplate.opsForSet().differenceAndStore(key, otherKey, destKey); } /** * key集合与多个集合的差集存储到destKey中 * * @param key * @param otherKeys * @param destKey * @return */ public Long sDifference(String key, Collection\u0026lt;String\u0026gt; otherKeys, String destKey) { return redisTemplate.opsForSet().differenceAndStore(key, otherKeys, destKey); } /** * 获取集合所有元素 * * @param key * @param otherKeys * @param destKey * @return */ public Set\u0026lt;String\u0026gt; setMembers(String key) { return redisTemplate.opsForSet().members(key); } /** * 随机获取集合中的一个元素 * * @param key * @return */ public String sRandomMember(String key) { return redisTemplate.opsForSet().randomMember(key); } /** * 随机获取集合中count个元素 * * @param key * @param count * @return */ public List\u0026lt;String\u0026gt; sRandomMembers(String key, long count) { return redisTemplate.opsForSet().randomMembers(key, count); } /** * 随机获取集合中count个元素并且去除重复的 * * @param key * @param count * @return */ public Set\u0026lt;String\u0026gt; sDistinctRandomMembers(String key, long count) { return redisTemplate.opsForSet().distinctRandomMembers(key, count); } /** * * @param key * @param options * @return */ public Cursor\u0026lt;String\u0026gt; sScan(String key, ScanOptions options) { return redisTemplate.opsForSet().scan(key, options); } /**------------------zSet相关操作--------------------------------*/ /** * 添加元素,有序集合是按照元素的score值由小到大排列 * * @param key * @param value * @param score * @return */ public Boolean zAdd(String key, String value, double score) { return redisTemplate.opsForZSet().add(key, value, score); } /** * * @param key * @param values * @return */ public Long zAdd(String key, Set\u0026lt;TypedTuple\u0026lt;String\u0026gt;\u0026gt; values) { return redisTemplate.opsForZSet().add(key, values); } /** * * @param key * @param values * @return */ public Long zRemove(String key, Object... values) { return redisTemplate.opsForZSet().remove(key, values); } /** * 增加元素的score值，并返回增加后的值 * * @param key * @param value * @param delta * @return */ public Double zIncrementScore(String key, String value, double delta) { return redisTemplate.opsForZSet().incrementScore(key, value, delta); } /** * 返回元素在集合的排名,有序集合是按照元素的score值由小到大排列 * * @param key * @param value * @return 0表示第一位 */ public Long zRank(String key, Object value) { return redisTemplate.opsForZSet().rank(key, value); } /** * 返回元素在集合的排名,按元素的score值由大到小排列 * * @param key * @param value * @return */ public Long zReverseRank(String key, Object value) { return redisTemplate.opsForZSet().reverseRank(key, value); } /** * 获取集合的元素, 从小到大排序 * * @param key * @param start * 开始位置 * @param end * 结束位置, -1查询所有 * @return */ public Set\u0026lt;String\u0026gt; zRange(String key, long start, long end) { return redisTemplate.opsForZSet().range(key, start, end); } /** * 获取集合元素, 并且把score值也获取 * * @param key * @param start * @param end * @return */ public Set\u0026lt;TypedTuple\u0026lt;String\u0026gt;\u0026gt; zRangeWithScores(String key, long start, long end) { return redisTemplate.opsForZSet().rangeWithScores(key, start, end); } /** * 根据Score值查询集合元素 * * @param key * @param min * 最小值 * @param max * 最大值 * @return */ public Set\u0026lt;String\u0026gt; zRangeByScore(String key, double min, double max) { return redisTemplate.opsForZSet().rangeByScore(key, min, max); } /** * 根据Score值查询集合元素, 从小到大排序 * * @param key * @param min * 最小值 * @param max * 最大值 * @return */ public Set\u0026lt;TypedTuple\u0026lt;String\u0026gt;\u0026gt; zRangeByScoreWithScores(String key, double min, double max) { return redisTemplate.opsForZSet().rangeByScoreWithScores(key, min, max); } /** * * @param key * @param min * @param max * @param start * @param end * @return */ public Set\u0026lt;TypedTuple\u0026lt;String\u0026gt;\u0026gt; zRangeByScoreWithScores(String key, double min, double max, long start, long end) { return redisTemplate.opsForZSet().rangeByScoreWithScores(key, min, max, start, end); } /** * 获取集合的元素, 从大到小排序 * * @param key * @param start * @param end * @return */ public Set\u0026lt;String\u0026gt; zReverseRange(String key, long start, long end) { return redisTemplate.opsForZSet().reverseRange(key, start, end); } /** * 获取集合的元素, 从大到小排序, 并返回score值 * * @param key * @param start * @param end * @return */ public Set\u0026lt;TypedTuple\u0026lt;String\u0026gt;\u0026gt; zReverseRangeWithScores(String key, long start, long end) { return redisTemplate.opsForZSet().reverseRangeWithScores(key, start, end); } /** * 根据Score值查询集合元素, 从大到小排序 * * @param key * @param min * @param max * @return */ public Set\u0026lt;String\u0026gt; zReverseRangeByScore(String key, double min, double max) { return redisTemplate.opsForZSet().reverseRangeByScore(key, min, max); } /** * 根据Score值查询集合元素, 从大到小排序 * * @param key * @param min * @param max * @return */ public Set\u0026lt;TypedTuple\u0026lt;String\u0026gt;\u0026gt; zReverseRangeByScoreWithScores( String key, double min, double max) { return redisTemplate.opsForZSet().reverseRangeByScoreWithScores(key, min, max); } /** * * @param key * @param min * @param max * @param start * @param end * @return */ public Set\u0026lt;String\u0026gt; zReverseRangeByScore(String key, double min, double max, long start, long end) { return redisTemplate.opsForZSet().reverseRangeByScore(key, min, max, start, end); } /** * 根据score值获取集合元素数量 * * @param key * @param min * @param max * @return */ public Long zCount(String key, double min, double max) { return redisTemplate.opsForZSet().count(key, min, max); } /** * 获取集合大小 * * @param key * @return */ public Long zSize(String key) { return redisTemplate.opsForZSet().size(key); } /** * 获取集合大小 * * @param key * @return */ public Long zZCard(String key) { return redisTemplate.opsForZSet().zCard(key); } /** * 获取集合中value元素的score值 * * @param key * @param value * @return */ public Double zScore(String key, Object value) { return redisTemplate.opsForZSet().score(key, value); } /** * 移除指定索引位置的成员 * * @param key * @param start * @param end * @return */ public Long zRemoveRange(String key, long start, long end) { return redisTemplate.opsForZSet().removeRange(key, start, end); } /** * 根据指定的score值的范围来移除成员 * * @param key * @param min * @param max * @return */ public Long zRemoveRangeByScore(String key, double min, double max) { return redisTemplate.opsForZSet().removeRangeByScore(key, min, max); } /** * 获取key和otherKey的并集并存储在destKey中 * * @param key * @param otherKey * @param destKey * @return */ public Long zUnionAndStore(String key, String otherKey, String destKey) { return redisTemplate.opsForZSet().unionAndStore(key, otherKey, destKey); } /** * * @param key * @param otherKeys * @param destKey * @return */ public Long zUnionAndStore(String key, Collection\u0026lt;String\u0026gt; otherKeys, String destKey) { return redisTemplate.opsForZSet() .unionAndStore(key, otherKeys, destKey); } /** * 交集 * * @param key * @param otherKey * @param destKey * @return */ public Long zIntersectAndStore(String key, String otherKey, String destKey) { return redisTemplate.opsForZSet().intersectAndStore(key, otherKey, destKey); } /** * 交集 * * @param key * @param otherKeys * @param destKey * @return */ public Long zIntersectAndStore(String key, Collection\u0026lt;String\u0026gt; otherKeys, String destKey) { return redisTemplate.opsForZSet().intersectAndStore(key, otherKeys, destKey); } /** * * @param key * @param options * @return */ public Cursor\u0026lt;TypedTuple\u0026lt;String\u0026gt;\u0026gt; zScan(String key, ScanOptions options) { return redisTemplate.opsForZSet().scan(key, options); } } ","date":"2026-03-09T00:00:00Z","permalink":"/p/redis/","title":"redis"},{"content":"把接口参数中的空白值替换为null值 参考文档 xxx-job分布式定时器 详情 后台权限设计 参考 水印 springboot Velocity java代码生成 基本用法 使用undertow转发中文字符编码乱码问题 文章 后台接口自动生成 注解侵入性严重 Swagger详情 knife4j详情 比Swagger好\n无注解侵入性严重 smart-doc 项目启动后热更新配置文件 详情 动态增删Controller 参考 高并发 参考1 restTemplate 参考 事件发布以及注册 参考 注意事项： 1、如果2个事件之间是继承关系，会先监听到子类事件，处理完再监听父类。\n2、监听器方法一定要try-catchy异常，否则会造成发布事件（有事务的）的方法进行回滚\n3、可以使用@Order注解控制多个监听器的执行顺序，@Order 传入的值越小，执行顺序越高\n缓存注解@Cacheable、@CacheEvict、@CachePut使用 详情 Api接口版本控制 参考 spring整个Bean初始化中的执行顺序： Constructor(构造方法) -\u0026gt; @Autowired(依赖注入) -\u0026gt; @PostConstruct(注释的方法)\n@PostConstruct 该注解被用来修饰一个void（）方法。被@PostConstruct修饰的方法会在服务器加载Servlet的时候运行，并且只会被服务器执行一次。PostConstruct在构造函数之后执行，init（）方法之前执行\n@Scope（@Scope(\u0026ldquo;prototype\u0026rdquo;)） 单例变原型\nspring bean作用域有以下5个： singleton：单例模式，当spring创建applicationContext容器的时候，spring会欲初始化所有的该作用域实例，加上lazy-init就可以避免预处理；\nprototype：原型模式，每次通过getBean获取该bean就会新产生一个实例，创建后spring将不再对其管理；\n（下面是在web项目下才用到的）\nrequest：搞web的大家都应该明白request的域了吧，就是每次请求都新产生一个实例，和prototype不同就是创建后，接下来的管理，spring依然在监听；\nsession：每次会话，同上；\nglobal session：全局的web域，类似于servlet中的application。\n定时器 @Scheduled(fixedRate = 1000) @Scheduled(cron = \u0026ldquo;30 * * * * ?\u0026rdquo;) @EnableScheduling\njpa 详情 实体类 关于枚举（不推荐，推荐使用数据字典） 如果属性使用枚举类型，可使用javax的转换类 注解：\n1 2 3 @Convert(converter = StatusConverter.class) 关于枚举数据库存值 @Enumerated(EnumType.STRING) // 为枚举值 转换类\n1 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 import javax.persistence.AttributeConverter; import javax.persistence.Converter; /** * 状态枚举转换 */ @Converter public class StatusConverter implements AttributeConverter\u0026lt;StatusEnum, Integer\u0026gt; { /** * 转换为数据库内容时的操作 */ @Override public Integer convertToDatabaseColumn(ClassifyStatusEnum value) { return value.getIndex(); } /** * 转换为实体枚举对象的操作 */ @Override public ClassifyStatusEnum convertToEntityAttribute(Integer dbData) { return ClassifyStatusEnum.toEnum(dbData); } } @Entity 指定该类是一个实体\n@Table(name = \u0026ldquo;Ammeter\u0026rdquo;) 指定注释实体的主表 name为数据库表名 默认为类名(有OneToOne ManyToOne注解时推荐填写)\n@Id 指定实体的主键\n@GeneratedValue 提供主键值的生成策略规范\nGenerationType四中类型 TABLE：使用一个特定的数据库表格来保存主键。 SEQUENCE：根据底层数据库的序列来生成主键，条件是数据库支持序列。 IDENTITY：主键由数据库自动生成（主要是自动增长型） （推荐） AUTO：主键由程序控制。\n@Column 指定持久属性或字段的映射列。 如果未指定Column注释，则应用默认值\nname 数据库字段名 默认为属性名，会自动转驼峰为下划线 （推荐使用默认的） nullable 字段是否可为空，默认true columnDefinition 为列生成 DDL 时使用的 SQL 片段 @JoinColumn 指定用于加入实体关联或元素集合的列\nname 数据库字段名 默认为属性名，会自动转驼峰为下划线 (在这个推荐使用自定义 如 ) nullable 字段是否可为空，默认true columnDefinition 为列生成 DDL 时使用的 SQL 片段 foreignKey 用于在表生成生效时指定或控制外键约束的生成。 如果未指定此元素，则将应用持久性提供程序的默认外键策略 columnDefinition 用法 第一个为数据库类型 UNSIGNED 为无符号 COMMENT 数据库注释 注意 后面的 ‘ ’\nlong @Column(columnDefinition = \u0026quot;BIGINT UNSIGNED COMMENT '主键'\u0026quot;) String @Column(columnDefinition = \u0026quot;VARCHAR(255) COMMENT '描述'\u0026quot;) Boolean @Column( columnDefinition = \u0026quot;TINYINT UNSIGNED COMMENT '状态'\u0026quot;) LocalDateTime @Column( columnDefinition = \u0026quot;DATETIME COMMENT '时间'\u0026quot;) @OneToOne @ManyToOne @OneToMany targetEntity 作为关联目标的实体类 默认为属性类 fetch 加载策略 默认 为及时加载 可修改为 FetchType.LAZY 懒加载 关于 OneToMany 请使用 mappedBy 的内容为 ManyToOne 的属性名 并且增加注解 @JsonProperty(access = JsonProperty.Access.WRITE_ONLY) // 序列化时不进行序列化 @DynamicUpdate @DynamicInsert @JsonIgnoreProperties({\u0026ldquo;hibernateLazyInitializer\u0026rdquo;, \u0026ldquo;handler\u0026rdquo;}) @Embeddable 实体使用后。属性会作为其他实体的属性。并生成表字段\n关于子查询 jpa不支持进行子查询 参考文档 方法的用法 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 public interface DemoJpaRepositories extends JpaRepository\u0026lt;DemoJpa,Integer\u0026gt; { //根据firstName与LastName查找(两者必须在数据库有) DemoJpa findByFirstNameAndLastName(String firstName, String lastName); //根据firstName或LastName查找(两者其一有就行) DemoJpa findByLastNameOrFirstName(String lastName,String firstName); //根据firstName查找它是否存在数据库里\u0026lt;类似与以下关键字\u0026gt; //DemoJpa findByFirstName(String firstName); DemoJpa findByFirstNameIs(String firstName); //在Age数值age到age2之间的数据 List\u0026lt;DemoJpa\u0026gt; findByAgeBetween(Integer age, Integer age2); //小于指定age数值之间的数据 List\u0026lt;DemoJpa\u0026gt; findByAgeLessThan(Integer age); //小于等于指定age数值的数据 List\u0026lt;DemoJpa\u0026gt; findByAgeLessThanEqual(Integer age); //大于指定age数值之间的数据 List\u0026lt;DemoJpa\u0026gt; findByAgeGreaterThan(Integer age); //大于或等于指定age数值之间的数据 List\u0026lt;DemoJpa\u0026gt; findByAgeGreaterThanEqual(Integer age); //在指定age数值之前的数据类似关键字\u0026lt;LessThan\u0026gt; List\u0026lt;DemoJpa\u0026gt; findByAgeAfter(Integer age); //在指定age数值之后的数据类似关键字\u0026lt;GreaterThan\u0026gt; List\u0026lt;DemoJpa\u0026gt; findByAgeBefore(Integer age); //返回age字段为空的数据 List\u0026lt;DemoJpa\u0026gt; findByAgeIsNull(); //返回age字段不为空的数据 List\u0026lt;DemoJpa\u0026gt; findByAgeNotNull(); /** * 该关键字我一度以为是类似数据库的模糊查询, * 但是我去官方文档看到它里面并没有通配符。 * 所以我觉得它类似 * DemoJpa findByFirstName(String firstName); * @see https://docs.spring.io/spring-data/jpa/docs/2.1.5.RELEASE/reference/html/#jpa.repositories */ DemoJpa findByFirstNameLike(String firstName); //同上 List\u0026lt;DemoJpa\u0026gt; findByFirstNameNotLike(String firstName); //查找数据库中指定类似的名字(如：输入一个名字\u0026#34;M\u0026#34; Jpa会返回多个包含M开头的名字的数据源)\u0026lt;类似数据库模糊查询\u0026gt; List\u0026lt;DemoJpa\u0026gt; findByFirstNameStartingWith(String firstName); //查找数据库中指定不类似的名字(同上) List\u0026lt;DemoJpa\u0026gt; findByFirstNameEndingWith(String firstName); //查找包含的指定数据源(这个与以上两个字段不同的地方在与它必须输入完整的数据才可以查询) List\u0026lt;DemoJpa\u0026gt; findByFirstNameContaining(String firstName); //根据age选取所有的数据源并按照LastName进行升序排序 List\u0026lt;DemoJpa\u0026gt; findByAgeOrderByLastName(Integer age); //返回不是指定age的所有数据 List\u0026lt;DemoJpa\u0026gt; findByAgeNot(Integer age); //查找包含多个指定age返回的数据 List\u0026lt;DemoJpa\u0026gt; findByAgeIn(List\u0026lt;Integer\u0026gt; age); } jackson中@JsonInclude注解详解 参考 用处 这个注解就是用来在实体类序列化成json的时候在某些策略下，加了该注解的字段不去序列化该字段\n用法 ALWAYS 这个是默认策略，任何情况下都序列化该字段，和不写这个注解是一样的效果\nNON_NULL 这个最常用，属性为NULL 不序列化\nNON_ABSENT 属性为默认值不序列化\nNON_EMPTY 这个属性 空（\u0026quot;\u0026quot;） 或者为 NULL都不序列化 这个也比较常用\nNON_DEFAULT 这个也好理解，如果字段是默认值的话就不序列化。\nCUSTOM 值，该值指示将使用单独的筛选器对象（由valueFilter为值本身指定，和/或contentFilter为结构化类型的内容指定）来确定包含条件。使用要序列化的值调用Filter对象的equals（）方法；如果返回真值，则排除（即过滤掉）；如果包含假值\nUSE_DEFAULTS 伪值用于指示更高级别的默认值有意义，以避免覆盖包含值。例如，如果为属性返回，则将使用包含属性的类的默认值（如果有定义）；如果没有为此定义，则全局序列化包含详细信息。\n接收前端参数格式化 1 2 3 4 5 6 7 @DateTimeFormat(pattern=\u0026#34;yyyy-MM-dd HH:mm:ss\u0026#34;) yml spring: jackson: # 日期格式化 date-format: yyyy-MM-dd HH:mm:ss 返回给前端时间格式化 单属性配置 1 @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = \u0026#34;yyyy-MM-dd HH:mm:ss\u0026#34;, timezone = \u0026#34;GMT+8\u0026#34;) 全局配置 Data 1 2 3 4 5 spring: jackson: # 日期格式化 date-format: yyyy-MM-dd HH:mm:ss time-zone: GMT+8 LocalDateTime 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 import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer; import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; /** * 本地日期时间格式化类 * * @author zhonglingping */ @Configuration public class LocalDateTimeConfig { @Bean public LocalDateTimeSerializer localDateTimeDeserializer() { return new LocalDateTimeSerializer(DateTimeFormatter.ofPattern(\u0026#34;yyyy-MM-dd HH:mm:ss\u0026#34;)); } @Bean public Jackson2ObjectMapperBuilderCustomizer jackson2ObjectMapperBuilderCustomizer() { return builder -\u0026gt; builder.serializerByType(LocalDateTime.class, localDateTimeDeserializer()); } } 配置类 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 @Slf4j @Configuration public class JacksonConfig { @Primary @Bean public ObjectMapper getObjectMapper(Jackson2ObjectMapperBuilder builder, JacksonProperties jacksonProperties) { ObjectMapper objectMapper = builder.createXmlMapper(false).build(); // 全局配置序列化返回 JSON 处理 SimpleModule simpleModule = new SimpleModule(); // long类型 simpleModule.addSerializer(Long.class, BigNumberSerializer.INSTANCE); simpleModule.addSerializer(Long.TYPE, BigNumberSerializer.INSTANCE); // 大整数 simpleModule.addSerializer(BigInteger.class, BigNumberSerializer.INSTANCE); simpleModule.addSerializer(BigDecimal.class, ToStringSerializer.instance); // LocalDateTime DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern(jacksonProperties.getDateFormat()); simpleModule.addSerializer(LocalDateTime.class, new LocalDateTimeSerializer(dateTimeFormatter)); simpleModule.addDeserializer(LocalDateTime.class, new LocalDateTimeDeserializer(dateTimeFormatter)); // LocalDate DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern(DatePattern.NORM_DATE_PATTERN); simpleModule.addSerializer(LocalDate.class, new LocalDateSerializer(dateFormatter)); simpleModule.addDeserializer(LocalDate.class, new LocalDateDeserializer(dateFormatter)); // LocalTime DateTimeFormatter timeFormatter = DateTimeFormatter.ofPattern(DatePattern.NORM_TIME_PATTERN); simpleModule.addSerializer(LocalTime.class, new LocalTimeSerializer(timeFormatter)); simpleModule.addDeserializer(LocalTime.class, new LocalTimeDeserializer(timeFormatter)); objectMapper.registerModule(simpleModule); objectMapper.setTimeZone(TimeZone.getDefault()); log.info(\u0026#34;初始化 jackson 配置完毕\u0026#34;); return objectMapper; } } 快速失败 1 2 3 4 5 6 7 8 9 @Bean public Validator validator() { ValidatorFactory validatorFactory = Validation.byProvider(HibernateValidator.class) .configure() // 快速失败模式 .failFast(true) .buildValidatorFactory(); return validatorFactory.getValidator(); } Spring 设置对象为多例模式\n1 2 @Scope(\u0026#34;prototype\u0026#34;) @Scope(BeanDefinition.SCOPE_PROTOTYPE) 主配置文件名称：applicationContext.xml\n类注解 (为类创建对象)\n@Component：只能创建对象\n​ 默认的id名称，类首字母小写\n@Repository：数据库相关操作\n@Service：逻辑相关操作\n@Controller：接受请求，进行响应，控制层\n自动注入 八种基本数据类型和string\n@Value() 注入属性内容\n引用数据类型\n@Autowired 默认根据ByType(对象)，当一个类有两个对象的时候，会报错。\n@Qualifier 默认是ByName(名字)，可以精准的找到的配置项\n@Resource 默认是按照byName(名字)自动注入，有两个重要的属性，name和type\n如果byName找不到自动转换为byType\n不属于spring的属于java\n其他注解 1 2 //在类上加载配置文件 @PropertySource(value = \u0026#34;classpath:jdbc.properties\u0026#34;) 1 2 把xml配置文件转换为注解形式 @Configuration 1 2 指定需要扫描的包 @ComponentScan(basePackages = \u0026#34;\u0026#34;) 获取原生获取spring配置文件方法 xml配置文件方式 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 \u0026lt;bean id=\u0026#34;residence\u0026#34; class=\u0026#34;com.jiandanjiuer.Residence\u0026#34;\u0026gt; \u0026lt;property name=\u0026#34;address\u0026#34; value=\u0026#34;北京\u0026#34;/\u0026gt; \u0026lt;property name=\u0026#34;code\u0026#34; value=\u0026#34;001\u0026#34;/\u0026gt; \u0026lt;/bean\u0026gt; //使用set方式赋值 \u0026lt;bean id=\u0026#34;user\u0026#34; class=\u0026#34;com.jiandanjiuer.User\u0026#34;\u0026gt; \u0026lt;property name=\u0026#34;name\u0026#34; value=\u0026#34;小明\u0026#34;/\u0026gt; \u0026lt;property name=\u0026#34;age\u0026#34; value=\u0026#34;20\u0026#34;/\u0026gt; \u0026lt;property name=\u0026#34;residence\u0026#34; ref=\u0026#34;residence\u0026#34;/\u0026gt; \u0026lt;/bean\u0026gt; \u0026lt;!-- 使用构造器赋值--\u0026gt; //允许去掉name，但是要按照顺序赋值 //可以通过index进行排序 \u0026lt;bean id=\u0026#34;user\u0026#34; class=\u0026#34;com.jiandanjiuer.Day01.User\u0026#34;\u0026gt; \u0026lt;constructor-arg name=\u0026#34;age\u0026#34; value=\u0026#34;34\u0026#34;/\u0026gt; \u0026lt;constructor-arg name=\u0026#34;name\u0026#34; value=\u0026#34;小明\u0026#34;/\u0026gt; \u0026lt;constructor-arg name=\u0026#34;residence\u0026#34; ref=\u0026#34;residence\u0026#34;/\u0026gt; \u0026lt;/bean\u0026gt; 1 2 3 4 5 6 ClassPathXmlApplicationContext classPathXmlApplicationContext = new ClassPathXmlApplicationContext(\u0026#34;beans.xml\u0026#34;); //需要强制转换 User user = (User) classPathXmlApplicationContext.getBean(\u0026#34;user\u0026#34;); //不需要强制转换 User user1 = classPathXmlApplicationContext.getBean(\u0026#34;user\u0026#34;,User.class); System.out.println(user); 1 2 3 4 //每次获取的对象都不一样 \u0026lt;bean scope=\u0026#34;prototype\u0026#34;/\u0026gt; //默认是单例模式，每次获取的对象都是同一个 \u0026lt;bean scope=\u0026#34;singleton\u0026#34;/\u0026gt; spring配置文件获取properties文件信息 \u0026lt;context:property-placeholder location=\u0026ldquo;classpath:day02/jdbc.properties\u0026rdquo;/\u0026gt;\n代理模式 静态代理 缺点：代理类过多，每一个类都需要代理对象\n优点：针对性，一对一\n动态代理 优点：一个代理类可以代理所有对象\n1 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 public class DmyProxy implements InvocationHandler { //被代理类对象 private Object proxy; public DmyProxy() { } public DmyProxy(Object proxy) { this.proxy = proxy; } Logger logger = Logger.getLogger(UserDaoImpl.class.getName()); /** * @param proxy 目标对象(被代理类) * @param method 目标方法(被代理类中要功能增强的方法) * @param args 目标方法的参数列表(被代理类要进行功能增强的参数列表) * @return 返回是代理类的对象 * @throws Throwable 在该方法中为目标方法进行增强 */ @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { proxy = this.proxy; logger.log(Level.INFO, \u0026#34;方法开始运行。。。。。\u0026#34;); //利用发射技术完成目标方法的调用 Object invoke = method.invoke(proxy, args); logger.log(Level.INFO, \u0026#34;方法运行结束。。。。。\u0026#34;); return invoke; } } 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 //代理类对象 DmyProxy dmyProxy = new DmyProxy(new UserDaoImpl()); //被代理对象 UserDaoImpl userDao1 = new UserDaoImpl(); //该使用方式是将动态代理类和被代理类建立联系 UserDao userDao = (UserDao) Proxy.newProxyInstance( userDao1.getClass().getClassLoader(), userDao1.getClass().getInterfaces(), dmyProxy); String s = userDao.saveUser(new User()); System.out.println(s); JDK代理 实现一个固定接口：implements InvocationHandler\nAOP 切面（Aspect）：就是要增强的功能是哪些功能（日志，事务\u0026hellip;..）\n连接点（JoinPint）：要增强功能的目标方法（一个方法）\n切入点（Pointcut）：要增强功能的目标方法（多个方法）也就是多个连接点放一起\n目标对象（Target）：被代理对象\n通知（ADvice）：\n前置通知\n后置通知\n异常通知\n最终通知\n环绕通知\nAspectj的切入点表达式 execution(访问权限 方法返回值 方法声明(参数) 异常类型)\n*：0~n\n..：方法参数中，多个参数\n包后，当前包以及子包\n+：类后：当前类已经子类\n接口后，当前接口以及实现类\n所有service 1 execution(* *..service..*.*(..)) 需要依赖 1 2 3 4 5 6 7 8 9 10 11 \u0026lt;dependency\u0026gt; \u0026lt;groupId\u0026gt;org.springframework\u0026lt;/groupId\u0026gt; \u0026lt;artifactId\u0026gt;spring-aop\u0026lt;/artifactId\u0026gt; \u0026lt;version\u0026gt;5.2.8.RELEASE\u0026lt;/version\u0026gt; \u0026lt;/dependency\u0026gt; \u0026lt;dependency\u0026gt; \u0026lt;groupId\u0026gt;org.springframework\u0026lt;/groupId\u0026gt; \u0026lt;artifactId\u0026gt;spring-aspects\u0026lt;/artifactId\u0026gt; \u0026lt;version\u0026gt;5.2.8.RELEASE\u0026lt;/version\u0026gt; \u0026lt;/dependency\u0026gt; 扫描\n1 \u0026lt;aop:aspectj-autoproxy/\u0026gt; 类上使用注解\n类需要创建\n1 @Aspect 如果方法有参数必须是：JoinPoint\n前置通知：@Before 后置通知：@AfterReturning 异常通知：@AfterThrowing 最终通知：@Afterx 1 2 3 提取相同的切入点表达式代码 @After(value = \u0026#34;myPointcut()\u0026#34;) @AfterThrowing(value = \u0026#34;myPointcut()\u0026#34;) 1 2 3 @Pointcut(\u0026#34;execution(* *..impl.*.save*(..))\u0026#34;) public void myPointcut() { } 环绕通知：@Around\n有返回值\n参数 ProceedingJoinPoint\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 /** * 环绕通知 */ @Around(\u0026#34;execution(* *..impl.*.save*(..))\u0026#34;) public Object myAround(ProceedingJoinPoint proceedingJoinPoint) { System.out.println(\u0026#34;前置通知\u0026#34;); Object proceed = null; try { //目标方法的返回值 proceed = proceedingJoinPoint.proceed(); System.out.println(proceed); System.out.println(\u0026#34;后置通知\u0026#34;); } catch (Throwable throwable) { throwable.printStackTrace(); System.out.println(\u0026#34;异常通知\u0026#34;); } finally { System.out.println(\u0026#34;最终通知\u0026#34;); } return proceed; } 关于springAOP组件 不推荐使用springAOP组件，功能不完善，执行效率低。代码会复杂\n推荐使用Aspectj框架完成AOP代码，不属于spring\n数据库连接 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 \u0026lt;!-- 连接数据库--\u0026gt; \u0026lt;bean id=\u0026#34;druidDataSource\u0026#34; class=\u0026#34;com.alibaba.druid.pool.DruidDataSource\u0026#34;\u0026gt; \u0026lt;property name=\u0026#34;driverClassName\u0026#34; value=\u0026#34;${jdbc.driverClass}\u0026#34;/\u0026gt; \u0026lt;property name=\u0026#34;url\u0026#34; value=\u0026#34;${jdbc.connectionURL}\u0026#34;/\u0026gt; \u0026lt;property name=\u0026#34;username\u0026#34; value=\u0026#34;${jdbc.username}\u0026#34;/\u0026gt; \u0026lt;property name=\u0026#34;password\u0026#34; value=\u0026#34;${jdbc.password}\u0026#34;/\u0026gt; \u0026lt;/bean\u0026gt; \u0026lt;!-- 将数据源交给spring下jdbc模块中的核心处理类--\u0026gt; \u0026lt;bean id=\u0026#34;jdbcTemplate\u0026#34; class=\u0026#34;org.springframework.jdbc.core.JdbcTemplate\u0026#34;\u0026gt; \u0026lt;property name=\u0026#34;dataSource\u0026#34; ref=\u0026#34;druidDataSource\u0026#34;/\u0026gt; \u0026lt;/bean\u0026gt; \u0026lt;!-- 将数据源交给MyBatis模块中的核心处理类--\u0026gt; \u0026lt;bean id=\u0026#34;sqlSessionFactory\u0026#34; class=\u0026#34;org.mybatis.spring.SqlSessionFactoryBean\u0026#34;\u0026gt; \u0026lt;property name=\u0026#34;dataSource\u0026#34; ref=\u0026#34;dataSource\u0026#34;/\u0026gt; \u0026lt;property name=\u0026#34;configLocation\u0026#34; value=\u0026#34;classpath:conf/mybatis.xml\u0026#34;/\u0026gt; \u0026lt;/bean\u0026gt; \u0026lt;!-- 声明mybatis的扫描器，创建dao对象--\u0026gt; \u0026lt;bean class=\u0026#34;org.mybatis.spring.mapper.MapperScannerConfigurer\u0026#34;\u0026gt; \u0026lt;property name=\u0026#34;sqlSessionFactoryBeanName\u0026#34; value=\u0026#34;sqlSessionFactory\u0026#34;/\u0026gt; \u0026lt;property name=\u0026#34;basePackage\u0026#34; value=\u0026#34;com.jiandanjiuer.dao\u0026#34;/\u0026gt; \u0026lt;/bean\u0026gt; JDBC 然后获取对象就能直接用了\n1 2 3 4 5 6 \u0026lt;!-- 配置事务--\u0026gt; \u0026lt;bean id=\u0026#34;dataSourceTransactionManager\u0026#34; class=\u0026#34;org.springframework.jdbc.datasource.DataSourceTransactionManager\u0026#34;\u0026gt; \u0026lt;property name=\u0026#34;dataSource\u0026#34; ref=\u0026#34;druidDataSource\u0026#34;/\u0026gt; \u0026lt;/bean\u0026gt; \u0026lt;!-- 添加注解配置扫描--\u0026gt; \u0026lt;tx:annotation-driven transaction-manager=\u0026#34;dataSourceTransactionManager\u0026#34;/\u0026gt; 1 类上使用：@Transactional 1 2 3 4 5 6 7 8 传播行为：propagation REQUIRED(0),不开启事务 SUPPORTS(1), MANDATORY(2), REQUIRES_NEW(3),开启一个新事务 NOT_SUPPORTED(4), NEVER(5), NESTED(6); 1 2 3 4 5 6 隔离级别：isolation DEFAULT(-1),原来是什么就是什么 READ_UNCOMMITTED(1), READ_COMMITTED(2), REPEATABLE_READ(4), SERIALIZABLE(8); 过滤器执行顺序 xml 按照xml配置文件从上到下顺序\n注解 按照文件名顺序\n混合 先xml后注解\n监听器(@WebListener) request：\nservletRequestListener：监听创建销毁\nServletRequestAttributeListener：监听作用域增加.删除.修改\nsession：\nservletSessionListener：监听创建销毁\nServletSessionAttributeListener：监听作用域增加.删除.修改\nservletContex：\nservletContextListener：监听创建销毁\nServletContextAttributeListener：监听作用域增加.删除.修改\nweb.xml注册监听器\n1 2 3 \u0026lt;listener\u0026gt; \u0026lt;listener-class\u0026gt;类路径\u0026lt;/listener-class\u0026gt; \u0026lt;/listener\u0026gt; 数据库连接方式 1 2 driver-class-name: oracle.jdbc.driver.OracleDriver url: jdbc:oracle:thin:@ip:端口/数据库名 sql server TLS13, TLS12 参考 logback 、log4j 和 log4j2 介绍1 log4j2配置 idea 控制台没有颜色 log4j2 漏洞 影响版本Apache Log4j 2.x \u0026lt;= 2.14.1\n性能调优 参考 接口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 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer; import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer; import com.fasterxml.jackson.datatype.jsr310.deser.LocalTimeDeserializer; import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer; import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer; import com.fasterxml.jackson.datatype.jsr310.ser.LocalTimeSerializer; import lombok.extern.slf4j.Slf4j; import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import java.math.BigDecimal; import java.math.BigInteger; import java.time.LocalDate; import java.time.LocalDateTime; import java.time.LocalTime; import java.time.format.DateTimeFormatter; import java.util.TimeZone; /** * jackson 配置 */ @Slf4j @Configuration public class JacksonConfig { /** * Date格式化字符串 */ private static final String DATE_FORMAT = \u0026#34;yyyy-MM-dd\u0026#34;; /** * DateTime格式化字符串 */ private static final String DATETIME_FORMAT = \u0026#34;yyyy-MM-dd HH:mm:ss\u0026#34;; /** * Time格式化字符串 */ private static final String TIME_FORMAT = \u0026#34;HH:mm:ss\u0026#34;; @Bean public Jackson2ObjectMapperBuilderCustomizer customizer() { return builder -\u0026gt; { // 全局配置序列化返回 JSON 处理 JavaTimeModule javaTimeModule = new JavaTimeModule(); javaTimeModule.addSerializer(Long.class, BigNumberSerializer.INSTANCE); javaTimeModule.addSerializer(Long.TYPE, BigNumberSerializer.INSTANCE); javaTimeModule.addSerializer(BigInteger.class, BigNumberSerializer.INSTANCE); javaTimeModule.addSerializer(BigDecimal.class, ToStringSerializer.instance); DateTimeFormatter formatter = DateTimeFormatter.ofPattern(DATETIME_FORMAT); javaTimeModule.addSerializer(LocalDateTime.class, new LocalDateTimeSerializer(formatter)); javaTimeModule.addDeserializer(LocalDateTime.class, new LocalDateTimeDeserializer(formatter)); builder.modules(javaTimeModule); builder.timeZone(TimeZone.getDefault()); builder.serializerByType(LocalDateTime.class, new LocalDateTimeSerializer(DateTimeFormatter.ofPattern(DATETIME_FORMAT))) .serializerByType(LocalDate.class, new LocalDateSerializer(DateTimeFormatter.ofPattern(DATE_FORMAT))) .serializerByType(LocalTime.class, new LocalTimeSerializer(DateTimeFormatter.ofPattern(TIME_FORMAT))) .deserializerByType(LocalDateTime.class, new LocalDateTimeDeserializer(DateTimeFormatter.ofPattern(DATETIME_FORMAT))) .deserializerByType(LocalDate.class, new LocalDateDeserializer(DateTimeFormatter.ofPattern(DATE_FORMAT))) .deserializerByType(LocalTime.class, new LocalTimeDeserializer(DateTimeFormatter.ofPattern(TIME_FORMAT))); log.info(\u0026#34;初始化 jackson 配置\u0026#34;); }; } } https://blog.csdn.net/qq_37274323/article/details/125926364 spring boot如何在服务强制关闭之前执行一段程序？ SpringBoot一款快速运行部署spring工程框架 @EnableScheduling\n@Scheduled\nApplication注解 1 @SpringBootApplication///spring启动注解 1 2 //mapper批量扫描，将该包下的接口，批量创建代理对象，交给Spring容器管理 @MapperScan(basePackages = {\u0026#34;com.bjpowernode.springboot.dao\u0026#34;}) 1 2 3 4 #配置项目名 server: servlet: context-path: /jiandanjiuer 自定义配置 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 @Configuration public class MyMvcConfig implements WebMvcConfigurer { /** * 注册环境解析器(语言) * * @return */ @Bean public LocaleResolver localeResolver() { return new MyLocaleResolver(); } /** * 视图控制器 * * @param registry */ @Override public void addViewControllers(ViewControllerRegistry registry) { registry.addViewController(\u0026#34;/\u0026#34;).setViewName(\u0026#34;index\u0026#34;); registry.addViewController(\u0026#34;/index.html\u0026#34;).setViewName(\u0026#34;index\u0026#34;); registry.addViewController(\u0026#34;/main.html\u0026#34;).setViewName(\u0026#34;dashboard\u0026#34;); registry.addViewController(\u0026#34;/404.html\u0026#34;).setViewName(\u0026#34;404\u0026#34;); } /** * 拦截器 * * @param registry */ @Override public void addInterceptors(InterceptorRegistry registry) { registry.addInterceptor(new LoginHandlerInterceptor()) //需要拦截的连接 .addPathPatterns(\u0026#34;/**\u0026#34;) //不需要拦截的连接 .excludePathPatterns(\u0026#34;/index.html\u0026#34;, \u0026#34;/\u0026#34;, \u0026#34;/user/login\u0026#34;, \u0026#34;/css/**\u0026#34;, \u0026#34;/js/**\u0026#34;, \u0026#34;/img/**\u0026#34;); } } 配置文件加载顺序 yml-\u0026gt;yaml-\u0026gt;properties 后加载的会进行覆盖\n获取配置文件内容\n类上注解\n1 @ConfigurationProperties(prefix = \u0026#34;custom-config\u0026#34;) 属性上注解 @Value(\u0026quot;${aList}\u0026quot;)\n多环境配置 spring.profiles.active=***\n1 2 3 # 环境切换，指定application-${key}.properties/yml/yaml spring.profiles.active=dev # 定义test，就会加载application-test.properties配置文件 国际化 1 2 3 4 spring: #国际化 messages: basename: i18n.login resources目录下创建\nlogin.properties login_en_US.properties login_zh_CN.properties\n类 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 public class MyLocaleResolver implements LocaleResolver { /** * 解析请求 * * @param httpServletRequest * @return */ @Override public Locale resolveLocale(HttpServletRequest httpServletRequest) { String myLocale = httpServletRequest.getParameter(\u0026#34;locale\u0026#34;); Locale locale = Locale.getDefault(); if (!(StringUtils.isEmpty(myLocale))) { httpServletRequest.setAttribute(\u0026#34;Locale\u0026#34;, myLocale); String[] s = myLocale.split(\u0026#34;_\u0026#34;); locale = new Locale(s[0], s[1]); } return locale; } @Override public void setLocale(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Locale locale) { } } 配置启动图标 文件名：banner.txt\n配置窗口图标\n端口配置 1 2 server: port: 80 自动装配原理 主程序 1 2 3 4 5 6 7 8 9 @SpringBootConfiguration :springboot的配置 @Configuration :spring配置类 @Component ：声明这是一个spring组件 @EnableAutoConfiguration ：自动配置 @AutoConfigurationPackage ：自动配置包 @Import({Registrar.class}) ：自动配置包注册 @Import({AutoConfigurationImportSelector.class}) ：自动配置导入选择 多环境配置 1 2 3 spring: profiles: active: test application-test.yaml 利用 \u0026mdash; 可以分文件\n1 2 3 给---文件起别名 spring: profiles: test 关于springboot低层注解 mybaits 1 2 3 #mybatis mybatis: mapper-locations: classpath*:com/simple/mapper/*/*.xml 1 @MapperScan(basePackages = {\u0026#34;com.simple.dao.user\u0026#34;, \u0026#34;com.simple.dao.loan\u0026#34;}) 事务 1 2 3 //自动配置默认开启 //如果没有开启事务，事务失效，手动开启。 //在引导类上添加注解，@EnableTransactionManagement 1 //@Transactional可以修饰到类上也可以修饰到方法上 枚举转换问题 参考 参考 分词器 参考1 参考2 参考3 参考4 参考5 Canal 数据库 数据 订阅 docker 安装参考 Elasticsearch es ik_max_word和 ik_smart的区别 analyzer 和 search_analyzer 的区别 参考1 analyzer 和 search_analyzer 的区别 参考2 pinyin搜索，对应中文没有高亮显示 商品 搜索 数据 同步 参考 canal参考 gitee 流水线 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 version: \u0026#39;1.0\u0026#39; name: pipeline-20250402 displayName: simple triggers: trigger: auto push: branches: prefix: - \u0026#39;\u0026#39; stages: - name: stage-67d1036f displayName: 构建 strategy: naturally trigger: auto executor: [] steps: - step: build@nodejs name: build_nodejs displayName: Nodejs 构建 nodeVersion: 21.5.0 commands: - \u0026#39;# 设置NPM源，提升安装速度\u0026#39; - npm config set registry https://registry.npmmirror.com - \u0026#39;\u0026#39; - npm -v - \u0026#39;\u0026#39; - pnpm -v - \u0026#39;\u0026#39; - echo \u0026#39;-------------------------------------------\u0026#39; - \u0026#39;\u0026#39; - \u0026#39;# 安装 pnpm\u0026#39; - npm install -g pnpm - \u0026#39;\u0026#39; - pnpm install - \u0026#39;\u0026#39; - pnpm store path - \u0026#39;\u0026#39; - pnpm root - \u0026#39;\u0026#39; - pnpm run build:antd - \u0026#39;\u0026#39; artifacts: - name: dist_zip path: - ./apps/web-antd/dist.zip caches: - ~/.npm - ~/.yarn - ~/.pnpm - /root/workspace/.pnpm-store notify: [] strategy: retry: \u0026#39;0\u0026#39; - name: stage-1c6c1187 displayName: 发布 strategy: naturally trigger: auto executor: [] steps: - step: deploy@agent name: deploy_agent displayName: 主机部署 hostGroupID: ID: test hostID: - 9ddc654c-2206-4824-9e3b-9fa2229b358c deployArtifact: - source: build name: output target: /www/wwwroot/simple dependArtifact: dist_zip script: - cd /www/wwwroot/simple - \u0026#39;\u0026#39; - pwd - \u0026#39;\u0026#39; - shopt -s extglob - rm -rf !(404.html|.htaccess|.user.ini|output.tar.gz) - \u0026#39;\u0026#39; - tar zxvf ./output.tar.gz - \u0026#39;\u0026#39; - rm -rf ./output.tar.gz - \u0026#39;\u0026#39; - unzip dist.zip - \u0026#39;\u0026#39; notify: [] strategy: retry: \u0026#39;0\u0026#39; strategy: blocking: true cloneDepth: 1 数据压缩比json好 protobuf 项目监控 Sentry k8s 参考 ","date":"2026-03-09T00:00:00Z","permalink":"/p/springboot/","title":"springboot"},{"content":"安装 详情 表单验证 async-validator vuecli 中 chainWebpack 的常用操作 详情 cacheGroups 分包优化 详情 ssr prerender-spa-plugin预渲染 详情 样式穿透 参考 quasar 官网 quasar create 出现错误 由于 github.com 访问太慢，导致卡死。 下载到本地，避免从 github.com 上拉取 连接 开始创建项目 项目名称 可以不用 项目产品名称（如果构建移动应用程序，必须以字母开头）（Quasar应用程序）\n项目名、作者名之类 选择 css 预处理器 是否使用 eslint：eslint 为 JS 语法校验， 会帮你检查 js 语法错误和形成团队的代码规范。 是否支持 ie11 是否自动安装依赖包，以及哪种形式安装（yarn 或 npm)： 没装 yarn 的话还是选否吧，npm 安装包真的很慢\u0026hellip; 其它\u0026hellip;\nvite 按需引入 参考1 参考2 全局登陆弹窗 参考 VUE2 弹窗组件实现动态挂载 需要在某些页面中动态加载一个弹窗，比如未登录的时候，在点击某些地方，需要弹出登录框要求登录。\n如果在每个页面都import进去未免太过繁琐，在根页面引入后监听也不咋好的感觉。\n因此，可以使用VUE.extend动态挂在组件。以登录框组件为例：\n首先，自然是要一个登录组件页面，login.vue，这个按照自己的需求写就行了。\n然后，新建login.js，代码如下：\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 import Vue from \u0026#34;vue\u0026#34;; import login from \u0026#34;./login.vue\u0026#34;; import store from \u0026#34;../../store\u0026#34;; const PopupBox = Vue.extend(login); let instance; login.install = function(data) { instance = new PopupBox({ data }).$mount(); instance.$store = store; document.body.appendChild(instance.$el); Vue.nextTick(() =\u0026gt; { instance.showLogin(); }); }; login.unInstall = function() { if (instance) { document.body.removeChild(instance.$el); instance.$destroy(); instance = null; } }; export default login; 之后，在main.js里加入：\n1 2 import login from \u0026#34;./components/Login/login\u0026#34;; Vue.prototype.$login = login; 这个时候，就可以在有需要的地方，使用install()来挂在弹框：\n1 this.$login.install(); 在需要关闭弹框的地方，就用：\n1 this.$login.unInstall(); 还可以往组件传参，比如要传一个id：\n1 2 3 4 5 instance = new PopupBox({ propsData:{ id:id } }).$mount(); 这样在登录组件里，id就是props的存在啦~或者之间用data覆盖。\n纯js调用公共组件弹框弹窗 setup 和 tsx 参考 ","date":"2026-03-09T00:00:00Z","permalink":"/p/vue/","title":"vue"},{"content":"autojs autojs pro easyclick 脚本库 游戏开发引擎 ","date":"2026-03-09T00:00:00Z","permalink":"/p/%E8%84%9A%E6%9C%AC/","title":"脚本"},{"content":"在线API javashool html5plus w3school nhooo 蛙课网 美图技术团队 阮一峰 ","date":"2026-03-09T00:00:00Z","permalink":"/p/xx/","title":"学习"},{"content":"GitHub Copilot 汉化 图片高清化 面部修复 一键抠图 参考 Tesseract训练识别数字 详情 nacos教程 官网 参考 安装 添加数据库表 sql在conf文件夹中的nacos-mysql.sql 在数据库添加sql nacos需要依赖数据库\n修改配置 在conf文件夹中application.properties\n1 2 3 4 5 spring.datasource.platform=mysql db.num=1 db.url.0=jdbc:mysql://127.0.0.1:3306/数据库名称?characterEncoding=utf8\u0026amp;connectTimeout=1000\u0026amp;socketTimeout=3000\u0026amp;autoReconnect=true\u0026amp;useUnicode=true\u0026amp;useSSL=false\u0026amp;serverTimezone=UTC db.user.0=root db.password.0=123456 win自动启动 nacos.bat\n1 2 3 @echo off D:\\Software\\nacos\\bin\\startup.cmd -m standalone # pause 访问地址 其他 换脸 爬取网站 AI绘画模型平台 音视频翻译和配音工具 网站ai翻译 仓库 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 \u0026lt;script\u0026gt; var head= document.getElementsByTagName(\u0026#39;head\u0026#39;)[0]; var script= document.createElement(\u0026#39;script\u0026#39;); script.type= \u0026#39;text/javascript\u0026#39;; script.src= \u0026#39;https://res.zvo.cn/translate/translate.js\u0026#39;; script.onload = script.onreadystatechange = function() { translate.selectLanguageTag.show = false; translate.setUseVersion2(); //translate.ignore.tag.push(\u0026#39;small\u0026#39;); translate.ignore.class.push(\u0026#39;ant-card-head\u0026#39;); translate.ignore.class.push(\u0026#39;inline-block-tight\u0026#39;); translate.ignore.class.push(\u0026#39;last-keywords\u0026#39;); translate.ignore.class.push(\u0026#39;ant-table-tbody\u0026#39;); translate.ignore.class.push(\u0026#39;ant-select-dropdown-menu-item-group-list\u0026#39;); translate.ignore.class.push(\u0026#39;ant-select-dropdown-menu-vertical\u0026#39;); translate.ignore.class.push(\u0026#39;ant-select-selection-selected-value\u0026#39;); translate.changeLanguage(\u0026#39;chinese_simplified\u0026#39;); window.onload = function() { translate.listener.start(); translate.execute(); }; } head.appendChild(script); \u0026lt;/script\u0026gt; ","date":"2026-03-07T00:00:00Z","permalink":"/p/ai/","title":"ai"},{"content":"esphome 蓝牙代理 esp01s rst cause:2, boot mode:(*,*) 错误意思 小智 MCP clion platformio platformio 安装python\n1 2 3 4 5 6 7 pip install platformio pio settings get # 查看环境变量platformio pio system info 修改 PLATFORMIO_CORE_DIR 为自定义 PlatformIO Core Directory 就是自己想要的了 arduino教程 参考 esp32文档 Clion配置ESP32开发 CLion 安装 platformIO 教程 ESPAsyncWebServer esp32更新 程序太大 下载慢问题 无法解决用vpn吧\n1 2 3 4 5 6 7 8 9 10 11 pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple ~\\.platformio\\penv\\pip.conf [global] user=no timeout = 1000 index-url = https://pypi.tuna.tsinghua.edu.cn/simple C:\\Users\\Administrator\\.platformio\\penv\\Scripts\\pio.exe project init --board airm2m_core_esp32c3 pio project init --board esp01_1m 命令下载 1 pio project init --board airm2m_core_esp32c3 esp32 c3 风扇参考 pwm问题 pwm问题1 mcpwm ESP-01S(ESP8266) 烧录 GPIO0 拉地(接地 负极)\n无法深度睡眠下唤醒 存储芯片的问题 小点旁边[小点2引脚](第二个 [DO MISO SD_D0]) 10k(电阻) vcc(电源正) 参考1 参考 参考 参考 参考 使用USB转TTL下载固件 「 ESP8266-01s刷入固件报SP8266 Chip efuse check error esp_check_mac_and_efuse」 esptool \u0026ndash;port COM6 write_flash 0x00000\n睡眠 参考1 参考2 参考3 platformio 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 #include \u0026lt;Arduino.h\u0026gt; void setup() { Serial.begin(115200); pinMode(2,OUTPUT); //初始化GPIO2为输出模式 } void loop() { digitalWrite(2,HIGH); //GPIO2输出高电平 delay(500); digitalWrite(2,LOW); //GPIO2输出低电平 delay(500); Serial.printf(\u0026#34;getFlashChipId %u \\n\u0026#34;, EspClass::getFlashChipId()); Serial.printf(\u0026#34;getFlashChipVendorId %hhu \\n\u0026#34;, EspClass::getFlashChipVendorId()); Serial.printf(\u0026#34;getFlashChipRealSize %hhu \\n\u0026#34;, EspClass::getFlashChipRealSize()); } 1 2 3 4 5 6 [env:esp01_1m] platform = espressif8266 board = esp01_1m framework = arduino ;monitor_speed = 115200 monitor_speed = 74880 ","date":"2026-03-07T00:00:00Z","permalink":"/p/esp/","title":"esp"},{"content":"在线烧录 https://web.esphome.io/ tds 参考 风扇 参考1 参考2 ","date":"2026-03-07T00:00:00Z","permalink":"/p/esphome/","title":"esphome"},{"content":"静江 gitlab 台账（低代码开发） 虚拟 团队项目进度管理 禅道 项目管理软件 小幺鸡 接口文档管理工具 创建公司 国家市场监督管理总局 企业开办一网通 ","date":"2026-03-07T00:00:00Z","permalink":"/p/gs/","title":"gs"},{"content":"激活 推荐 缓存 IDEA无限时长插件 官网 手工删除试用授权后重新试用 使用ja-netfilter 1 2 3 4 5 6 [URL] PREFIX,https://account.jetbrains.com/lservice/rpc/validateKey.action PREFIX,https://account.jetbrains.com.cn/lservice/rpc/validateKey.action jetbra目录，编辑 config-jetbrains\\url.conf 文件 新增一个 .cn 后缀的 使用ja-netfilter 热更新的Intellij插件 https://github.com/gejun123456/HotSwapHelper/blob/master/README_CN.md 必要设置 增加idea内存 帮助 -\u0026gt; 更改内存设置 -\u0026gt; 4096 6148\n编辑器 常规 使用 Ctrl + 鼠标滚轮更改字号 文件编码 项目编码 修改为 UTF-8 文件属性默认编码 修改为 UTF-8 文件类型 第二个选项卡 新增 .idea 插件 插件名 Description Translation 必备的翻译插件 Show Comment 注释显示 CamelCase 下划线转驼峰及大小写转换插件和快捷键 Treeinfotip 文件文件夹添加描述 Resource Bundle Editor 国际化必备插件 Treeinfotip 文件文件夹添加描述 Alibaba Java Code Guidelines 阿里巴巴 Java 代码规范 JRebel and XRebel for lntellij 强大的热更新功能，修改文件自动更新bean对象 Maven Helper 方便maven项目解决jar冲突 RestfulToolkit（idea有） 根据url快捷跳转Controller方法 Free MyBatis plugin 提供xml和dao层的互相跳转功能 mapper生成xml文件 GenerateAllSetter 一键生成一个对象的所有get和set方法 Background Image Plus 更换IDEA背景 Key promoter X 会有操作的快捷键在界面的右下角进行告知 google-java-format 重新格式化Java源代码以符合Google Java Style的插件 Rainbow Brackets 彩虹括号 HighlightBracketPair 括号开始结尾 高亮显示 CodeGlance 右边缩略图 Material Theme UI IDEA主题 Atom Material Icons 左边文件夹图标 Power Mode II 打字会出现特效 Statistic 项目信息统计 AI 对比 GitHub Copilot(收费) codeium CodeGeeX\nCodota(换成了Tabnine)（用处不大）\n大数据代码提示功能\n热更新 参考 JRebel and XRebel（不需要 idea自带）\n强大的热更新功能，修改文件自动更新bean对象 激活 网站 未知 插件破解 idea彩虹括号 修改idea vm 文件\n指定编码 -Dfile.encoding=UTF-8\n用户名\n请注意!如果设置的-Duser.name为中文名,可能会出现乱码 请先将idea64.exe.vmoptions文件编码码格式为ANSI再进行修改\neasy javadoc\n","date":"2026-03-07T00:00:00Z","permalink":"/p/idea/","title":"idea"},{"content":"格式 推荐1 编辑器 标准化文档 commonmark simplemde（最后更新2016） 官网 参考 参考 mavon-editor（还不错） 官网 参考 wangeditor(样式不好看，不会局部注册) 官网 milkdown（还不错，功能强大） 官网· ckeditor-4 ","date":"2026-03-07T00:00:00Z","permalink":"/p/md/","title":"md"},{"content":"官网 增加弹幕 原仓库 gitee cmd 管理员命令执行 mklink /D xxx\\mpv-lazy\\portable_config\\scripts\\bilibiliAssert xxx\\scripts\\bilibiliAssert\n下载弹幕 帧提升 开启: shift键 + 上数字键1\n2025-12-29 mpv-lazy\\portable_config\\vs\\MEMC_MVT_LQ.vpy container_fps2 -\u0026gt; container_fps4\n旧 mpv-lazy\\portable_config\\vs\\MEMC_MVT_STD.vpy H_Pre = 1440 Fps_Out = 85.0 Lk_Fmt = False\n动画 Anime4K 参考 参考 官方仓库 ","date":"2026-03-07T00:00:00Z","permalink":"/p/mpv/","title":"mpv"},{"content":"pip uv 中文文档 安装\n1 pip install uv ","date":"2026-03-07T00:00:00Z","permalink":"/p/py/","title":"py"},{"content":"minio rustfs https://juejin.cn/post/7523256725127987226 官网 win自动启动 minio.bat\n1 2 3 4 @echo off cd /d %~dp0 # 跳转到当前脚本的目录 .\\minio.exe server .\\ # pause 启动文件 访问链接 密码：minioadmin | minioadmin\n启动 .\\minio.exe server C:\\minio \u0026ndash;console-address :9000\nyum 换源 版本区别 Alpha、Beta、RC、GA版本的区别 参考 记笔记 typora xmind （思维导图） 在线笔记 有道云 印象 processon （思维导图） web hutool 文档生成框架 docsify官网 Shell编码规范手册(shellcheck错误汇总) 详情 999感冒灵 睡觉 助眠 扑尔敏(抗过敏) 副作用(瞌睡)\n电线（test） 硬芯国标铜导线（单股）线经\n1.5平方 1.38mm 2.5平方 1.78mm 4平方 2.25mm 6平方 2.76mm 10平方 多为7股绞合（单1.35mm） 线径是导体直径 国标GB/T 3956-2008 允许0.02微小公差\n羽绒服(test) 看 克罗值（test） c棉(老美) -\u0026gt; 火箭棉 ~\u0026gt; 金标p棉\nssh升级 解压 tar -zxvf openssh-9.1p1.tar.gz\n备份配置文件 cp /etc/ssh/sshd_config sshd_config.backup cp /etc/pam.d/sshd sshd.backup\n卸载原来的 rpm -e \u0026ndash;nodeps rpm -qa | grep openssh\n编译配置 ./configure \u0026ndash;prefix=/usr \u0026ndash;sysconfdir=/etc/ssh \u0026ndash;with-md5-passwords \u0026ndash;with-pam \u0026ndash;with-zlib \u0026ndash;with-tcp-wrappers \u0026ndash;with-ssl-dir=/usr/local/ssl \u0026ndash;without-hardening\n编译安装 make \u0026amp;\u0026amp; make install\n调整文件权限 chmod 600 /etc/ssh/ssh_host_rsa_key /etc/ssh/ssh_host_ecdsa_key /etc/ssh/ssh_host_ed25519_key\n复制配置文件 cp -a contrib/redhat/sshd.init /etc/init.d/sshd chmod u+x /etc/init.d/sshd mv ../sshd.backup /etc/pam.d/sshd mv ../sshd_config.backup /etc/ssh/sshd_config\n添加自启服务ssh到开机启动项 chkconfig \u0026ndash;add sshd chkconfig sshd on\n重启sshd服务 systemctl restart sshd\n查看最新版本 ssh -V\nOpenSSL\ntar -xf openssl-1.1.1j.tar.gz cd openssl-1.1.1j ./config \u0026ndash;prefix=/usr/local/openssl shared make make install 安装OpenSSL成功 vi /etc/ld.so.conf 添加一行： /usr/local/openssl/lib 保存后执行： ldconfig\n计算机基础 一：与运算符（\u0026amp;） 预算规则：\n0\u0026amp;0=0；0\u0026amp;1=0；1\u0026amp;0=0；1\u0026amp;1=1\n即：两个同时为1，结果为1，否则为0\n例如：3\u0026amp;5\n十进制3转为二进制的3：0000 0011\n十进制5转为二进制的5：0000 0101\n\u0026mdash;\u0026mdash;\u0026mdash;\u0026mdash;\u0026mdash;\u0026mdash;\u0026mdash;\u0026mdash;结果：0000 0001 -\u0026gt;转为十进制：1\n即：3\u0026amp;5 = 1\n二：或运算（|） 运算规则：\n0|0=0； 0|1=1； 1|0=1； 1|1=1；\n即 ：参加运算的两个对象，一个为1，其值为1。\n例如：3|5　即 00000011 | 0000 0101 = 00000111，因此，3|5=7。　三：异或运算符（^） 运算规则：0^0=0； 0^1=1； 1^0=1； 1^1=0；\n即：参加运算的两个对象，如果两个位为“异”（值不同），则该位结果为1，否则为0。\n例如：3^5 = 0000 0011 | 0000 0101 =0000 0110，因此，3^5 = 6\n菜板推荐 银杏木 \u0026gt; 杨树\n区块链 参考 DBeaver 数据库驱动 参考 公共api 图片 图片 pdf itextpdf 网站收藏 参考 ipfs 网关 十六进制文本编辑器 ultraedit 抓包 burp suite 参考 参考 证书 安装与基本使用 httpdebugger 官网 ","date":"2026-03-07T00:00:00Z","permalink":"/p/simple/","title":"simple"},{"content":"下载 参考 motrix-next 在线免费下载视频、音频和图片 在线免费下载视频、音频和图片 库推荐 UUID 参考1 天气 和风 爬虫 fidddler wireshark whustle\n系统测试工具 vip6 屏幕测试 aida64 cpu-z 文本对比 https://www.diffchecker.com/zh-Hans/ cron 在线表达式生成器 https://cron.ciding.cc/ 二维码在线生成 https://www.liantu.com/ json https://www.json.cn/ 在线视频下载 https://www.datatool.vip/ 大全 https://uutool.cn/header2json/ 视频播放器 potplayer 快速登入平台 第三方登录 极验 统一登入 Typora历史版本 mac官网历史版本 ：https://typora.io/dev_release.html windows官网历史版本 ：https://typora.io/windows/dev_release.html\n获取ip和地区 https://pv.sohu.com/cityjson 站长工具 参考 m3u8 资料参考 参考1 直接下载 参考 参考 视频处理 python 实现多线程下载m3u8格式视频，使用FFmpeg合并 FFmpeg视频水印自动识别和去除 Navicat 数据库 oracle连接问题参考 文件对比工具下载 Beyond Compare 5 其他 Spring Boot自定义启动Banner在线生成工具 生成guid 视频工具 handbrake\n哔哩哔哩视频下载 免费会员视频 下载加速 极简插件 破解软件下载 win截屏工具(snipaste) 对比工具（beyondcomparepro） ","date":"2026-03-07T00:00:00Z","permalink":"/p/tools/","title":"tools"},{"content":"OK影视 蜂蜜??? 源 参考1 参考2 参考3 参考4??? 加速 github加速 ","date":"2026-03-07T00:00:00Z","permalink":"/p/tv/","title":"tv"},{"content":"官网 参考1 参考2 ","date":"2026-03-07T00:00:00Z","permalink":"/p/vitepress/","title":"vitePress"},{"content":"https 申请地址 管理地址 Let\u0026rsquo;s Encrypt证书自动更新 免费和开源的HTTPS 代理 服务器监控 https://www.beszel.dev/zh/ api请求工具 流行 postmain 团队最多3人 免费 Apifox 不限团队人数 小幺鸡 不知道 FileZilla FTP,FTPS和SFTP客户端 FileZilla官网 介绍连接 tomcat乱码 详细 下载txt conf/web.xml\n1 2 3 4 \u0026lt;mime-mapping\u0026gt; \u0026lt;extension\u0026gt;txt\u0026lt;/extension\u0026gt; \u0026lt;mime-type\u0026gt;application/txt\u0026lt;/mime-type\u0026gt; \u0026lt;/mime-mapping\u0026gt; 浏览：text/plain\n下载：application/txt\niis下载：application/octet-stream\n浏览目录 default org.apache.catalina.servlets.DefaultServlet debug 0 listings false 1 改true\n","date":"2026-03-07T00:00:00Z","permalink":"/p/fwq/","title":"服务器"},{"content":"内核版本检测 浏览器内核下载 Crx搜搜 - 一个牛X的扩展和应用商店 摄像头webrtc mediarecorder 使用参考 参考 浏览器下载加速 多线程下载：chrome | edge ://flags/#enable-parallel-downloading\njs逆向工具 绕过无限Debugger AntiDebug_Breaker UserAgent分析和查询 https://tool.ip138.com/useragent/ ","date":"2026-03-07T00:00:00Z","permalink":"/p/llq/","title":"浏览器"},{"content":"tracker https://trackerslist.com/#/zh 1 2 3 4 5 6 https://github.com/XIU2/TrackersListCollection https://cdn.jsdelivr.net/gh/ngosang/trackerslist/trackers_best.txt https://trackerslist.com/all.txt https://newtrackon.com/list https://dns.icoa.cn/tracker/ https://gcore.jsdelivr.net/gh/XIU2/TrackersListCollection@master/best.txt 搜索 BT磁力天堂 检测预览 预览链接的内容 MoviePilot 插件 其他 恶意bt处理 搜索 看列表 SkrBT 中文站点 SkrBT BTDigg 中文站点 BTDigg ","date":"2026-02-27T00:00:00Z","permalink":"/p/bt/","title":"bt"},{"content":"下载慢 地址1 地址2 获取地址 Portainer 编辑 sudo vi /etc/docker/daemon.json\n1 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 { \u0026#34;registry-mirrors\u0026#34;: [ \u0026#34;https://docker.fnnas.com\u0026#34;, \u0026#34;https://docker.1panel.live\u0026#34;, \u0026#34;https://docker.1ms.run\u0026#34;, \u0026#34;https://hub1.nat.tf\u0026#34;, \u0026#34;https://hub2.nat.tf\u0026#34;, \u0026#34;https://hub.rat.dev\u0026#34;, \u0026#34;https://docker.anye.in\u0026#34;, \u0026#34;https://docker.chenby.cn\u0026#34;, \u0026#34;https://docker.m.ixdev.cn\u0026#34;, \u0026#34;https://docker.amingg.com\u0026#34;, \u0026#34;https://docker.rainbond.cc\u0026#34;, \u0026#34;https://docker.xuanyuan.me\u0026#34;, \u0026#34;https://docker.awsl9527.cn\u0026#34;, \u0026#34;https://docker.anyhub.us.kg\u0026#34;, \u0026#34;https://docker.13140521.xyz\u0026#34;, \u0026#34;https://docker.m.daocloud.io\u0026#34;, \u0026#34;https://dockerhub.icu\u0026#34;, \u0026#34;https://dockerhub.timeweb.cloud\u0026#34;, \u0026#34;https://noohub.ru\u0026#34;, \u0026#34;https://huecker.io\u0026#34;, \u0026#34;https://dockerproxy.net\u0026#34;, \u0026#34;https://dhub.kubesre.xyz\u0026#34;, \u0026#34;https://image.cloudlayer.icu\u0026#34;, \u0026#34;https://registry.hub.docker.com\u0026#34; ] } 完成编辑后，重新加载 daemon.json 文件并重启 Docker：\n1 2 sudo systemctl daemon-reload sudo systemctl restart docker 可视化管理面板 dpanel Portainer wud 太复杂了\n应用推荐 小雅 参考 参考 # Docker介绍 docker官网 docker官方镜像 阿里云docker镜像 Docker 是一个开源的应用容器引擎，基于 Go 语言 并遵从 Apache2.0 协议开源。 Docker 可以让开发者打包他们的应用以及依赖包到一个轻量级、可移植的容器中，然后发布到任何流行的 Linux 机器上，也可以实现虚拟化。 容器是完全使用沙箱机制，相互之间不会有任何接口（类似 手机 的 app）,更重要的是容器性能开销极低\nwin汉化 推荐 配置 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 buildkit 并行构建、缓存优化 containerd-snapshotter 断点续传 { \u0026#34;features\u0026#34;: { \u0026#34;buildkit\u0026#34;: true, \u0026#34;containerd-snapshotter\u0026#34;: true }, \u0026#34;log-driver\u0026#34;: \u0026#34;json-file\u0026#34;, \u0026#34;log-opts\u0026#34;: { \u0026#34;max-file\u0026#34;: \u0026#34;3\u0026#34;, \u0026#34;max-size\u0026#34;: \u0026#34;500m\u0026#34; }, \u0026#34;registry-mirrors\u0026#34;: [ \u0026#34;https://docker.m.daocloud.io\u0026#34;, https://docker.fnnas.com https://docker.1panel.live https://docker.m.daocloud.io https://docker.1ms.run https://hub1.nat.tf https://hub2.nat.tf https://hub.rat.dev https://docker.amingg.com https://docker.xuanyuan.me ] } Ubuntu 在 Ubuntu 上安装 Docker Engine 下载文件地址 D-Bus 问题 参考 1 2 3 # 替换 重启 curl https://raw.githubusercontent.com/gdraheim/docker-systemctl-replacement/master/files/docker/systemctl.py \u0026gt; /usr/bin/systemctl chmod +x /usr/bin/systemctl 安装Docker Ubuntu参考 centos 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 sudo yum -y install yum-utils device-mapper-persistent-data lvm2 gcc gcc-c++ # 可以跳过 yum -y install https://download.docker.com/linux/fedora/30/x86_64/stable/Packages/containerd.io-1.2.10-3.2.fc30.x86_64.rpm yum -y install https://download.docker.com/linux/fedora/30/x86_64/stable/Packages/containerd.io-1.2.13-3.2.fc30.x86_64.rpm # 配置阿里云仓库 yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo yum -y install docker-ce # 创建docker镜像源 vim /etc/docker/daemon.json { 看上面 \u0026#34;data-root\u0026#34;:\u0026#34;/data/docker\u0026#34; } [参考](https://www.cnblogs.com/zinan/p/11284236.html) [官方文档](https://docs.docker.com/config/containers/logging/configure/) # 重启docker守护进程 systemctl daemon-reload systemctl restart docker ubuntu 1 2 3 4 5 6 7 8 9 10 11 12 13 14 # 更新现有的软件包列表 apt update # 安装一些必备软件包，让 apt 通过 HTTPS 使用软件包 apt install apt-transport-https ca-certificates curl software-properties-common # 将官方 Docker 版本库的 GPG 密钥添加到系统中 curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - # Docker 版本库添加到APT源 add-apt-repository \u0026#34;deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable\u0026#34; # 用新添加的 Docker 软件包来进行升级更新 apt update # 确保要从 Docker 版本库，而不是默认的 Ubuntu 版本库进行安装 apt-cache policy docker-ce # 安装 Docker apt install docker-ce 基本操作 和linux服务命令 一样 如: systemctl status docker \u0026hellip;\n操作 命令 查看版本号信息 docker -v 查看版本号信息（详细） docker version 查看详细信息 docker info 镜像操作 命令 操作 查看所有镜像 docker images 拉取镜像 docker pull 镜像标识:版本号 删除镜像 docker rmi 镜像标识:版本号 删除所有的镜像 docker rmi $(docker images -aq) run 命令\n-d ： 后台运行容器，并返回容器ID -i ： 以交互模式运行容器，通常与 -t 同时使用 -t ： 为容器重新分配一个伪输入终端，通常与 -i 同时使用 \u0026ndash;name=\u0026ldquo;xxx\u0026rdquo; ： 为容器指定一个名称 -P ： 随机端口映射，容器内部端口随机映射到主机的高端口 -p ： 指定端口映射（如 [ -p 宿主机端口:容器端口]） -e username=\u0026ldquo;xxx\u0026rdquo; ： 设置环境变量 -m ： 设置容器使用内存最大值 \u0026ndash;volume , -v ： 绑定一个卷（如 [ -v 宿主机目录:/容器目录 ]） \u0026ndash;net ： 配置网络模式（如 \u0026ndash;net brigge ） 容器操作 基本命令 docker start | stop | restart | rm 容器标识 参数说明\n操作 命令 -i 运行容器 -t 以交互式的方式运行容器，会进入容器的命令行内部 -d 以守护式的方式运行容器，在后台运行 -p 端口映射 -v 目录挂载，将宿主机的目录映射到容器的目录上 查看所有容器 docker ps -a 删除容器 docker rm id/名称\nexec 命令\n-d ：分离模式: 在后台运行 -i ： 即使未连接，也保持标准输入打开 -t ： 分配一个伪终端 文件拷贝 将宿主机的文件拷贝到容器中 ： docker cp 宿主机文件路径 镜像标识:容器路径 1 如 ： docker cp /etc/docker/nginx/nginx.config nginx:/etc/nginx/ 将容器中的文件拷贝到宿主机上 ： docker cp 镜像标识:容器文件路径 宿主机路径 1 如 ： docker cp nginx:/etc/nginx/nginx.config /etc/docker/nginx/ 查看容器映射路径 1 2 docker inspect container_name | grep Mounts -A 20 docker inspect container_id | grep Mounts -A 20 日志 docker logs 参数 镜像标识 参数\n\u0026ndash;since : 此参数指定了输出日志开始日期，即只输出指定日期之后的日志 （如 \u0026ndash;since=“2020-10-10” 只输出（包含）2020-10-10后的日志） -f : 查看实时日志 -t : 查看日志产生的日期 -tail=10 : 查看最后的10条日志 1 2 3 4 5 6 7 8 9 10 11 12 13 #!/bin/sh echo \u0026#34;======== start clean docker containers logs ========\u0026#34; logs=$(find /var/lib/docker/containers/ -name *-json.log) for log in $logs do echo \u0026#34;clean logs : $log\u0026#34; cat /dev/null \u0026gt; $log done echo \u0026#34;======== end clean docker containers logs ========\u0026#34; 网络 网络模式 bridge ： 桥接（默认） none ： 不配置网络 host ： 和宿主机共享 container ： 容器网络连通（用的少） 创建网络 参数 \u0026ndash;driver 使用的网络模式 \u0026ndash;subnet 子网 \u0026ndash;gateway 网关 1 docker network create --driver bridge --subnet 192.168.0.0/16 --gateway 192.168.0.1 mynet 本文特殊描述 镜像标识 如: nginx redis \u0026hellip; 等等 版本号 如:1.0.0 2.2.2 \u0026hellip; 不指定版本号为最新发布版本 远程安全登录 飞牛nas /etc/systemd/system/docker.service\n1 2 3 4 5 6 7 8 9 #!/bin/bash sed -i \u0026#39;8s/$/ -H tcp:\\/\\/0.0.0.0:2375/\u0026#39; /etc/systemd/system/docker.service systemctl daemon-reload systemctl restart docker echo \u0026#34;完成\u0026#34; 配置文件可能在 /lib /uer /etc 参考文档1 参考文档2 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 #!/bin/bash # ------------------------------------------------------------- # 自动创建 Docker TLS 证书 # sed -i \u0026#39;s/\\r$//\u0026#39; xxx.sh // 修复命令 # ------------------------------------------------------------- # --[BEGIN]------------------------------ # 代码，可以随便写 CODE=\u0026#34;WRETCHANT\u0026#34; # 服务器的外网IP IP=\u0026#34;xxx\u0026#34; # CA证书的密码 PASSWORD=\u0026#34;xxx\u0026#34; # 国家 COUNTRY=\u0026#34;CN\u0026#34; # 地区 STATE=\u0026#34;guangdong\u0026#34; # 城市 CITY=\u0026#34;guangzhou\u0026#34; # 组织 ORGANIZATION=\u0026#34;WRETCHANT.EDU\u0026#34; # 组织单元 ORGANIZATIONAL_UNIT=\u0026#34;Dev\u0026#34; # 通用名称 COMMON_NAME=\u0026#34;$IP\u0026#34; # 邮件地址 EMAIL=\u0026#34;xxx@gmail.com\u0026#34; # --[END]-- # 创建存放脚本的文件夹 mkdir -p /simple/docker/ca/ cd /simple/docker/ca/ || exit # 生成 CA 密钥 openssl genrsa -aes256 -passout \u0026#34;pass:$PASSWORD\u0026#34; -out \u0026#34;ca-key.pem\u0026#34; 4096 # 生成 CA openssl req -new -x509 -days 365 -key \u0026#34;ca-key.pem\u0026#34; -sha256 -out \u0026#34;ca.pem\u0026#34; -passin \u0026#34;pass:$PASSWORD\u0026#34; -subj \u0026#34;/C=$COUNTRY/ST=$STATE/L=$CITY/O=$ORGANIZATION/OU=$ORGANIZATIONAL_UNIT/CN=$COMMON_NAME/emailAddress=$EMAIL\u0026#34; # 生成服务器密钥 openssl genrsa -out \u0026#34;server-key.pem\u0026#34; 4096 # 生成服务器证书 openssl req -subj \u0026#34;/CN=$COMMON_NAME\u0026#34; -sha256 -new -key \u0026#34;server-key.pem\u0026#34; -out server.csr echo \u0026#34;subjectAltName = IP:$IP,IP:127.0.0.1\u0026#34; \u0026gt;\u0026gt;extfile.cnf echo \u0026#34;extendedKeyUsage = serverAuth\u0026#34; \u0026gt;\u0026gt;extfile.cnf openssl x509 -req -days 365 -sha256 -in server.csr -passin \u0026#34;pass:$PASSWORD\u0026#34; -CA \u0026#34;ca.pem\u0026#34; -CAkey \u0026#34;ca-key.pem\u0026#34; -CAcreateserial -out \u0026#34;server-cert.pem\u0026#34; -extfile extfile.cnf # 生成客户端证书 rm -f extfile.cnf openssl genrsa -out \u0026#34;key.pem\u0026#34; 4096 openssl req -subj \u0026#39;/CN=client\u0026#39; -new -key \u0026#34;key.pem\u0026#34; -out client.csr echo extendedKeyUsage = clientAuth \u0026gt;\u0026gt;extfile.cnf openssl x509 -req -days 365 -sha256 -in client.csr -passin \u0026#34;pass:$PASSWORD\u0026#34; -CA \u0026#34;ca.pem\u0026#34; -CAkey \u0026#34;ca-key.pem\u0026#34; -CAcreateserial -out \u0026#34;cert.pem\u0026#34; -extfile extfile.cnf rm -vf client.csr server.csr extfile.cnf chmod -v 0400 \u0026#34;ca-key.pem\u0026#34; \u0026#34;key.pem\u0026#34; \u0026#34;server-key.pem\u0026#34; chmod -v 0444 \u0026#34;ca.pem\u0026#34; \u0026#34;server-cert.pem\u0026#34; \u0026#34;cert.pem\u0026#34; # ca.pem ca-key.pem cert.pem key.pem 为客户端证书 # /lib/systemd/system/docker.service # ExecStart=/usr/bin/dockerd --tlsverify --tlscacert=/simple/docker/ca/ca.pem --tlscert=/simple/docker/ca/server-cert.pem --tlskey=/simple/docker/ca/server-key.pem -H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock # systemctl daemon-reload # systemctl restart docker # ca.pem server-cert.pem server-key.pem 为服务器证书 # ca.pem ca-key.pem cert.pem key.pem 为客户端证书 docker-compose命令 详情 安装\n1 2 3 4 5 6 curl -L https://get.daocloud.io/docker/compose/releases/download/1.27.4/docker-compose-`uname -s`-`uname -m` \u0026gt; /usr/local/bin/docker-compose curl -L https://github.com/docker/compose/releases/download/1.27.4/docker-compose-`uname -s`-`uname -m` \u0026gt; /usr/local/bin/docker-compose sudo chmod +x /usr/local/bin/docker-compose docker-compose version ","date":"2026-02-26T00:00:00Z","permalink":"/p/docker/","title":"docker"},{"content":"安装辅助 *** 注意 如果下载的是【团子LD.zip】 需要修改后缀为 .apk 后【团子LD.apk】安装\n使用网盘 下载地址 直接下载(有可能失效) 链接1(cdn) 链接2(openlist) 链接3(nas) qq群文件下载安装 点击链接加入群聊 qq下载默认带后缀【.1】需要删掉才能安装\n性能优化 在游戏设置中打开【低效能模式】\n就可以，不显示【伤害数字】和【特效】，辅助运行更流畅！\n游戏更新 谷歌商店更新(需要梯子vpn) uu加速器 (存在延迟) QooApp (感觉超级慢) 使用安装包的方式(.apks)(超级麻烦) 电脑mumu模拟器 *** 其他模拟器应该是不可用的 ***\n基本流程 下载mumu模拟器 使用模拟器内的谷歌安装器 安装游戏 安装辅助 *** 设置【开启root】 *** 打开辅助【启动软件】 *** 设置【关闭root】 打开加速器 打开游戏 运行辅助 *** 主要（游戏进不去问题） 基本流程【5 6 7】步骤必须一次性完成 进游戏前面必须保证root关闭 不然游戏就会向下图一样进不去\n详细教程 下载安装模拟器 mumu模拟器官网 环境配置 使用谷歌安装器 开关root 安装游戏 登录谷歌应用商店下载安装\n可使用【QooApp 】安装\n退出游客账号, 登录自己的游戏账号 ！！！ 退出当前游客账号 然后就可以使用【谷歌账号】或者【苹果账号】登录了\n分辨率问题 必须是 16:9 的分辨率 如:\n1920 x 1080 1280 x 720 可以在设置里面修改\n辅助使用 基本上默认就可以了\n有会员就打开【通用配置1】-\u0026gt;【vvip】\n人物配置 里面 选择一下需要的人物就好\n作者配置 现在双11了所以挂(神级)【适配神级的时候是双8(当然被举报了很多次)】\n还是推荐自己看看通关记录(游戏内 和 脚本内 都有记录可以看)\n全部默认，就修改\n区域左上角第一个【远程输出】\n人物 【金刚猫】\n不灭 【死神青蛙】【金刚猫】\n*** 其他问题 点击辅助内【启动软件】后没有反应（无弹窗） 查看环境检测是否正确 辅助 右上角 打开设置\n确保当前模式是【设备Root】 如果不是 点击进去切换一下\n可以点击下面两个测试一下是否正常\n游戏加速器推荐 biubiu加速器 外星人加速器 ","date":"2026-02-26T00:00:00Z","permalink":"/p/ld/","title":"辅助使用教程"},{"content":"机顶盒 参考 参考 参考 0123\n参考 qaab\n参考 5v8w6\n九联UNT403G 路径不能为中文 tll 左rx 右tx\ncdn(未测试) 推荐 小米盒子教程Armbian Armbian 推荐教程 root刷机 参考 完整参考 u盘启动 下载镜像 Armbian_xx.xx.xx_amlogic_s905l_xxx_xx.xx.xx_server_xxxx.xx.xx.img 上次使用 Armbian_25.02.0_amlogic_s905l_noble_6.6.71_server_2025.01.17.img\nrmbian安装docker、alist、OpenWrt、Aria2 armbian后扩容根分区 linux下修改/dev/shm tmpfs文件系统大小 arm 环境下安装selenium+chrome 其他 参考 参考 参考 ","date":"2026-02-26T00:00:00Z","permalink":"/p/hz/","title":"盒子"},{"content":"hugo md头 1 2 3 4 5 6 7 8 9 10 11 --- title: 标题 description: 描述 date: 2026-02-25 slug: url categories: - hugo tags: - hugo --- hugo常用命令 参考 一般开发 hugo server 它默认不会包含草稿文章\nhugo server -D\n发布 hugo \u0026ndash;gc \u0026ndash;minify\n\u0026ndash;gc 清除不再使用的缓存文件\n\u0026ndash;minify 文件进行压缩\n推荐 hugo server \u0026ndash;gc -D\n启动一个实时预览服务器，同时执行垃圾回收，确保使用的是最新的缓存。适合在开发过程中使用，当频繁修改文章内容，并希望随时预览草稿文章在内的网站效果时最方便\ncf部署 参考 部链接用新窗口 拷贝 layouts/_markup/render-link.\n新增 layouts/_default/_markup/render-link.html\ncdn外链图片无法直接点击打开 博客参考 github 参考 ","date":"2026-02-25T00:00:00Z","permalink":"/p/hugo%E6%95%99%E7%A8%8B/","title":"hugo教程"},{"content":"上传文件路径 s3插件 1 2 3 4 {year}/{month}/{day}/{md5}.{extName} 文件名 {fullName} ","date":"2026-02-25T00:00:00Z","permalink":"/p/picgo/","title":"picgo cf图片"},{"content":"毕少侠 ","date":"2026-02-25T00:00:00Z","permalink":"/p/%E5%8D%9A%E5%AE%A2/","title":"博客"},{"content":"BQ25504电压计算器 BQ25504电压计算器.html 文档 官网 bq25504.pdf pcb 编辑器(标准编辑器) 嘉立创pcb json ","date":"2026-02-25T00:00:00Z","permalink":"/p/bq25504/","title":"低功耗太阳能"},{"content":"固态硬盘分区4k对齐选2048还是4096 固态 4096\nlist disk select disk 0 (将0替换为你的SSD编号) list partition\n参考 ","date":"2026-02-25T00:00:00Z","permalink":"/p/%E7%94%B5%E8%84%91/","title":"电脑"},{"content":"网络配置 bot用 名称: bot 类型: Websocket客户端 URL: ws://192.168.1.33:6199/ws 消息格式: array Token: 2424585654 ql用 名称: ql 类型: HTTP服务器 HOST: 0.0.0.0 Port: 3000 消息格式: array qq机器人 推荐列表 civitai mirai ","date":"2026-02-13T00:00:00Z","permalink":"/p/napcat/","title":"napcat"},{"content":"Stack 主题还提供了一些自定义短代码来增强你的内容。\n引用 (Quote) quote 短代码允许你显示带有作者、来源和 URL 的引用。\nLorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.\n― 一位名人, 他们写的书 用法 1 2 3 {{\u0026lt; quote author=\u0026#34;作者名字\u0026#34; source=\u0026#34;文章标题\u0026#34; url=\u0026#34;https://example.com\u0026#34; \u0026gt;}} 这里是引用内容。 {{\u0026lt; /quote \u0026gt;}} 视频 (Video) video 短代码允许你嵌入自托管或远程视频文件。\nYour browser doesn't support HTML5 video. Here is a link to the video instead. 用法 1 {{\u0026lt; video src=\u0026#34;https://example.com/video.mp4\u0026#34; \u0026gt;}} Bilibili 嵌入来自 Bilibili 的视频。支持 av 和 bv 号。\n用法 1 {{\u0026lt; bilibili \u0026#34;BV1634y1t7xR\u0026#34; \u0026gt;}} YouTube Hugo 内置的 YouTube 短代码。\n用法 1 {{\u0026lt; youtube ZJthWmvUzzc \u0026gt;}} 腾讯视频 (Tencent Video) 嵌入来自腾讯视频的视频。\n用法 1 {{\u0026lt; tencent \u0026#34;u00306ng962\u0026#34; \u0026gt;}} GitLab Snippet 嵌入来自 GitLab 的代码片段。\n用法 1 {{\u0026lt; gitlab 2349278 \u0026gt;}} 图表 (Diagrams) Stack 出箱即用地支持 Mermaid 图表。\ngraph TD; A--\u003eB; A--\u003eC; B--\u003eD; C--\u003eD;用法 将你的 Mermaid 代码包裹在语言设置为 mermaid 的代码块中。\n```mermaid graph TD; A--\u003eB; A--\u003eC; B--\u003eD; C--\u003eD; ```","date":"2026-01-26T00:00:00Z","permalink":"/p/%E7%9F%AD%E4%BB%A3%E7%A0%81/","title":"短代码"},{"content":"Stack 主题内置了对相册的支持。你只需要简单地将多张图片并排放置，就可以创建一个精美的相册。\n示例相册 它是如何工作的 相册由 Photoswipe 和一个自定义的内部脚本驱动。它会根据图片的宽高比自动计算出最佳布局。\n要创建一个相册，你只需要将多张图片放在同一行（或同一个段落）中。\n语法 1 2 3 ![图片 1](image1.jpg) ![图片 2](image2.jpg) ![图片 3](image3.jpg) ![图片 4](image4.jpg) 注意: 图片之间应该有两个空格，以确保它们在 Markdown 中保持在同一行。\n相册语法启发自 Typlog ","date":"2026-01-26T00:00:00Z","image":"/p/image-gallery/helena-hertz-wWZzXlDpMog-unsplash.jpg","permalink":"/p/image-gallery/","title":"相册"},{"content":"这篇文章提供了可以在 Hugo 内容文件中使用的基本 Markdown 语法示例，同时也展示了 Hugo 主题中基本 HTML 元素是否应用了 CSS 装饰。\n标题 (Headings) 以下 HTML \u0026lt;h1\u0026gt;—\u0026lt;h6\u0026gt; 元素代表了六个级别的章节标题。\u0026lt;h1\u0026gt; 是最高级别，而 \u0026lt;h6\u0026gt; 是最低级别。\nH3 H4 H5 H6 段落 (Paragraph) Xerum, quo qui aut unt expliquam qui dolut labo. Aque venitatiusda cum, voluptionse latur sitiae dolessi aut parist aut dollo enim qui voluptate ma dolestendit peritin re plis aut quas inctum laceat est volestemque commosa as cus endigna tectur, offic to cor sequas etum rerum idem sintibus eiur? Quianimin porecus evelectur, cum que nis nust voloribus ratem aut omnimi, sitatur? Quiatem. Nam, omnis sum am facea corem alique molestrunt et eos evelece arcillit ut aut eos eos nus, sin conecerem erum fuga. Ri oditatquam, ad quibus unda veliamenimin cusam et facea ipsamus es exerum sitate dolores editium rerore eost, temped molorro ratiae volorro te reribus dolorer sperchicium faceata tiustia prat.\nItatur? Quiatae cullecum rem ent aut odis in re eossequodi nonsequ idebis ne sapicia is sinveli squiatum, core et que aut hariosam ex eat.\n引用 (Blockquotes) 引用元素代表从另一个来源引用的内容，可以选择带有引用说明（必须在 footer 或 cite 元素内），也可以选择带有行内更改（如注释和缩写）。\n不带出处的引用 Tiam, ad mint andaepu dandae nostion secatur sequo quae. 注意：你可以在引用中使用 Markdown 语法。\n带有出处的引用 不要通过共享内存来通信，而要通过通信来共享内存。\n— Rob Pike1\n带提示的引用 📝 备注 突出显示用户在快速浏览时也应注意的信息。\n💡 提示 可选信息，帮助用户更顺利地完成任务。\n📌 重要 用户成功所必需的关键信息。\n⚠️ 警告 由于潜在风险而需要用户立即关注的关键内容。\n🚨 注意 某个操作可能带来的负面后果。\n📝 自定义标题 如果你想使用自定义标题，可以在方括号后面添加标题文本，如上所示。\n表格 (Tables) 表格虽然不是 Markdown 核心规范的一部分，但 Hugo 出箱即用地支持它们。\n姓名 年龄 Bob 27 Alice 23 表格内的行内 Markdown 斜体 加粗 代码 italics bold code A B C D E F Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus ultricies, sapien non euismod aliquam, dui ligula tincidunt odio, at accumsan nulla sapien eget ex. Proin eleifend dictum ipsum, non euismod ipsum pulvinar et. Vivamus sollicitudin, quam in pulvinar aliquam, metus elit pretium purus Proin sit amet velit nec enim imperdiet vehicula. Ut bibendum vestibulum quam, eu egestas turpis gravida nec Sed scelerisque nec turpis vel viverra. Vivamus vitae pretium sapien 代码块 (Code Blocks) 使用反引号的代码块 1 2 3 4 5 6 7 8 9 10 \u0026lt;!doctype html\u0026gt; \u0026lt;html lang=\u0026#34;en\u0026#34;\u0026gt; \u0026lt;head\u0026gt; \u0026lt;meta charset=\u0026#34;utf-8\u0026#34;\u0026gt; \u0026lt;title\u0026gt;Example HTML5 Document\u0026lt;/title\u0026gt; \u0026lt;/head\u0026gt; \u0026lt;body\u0026gt; \u0026lt;p\u0026gt;Test\u0026lt;/p\u0026gt; \u0026lt;/body\u0026gt; \u0026lt;/html\u0026gt; 使用四个空格缩进的代码块 \u0026lt;!doctype html\u0026gt; \u0026lt;html lang=\u0026quot;en\u0026quot;\u0026gt; \u0026lt;head\u0026gt; \u0026lt;meta charset=\u0026quot;utf-8\u0026quot;\u0026gt; \u0026lt;title\u0026gt;Example HTML5 Document\u0026lt;/title\u0026gt; \u0026lt;/head\u0026gt; \u0026lt;body\u0026gt; \u0026lt;p\u0026gt;Test\u0026lt;/p\u0026gt; \u0026lt;/body\u0026gt; \u0026lt;/html\u0026gt; Diff 代码块 1 2 3 4 5 [dependencies.bevy] git = \u0026#34;https://github.com/bevyengine/bevy\u0026#34; rev = \u0026#34;11f52b8c72fc3a568e8bb4a4cd1f3eb025ac2e13\u0026#34; - features = [\u0026#34;dynamic\u0026#34;] + features = [\u0026#34;jpeg\u0026#34;, \u0026#34;dynamic\u0026#34;] 单行代码块 1 \u0026lt;p\u0026gt;A paragraph\u0026lt;/p\u0026gt; 列表类型 (List Types) 有序列表 第一项 第二项 第三项 无序列表 列表项 另一项 还有一项 嵌套列表 水果 苹果 橘子 香蕉 乳制品 牛奶 奶酪 其他元素 — abbr, sub, sup, kbd, mark GIF 是一种位图图像格式。\nH2O\nXn + Yn = Zn\n按 CTRL + ALT + Delete 结束会话。\n大多数蝾螈是夜行性的，捕食昆虫、蠕虫和其他小型生物。\n以上引用摘自 Rob Pike 在 2015 年 11 月 18 日 Gopherfest 期间的演讲 。\u0026#160;\u0026#x21a9;\u0026#xfe0e;\n","date":"2026-01-25T00:00:00Z","image":"/p/markdown-%E8%AF%AD%E6%B3%95%E6%8C%87%E5%8D%97/pawel-czerwinski-8uZPynIu-rQ-unsplash.jpg","permalink":"/p/markdown-%E8%AF%AD%E6%B3%95%E6%8C%87%E5%8D%97/","title":"Markdown 语法指南"},{"content":"Stack 主题支持使用 KaTeX 渲染数学公式。\n启用 KaTeX 按页面启用 要在特定文章中启用 KaTeX，请在文章的前置参数（frontmatter）中包含 math: true：\n1 2 3 4 --- title: \u0026#34;我的数学文章\u0026#34; math: true --- 全局启用 要为所有文章启用 KaTeX，请在网站配置（params.yaml 或 params.toml）中将 article.math 设置为 true：\n1 2 article: math: true 示例 行内公式 你可以通过将表达式包裹在单个美元符号 $ 中来包含行内公式。\n例如：$ \\varphi = \\dfrac{1+\\sqrt5}{2}= 1.6180339887… $ 将渲染为 $ \\varphi = \\dfrac{1+\\sqrt5}{2}= 1.6180339887… $\n块级公式 对于较大的方程式，请使用双美元符号 $$ 创建数学块。\n$$ \\varphi = 1+\\frac{1} {1+\\frac{1} {1+\\frac{1} {1+\\cdots} } } $$更复杂的公式 $$ f(a) = \\frac{1}{2\\pi i} \\oint_\\gamma \\frac{f(z)}{z-a} dz $$ 注意： 有关受支持的 TeX 函数的完整列表，请参阅 KaTeX 文档 。\n","date":"2026-01-24T00:00:00Z","permalink":"/p/math-typesetting/","title":"数学公式"},{"content":"This theme supports Mermaid diagrams directly in your Markdown content. Mermaid lets you create diagrams and visualizations using text and code.\nAbout Mermaid.js This theme integrates Mermaid.js (v11) to render diagrams from text definitions within Markdown code blocks. Mermaid is a JavaScript-based diagramming and charting tool that uses text-based syntax inspired by Markdown.\nFor complete syntax documentation, see the Mermaid.js documentation .\nGetting Started To create a Mermaid diagram, simply use a fenced code block with mermaid as the language identifier:\n1 2 3 4 5 ```mermaid graph TD A[Start] --\u0026gt; B[Process] B --\u0026gt; C[End] ``` The diagram will be automatically rendered when the page loads.\nFeatures Auto-detection: Mermaid script only loads on pages that contain diagrams Theme Support: Diagrams automatically adapt to light/dark mode HTML Labels: Support for HTML content in labels (like \u0026lt;br/\u0026gt; for line breaks) Configurable: Customize version, security level, and more in your site config Configuration You can configure Mermaid in your site config:\nhugo.yaml:\n1 2 3 4 5 6 7 8 9 params: article: mermaid: version: \u0026#34;11\u0026#34; # Mermaid version from CDN look: classic # classic or handDrawn (sketch style) lightTheme: default # Theme for light mode darkTheme: neutral # Theme for dark mode securityLevel: strict # strict (default), loose, antiscript, sandbox htmlLabels: true # Enable HTML in labels hugo.toml:\n1 2 3 4 5 6 7 [params.article.mermaid] version = \u0026#34;11\u0026#34; # Mermaid version from CDN look = \u0026#34;classic\u0026#34; # classic or handDrawn (sketch style) lightTheme = \u0026#34;default\u0026#34; # Theme for light mode darkTheme = \u0026#34;neutral\u0026#34; # Theme for dark mode securityLevel = \u0026#34;strict\u0026#34; # strict (default), loose, antiscript, sandbox htmlLabels = true # Enable HTML in labels Additional Global Options These optional settings use Mermaid\u0026rsquo;s defaults when not specified:\nhugo.yaml:\n1 2 3 4 5 6 7 8 9 params: article: mermaid: maxTextSize: 50000 # Maximum text size (default: 50000) maxEdges: 500 # Maximum edges allowed (default: 500) fontSize: 16 # Global font size in pixels (default: 16) fontFamily: \u0026#34;arial\u0026#34; # Global font family curve: \u0026#34;basis\u0026#34; # Line curve: basis, cardinal, linear (default: basis) logLevel: 5 # Debug level 0-5, 0=debug, 5=fatal (default: 5) hugo.toml:\n1 2 3 4 5 6 7 [params.article.mermaid] maxTextSize = 50000 # Maximum text size (default: 50000) maxEdges = 500 # Maximum edges allowed (default: 500) fontSize = 16 # Global font size in pixels (default: 16) fontFamily = \u0026#34;arial\u0026#34; # Global font family curve = \u0026#34;basis\u0026#34; # Line curve: basis, cardinal, linear (default: basis) logLevel = 5 # Debug level 0-5, 0=debug, 5=fatal (default: 5) For diagram-specific options (like flowchart.useMaxWidth), use Mermaid\u0026rsquo;s init directive directly in your diagram:\n1 2 3 4 5 ```mermaid %%{init: {\u0026#39;flowchart\u0026#39;: {\u0026#39;useMaxWidth\u0026#39;: false}}}%% flowchart LR A --\u0026gt; B ``` Security Note: The default securityLevel: strict is recommended. Set to loose only if you need HTML labels like \u0026lt;br/\u0026gt; in your diagrams.\nAvailable Themes Theme Description default Standard colorful theme neutral Grayscale, great for printing and dark mode dark Designed for dark backgrounds forest Green color palette base Minimal theme, customizable with themeVariables null Disable theming entirely Custom Theme Variables For full control, use the base theme with custom variables:\nhugo.yaml:\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 params: article: mermaid: lightTheme: base darkTheme: base lightThemeVariables: primaryColor: \u0026#34;#4a90d9\u0026#34; primaryTextColor: \u0026#34;#ffffff\u0026#34; lineColor: \u0026#34;#333333\u0026#34; darkThemeVariables: primaryColor: \u0026#34;#6ab0f3\u0026#34; primaryTextColor: \u0026#34;#ffffff\u0026#34; lineColor: \u0026#34;#cccccc\u0026#34; background: \u0026#34;#1a1a2e\u0026#34; hugo.toml:\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 [params.article.mermaid] lightTheme = \u0026#34;base\u0026#34; darkTheme = \u0026#34;base\u0026#34; [params.article.mermaid.lightThemeVariables] primaryColor = \u0026#34;#4a90d9\u0026#34; primaryTextColor = \u0026#34;#ffffff\u0026#34; lineColor = \u0026#34;#333333\u0026#34; [params.article.mermaid.darkThemeVariables] primaryColor = \u0026#34;#6ab0f3\u0026#34; primaryTextColor = \u0026#34;#ffffff\u0026#34; lineColor = \u0026#34;#cccccc\u0026#34; background = \u0026#34;#1a1a2e\u0026#34; Common variables: primaryColor, secondaryColor, tertiaryColor, primaryTextColor, lineColor, background, fontFamily\nNote: Theme variables only work with the base theme and must use hex color values (e.g., #ff0000).\nDiagram Types Flowchart Flowcharts are the most common diagram type. Use graph or flowchart with direction indicators:\nTD or TB: Top to bottom BT: Bottom to top LR: Left to right RL: Right to left flowchart LR A[Hard edge] --\u003e|Link text| B(Round edge) B --\u003e C{Decision} C --\u003e|One| D[Result one] C --\u003e|Two| E[Result two]Sequence Diagram Perfect for showing interactions between components:\nsequenceDiagram participant Alice participant Bob Alice-\u003e\u003eJohn: Hello John, how are you? loop Healthcheck John-\u003e\u003eJohn: Fight against hypochondria end Note right of John: Rational thoughts prevail! John--\u003e\u003eAlice: Great! John-\u003e\u003eBob: How about you? Bob--\u003e\u003eJohn: Jolly good!Class Diagram Visualize class structures and relationships:\nclassDiagram Animal \u003c|-- Duck Animal \u003c|-- Fish Animal \u003c|-- Zebra Animal : +int age Animal : +String gender Animal: +isMammal() Animal: +mate() class Duck{ +String beakColor +swim() +quack() } class Fish{ -int sizeInFeet -canEat() } class Zebra{ +bool is_wild +run() }State Diagram Model state machines and transitions:\nstateDiagram-v2 [*] --\u003e Still Still --\u003e [*] Still --\u003e Moving Moving --\u003e Still Moving --\u003e Crash Crash --\u003e [*]Entity Relationship Diagram Document database schemas:\nerDiagram CUSTOMER ||--o{ ORDER : places ORDER ||--|{ LINE-ITEM : contains CUSTOMER }|..|{ DELIVERY-ADDRESS : uses CUSTOMER { string name string custNumber string sector } ORDER { int orderNumber string deliveryAddress }Gantt Chart Plan and track project schedules:\ngantt title A Gantt Diagram dateFormat YYYY-MM-DD section Section A task :a1, 2024-01-01, 30d Another task :after a1, 20d section Another Task in Another :2024-01-12, 12d another task :24dPie Chart Display proportional data:\npie showData title Key elements in Product X \"Calcium\" : 42.96 \"Potassium\" : 50.05 \"Magnesium\" : 10.01 \"Iron\" : 5Git Graph Visualize Git branching strategies:\ngitGraph commit commit branch develop checkout develop commit commit checkout main merge develop commit commitMindmap Create hierarchical mindmaps:\nmindmap root((mindmap)) Origins Long history Popularisation British popular psychology author Tony Buzan Research On effectivenessand features On Automatic creation Uses Creative techniques Strategic planning Argument mapping Tools Pen and paper MermaidTimeline Display chronological events:\ntimeline title History of Social Media Platform 2002 : LinkedIn 2004 : Facebook : Google 2005 : YouTube 2006 : TwitterAdvanced Features HTML in Labels To use HTML in labels, you must set securityLevel: loose in your site config:\nhugo.yaml:\n1 2 3 4 5 params: article: mermaid: securityLevel: loose htmlLabels: true hugo.toml:\n1 2 3 [params.article.mermaid] securityLevel = \u0026#34;loose\u0026#34; htmlLabels = true Then you can use HTML tags like \u0026lt;br/\u0026gt; for line breaks:\n1 2 3 4 ```mermaid graph TD A[Line 1\u0026lt;br/\u0026gt;Line 2] --\u0026gt; B[\u0026lt;b\u0026gt;Bold\u0026lt;/b\u0026gt; text] ``` Per-Diagram Theming Override the theme for a specific diagram using Mermaid\u0026rsquo;s frontmatter:\n1 2 3 4 5 ```mermaid %%{init: {\u0026#39;theme\u0026#39;: \u0026#39;forest\u0026#39;}}%% graph TD A[Start] --\u0026gt; B[End] ``` %%{init: {'theme': 'forest'}}%% graph TD A[Christmas] --\u003e|Get money| B(Go shopping) B --\u003e C{Let me think} C --\u003e|One| D[Laptop] C --\u003e|Two| E[iPhone] C --\u003e|Three| F[Car]Inline Styling with style You can style individual nodes directly within your diagram using the style directive:\n1 2 3 4 5 6 7 ```mermaid flowchart LR A[Start] --\u0026gt; B[Process] --\u0026gt; C[End] style A fill:#4ade80,stroke:#166534,color:#000 style B fill:#60a5fa,stroke:#1e40af,color:#000 style C fill:#f87171,stroke:#991b1b,color:#fff ``` Result:\nflowchart LR A[Start] --\u003e B[Process] --\u003e C[End] style A fill:#4ade80,stroke:#166534,color:#000 style B fill:#60a5fa,stroke:#1e40af,color:#000 style C fill:#f87171,stroke:#991b1b,color:#fffStyle properties include:\nfill - Background color stroke - Border color stroke-width - Border thickness color - Text color stroke-dasharray - Dashed border (e.g., 5 5) Styling with CSS Classes You can define reusable styles with classDef and apply them using :::className:\n1 2 3 4 5 6 7 ```mermaid flowchart LR A:::success --\u0026gt; B:::info --\u0026gt; C:::warning classDef success fill:#4ade80,stroke:#166534,color:#000 classDef info fill:#60a5fa,stroke:#1e40af,color:#000 classDef warning fill:#fbbf24,stroke:#92400e,color:#000 ``` Result:\nflowchart LR A:::success --\u003e B:::info --\u003e C:::warning classDef success fill:#4ade80,stroke:#166534,color:#000 classDef info fill:#60a5fa,stroke:#1e40af,color:#000 classDef warning fill:#fbbf24,stroke:#92400e,color:#000Subgraphs Group related nodes together:\nflowchart TB subgraph one a1--\u003ea2 end subgraph two b1--\u003eb2 end subgraph three c1--\u003ec2 end one --\u003e two three --\u003e two two --\u003e c2Theme Switching This theme automatically detects your site\u0026rsquo;s light/dark mode preference and adjusts the Mermaid diagram theme accordingly:\nLight mode: Uses the default Mermaid theme Dark mode: Uses the dark Mermaid theme (configurable) Try toggling the theme switcher to see diagrams update in real-time!\nComplex Example Here\u0026rsquo;s an example with subgraphs, HTML labels, emojis, and custom styling:\nflowchart TD subgraph client[\"👤 Client\"] A[\"User Device192.168.1.10\"] end subgraph cloud[\"☁️ Cloud Gateway\"] B[\"Load Balancer(SSL Termination)\"] end subgraph server[\"🖥️ Application Server\"] C[\"API Gateway10.0.0.1\"] D[\"Auth Service10.0.0.2\"] E[\"Web Server10.0.0.3\"] F[\"Database10.0.0.4\"] end A -- \"HTTPS Request\" --\u003e B B -- \"Forward(internal)\" --\u003e C C -- \"Authenticate\" --\u003e D D -- \"Token\" --\u003e C C -- \"Route\" --\u003e E E --\u003e F style client fill:#1a365d,stroke:#2c5282,color:#fff style cloud fill:#f6ad55,stroke:#dd6b20,color:#000 style server fill:#276749,stroke:#22543d,color:#fff Note: This example requires securityLevel: loose for HTML labels and styling to work.\nKnown Limitations Dark Mode Theming Mermaid.js\u0026rsquo;s built-in themes have some limitations:\ndark theme (default): Best text contrast, but some diagram backgrounds may appear brownish (e.g., Gantt charts) neutral theme: Better background colors, but some text (labels, legends) may have reduced contrast For full control, use the base theme with custom variables:\nhugo.yaml:\n1 2 3 4 5 6 7 8 9 params: article: mermaid: darkTheme: base darkThemeVariables: primaryColor: \u0026#34;#1f2937\u0026#34; primaryTextColor: \u0026#34;#ffffff\u0026#34; lineColor: \u0026#34;#9ca3af\u0026#34; textColor: \u0026#34;#e5e7eb\u0026#34; hugo.toml:\n1 2 3 4 5 6 7 8 [params.article.mermaid] darkTheme = \u0026#34;base\u0026#34; [params.article.mermaid.darkThemeVariables] primaryColor = \u0026#34;#1f2937\u0026#34; primaryTextColor = \u0026#34;#ffffff\u0026#34; lineColor = \u0026#34;#9ca3af\u0026#34; textColor = \u0026#34;#e5e7eb\u0026#34; We plan to improve dark mode theming in future updates as Mermaid.js evolves.\nTroubleshooting Diagram not rendering? Make sure you\u0026rsquo;re using a fenced code block with mermaid as the language Check your browser\u0026rsquo;s console for syntax errors Verify your Mermaid syntax at Mermaid Live Editor HTML not working in labels? HTML in labels requires securityLevel: loose. Update your configuration:\nhugo.yaml:\n1 2 3 4 5 params: article: mermaid: securityLevel: loose htmlLabels: true hugo.toml:\n1 2 3 [params.article.mermaid] securityLevel = \u0026#34;loose\u0026#34; htmlLabels = true Warning: Using loose security level allows HTML in diagrams. Only use this if you trust your diagram content.\nSyntax errors? Mermaid is strict about syntax. Common issues:\nMissing spaces around arrows Unclosed brackets or quotes Invalid node IDs (avoid special characters) Resources Mermaid Documentation Mermaid Live Editor - Test diagrams interactively Mermaid Syntax Reference ","date":"2025-12-23T00:00:00Z","permalink":"/p/mermaid-diagrams/","title":"Mermaid Diagrams"},{"content":"h3-2s 桥接 宽带设置\n新增一个\n模式 桥模式\n光猫改桥接后op访问光猫后台的设置 https://www.bilibili.com/video/BV1F5411Q7Xp https://zhuanlan.zhihu.com/p/1924973204142810446 创建接口 静态地址 192.168.1.x + 网关 关闭【默认网关】 有MAC就对了\nhttp://192.168.1.1/usr=CMCCAdmin\u0026amp;psw=aDm8H%25MdA\u0026amp;cmd=1\u0026amp;telnet.gch CMCCAdmin user Qqxxx@. 参考 参考 参考 1 2 3 4 5 6 7 8 9 10 11 telnet 192.168.1.1 CMCCAdmin aDm8H%MdA sidbg 1 DB decry /userconfig/cfg/db_user_cfg.xml vi /tmp/debug-decry-cfg 搜索 :/CMCCAdmin nat参考 istoreos dns smartdns\n","date":"0001-01-01T00:00:00Z","permalink":"/p/","title":""}]