202212

## windows

powershell 提示没权限,先用管理员模式启动

set-ExecutionPolicy RemoteSigned

linux

无法用 key ssh 到远程主机

journalctl -fu ssh
    userauth_pubkey: key type ssh-rsa not in PubkeyAcceptedAlgorithms [preauth]

vi /etc/ssh/sshd_config.
    PubkeyAcceptedAlgorithms=+ssh-rsa

sudo systemctl restart sshd

LVM

pv lv vg 介绍

  • PV(physical volume) 即物理卷,就是物理磁盘,可以通过 fdisk -l 查看操作系统有几块硬盘
  • VG(volume group) 即卷组,就是一组物理磁盘的组合,里面可以有一块硬盘也可以有多块硬盘
  • LV(logical volume)及逻辑卷,就是在 VG (指定的物理磁盘组)里面划分出来的
  • 可以说成是 PV 就是硬盘,而 VG 就是管理硬盘的操作系统,而 LV 就是操作系统分出来的各个分区.
  • PV->VG->LV-> 文件系统使用(挂载到某个目录)
  • 硬盘或分区做成 pv,然后将 pv 或多个 pv 建立 vg,vg 上建立 lv

git 配置

git config --global http.proxy http://127.0.0.1:10800
git config --global https.proxy https://127.0.0.1:10800

git config --global --unset http.proxy
git config --global --unset https.proxy

git config --global url."https://".insteadOf git://

git config --list --show-origin

fio 磁盘性能测试工具
https://www.cnblogs.com/lyhabc/p/16708771.html

dd 命令来测试性能,有如下问题:

  • dd 命令的 IO 模型单一,只能测试顺序 IO,不能测试随机 IO。
  • dd 命令可设置的参数较少,并且测试结果不一定能反映出磁盘的真实性能。
  • dd 命令的设计初衷就不是用例测试性能的,在 dd 的手册中可以看到。
  • 无法设置队列深度,因此不推荐用 dd 命令来测试最大读 IOPS。

fio 测试模板

#read 顺序读 吞吐量
fio -ioengine=libaio -direct=1 -bs=4k -thread -rw=read -size=10G -nrfiles=1 -filename=fio_readputth_test.txt -name='fio read test' -iodepth=2 -runtime=120 -numjobs=4 -time_based=1 -allow_mounted_write=1 -group_reporting

#write 顺序写 吞吐量
fio -ioengine=libaio -direct=1 -bs=4k -thread -rw=write -size=10G -nrfiles=1 -filename=fio_writeputth_test.txt -name='fio write test' -iodepth=2 -runtime=120 -numjobs=4 -time_based=1 -allow_mounted_write=1 -group_reporting


#read 顺序读
fio -ioengine=libaio -direct=1 -bs=4k -thread -rw=read -size=2G -nrfiles=1 -filename=fio_read_test.txt -name='fio read test' -iodepth=4 -runtime=60 -numjobs=8 -time_based=1 -allow_mounted_write=1 -group_reporting

#write 顺序写
fio -ioengine=libaio -direct=1 -bs=4k -thread -rw=write -size=2G -nrfiles=1 -filename=fio_write_test.txt -name='fio write test' -iodepth=4 -runtime=60 -numjobs=8 -time_based=1 -allow_mounted_write=1 -group_reporting

#readwrite 顺序混合读写
fio -ioengine=libaio -direct=1 -bs=4k -thread -rw=readwrite -size=2G -nrfiles=1 -filename=fio_readwrite_test.txt -name='fio readwrite test' -iodepth=4 -runtime=60 -numjobs=8 -time_based=1 -allow_mounted_write=1 -group_reporting

#randread 随机读
fio -ioengine=libaio -direct=1 -bs=4k -thread -rw=randread -size=2G -nrfiles=1 -filename=fio_randread_test.txt -name='fio randread test' -iodepth=4 -runtime=60 -numjobs=8 -time_based=1 -allow_mounted_write=1 -group_reporting

#randwrite 随机写
fio -ioengine=libaio -direct=1 -bs=4k -thread -rw=randwrite -size=2G -nrfiles=1 -filename=fio_randwrite_test.txt -name='fio randwrite test' -iodepth=4 -runtime=60 -numjobs=8 -time_based=1 -allow_mounted_write=1 -group_reporting

#randrw 随机混合读写
fio -ioengine=libaio -direct=1 -bs=4k -thread -rw=randrw -size=2G -nrfiles=1 -filename=fio_randrw_test.txt -name='fio randrw test' -iodepth=4 -runtime=60 -numjobs=8 -time_based=1 -allow_mounted_write=1 -group_reporting

,对于小块io(以64k为界)只需要关注iops,平均时延(lat中的avg),大块io关注吞吐和平均时延(lat中的avg)即可

java

大白话讲解Spring的@bean注解
https://zhuanlan.zhihu.com/p/99870991

从广义上Spring注解可以分为两类:

  • 一类注解是用于注册 Bean,比如 @Component , @Repository , @ Controller , @Service , @Configration 这些注解就是用于注册 Bean,放进 IOC 容器中。
  • 一类注解是用于使用 Bean,比如 @Autowired , @Resource 注解,这些注解就是把屋子里的东西自己拿来用,如果你要拿,前提一定是屋子(IOC)里有的,不然就会报错。

Bean 注解

  • Spring 的 @Bean 注解用于告诉方法,产生一个 Bean 对象,然后这个 Bean 对象交给 Spring 管理。
    • 产生这个 Bean 对象的方法 Spring 只会调用一次,随后这个 Spring 将会将这个 Bean 对象放在自己的 IOC 容器中。
  • @Component , @Repository , @Controller , @Service 这些注解只局限于自己编写的类,
    • 而 @Bean 注解能把第三方库中的类实例加入 IOC 容器中并交给 spring 管理。
  • @Bean 注解的另一个好处就是能够动态获取一个 Bean 对象,能够根据环境不同得到不同的 Bean 对象。

Java随机生成RSA密钥对
https://blog.csdn.net/msq16021/article/details/123743361

SpringBoot Security 自定义登录页面
https://blog.csdn.net/weixin_42555971/article/details/127440094

基于数据库自定义UserDetailsService实现JWT认证
https://blog.csdn.net/lazy_LYF/article/details/127284982

单点登录SSO,JWT进行跨域身份验证,前端登录实现Coding在线(十一)
https://blog.csdn.net/wang121213145/article/details/123553741

SpringSecurity以及Oauth2(笔记)
https://blog.csdn.net/weixin_46949627/article/details/126698801

Spring MVC中redirect重定向3种方式(带参数)
https://blog.csdn.net/weixin_39973810/article/details/84847922

javascript

npm install 报错

  • git 挂代理:git config --global http.proxy http://127.0.0.1:10800
  • git 默认使用 http:git config --global url.“https://”.insteadOf git://
  • node-scss匹配的最高版本才nodjs 14,不能要最新版本的 nodejs
  • 跟linux还是windows没啥关系,linux也不行

其他

https://v2ex.com/t/901954 你们的 NAS 部署了什么有趣的服务?

  • 网盘:seafile,坚果云, dufs,filebrowser,baidunetdisk,timemachine,icloudpd,filebrowser
  • 文件同步:syncthing/nextcloud,etesync,icloudpd,samba
  • 照片:mt-photos,PhotoPrism,photoview
  • 内网穿透:cloudflared,frpc,tailscale
  • 内网组网:tailscale
  • 梯子:openclash,stashapp,subconverter,v2ray
  • 统一登录:authelia
  • 下载:aria2,aria2pro,qbittorrent
  • 搜索引擎:whoogle/searxng
  • 容器管理:portainer/watchtower
  • 密码管理:vaultwarden
  • 反代网关:traefik
  • git 仓库:gitea,Gogs
  • 网盘文件目录:alist
  • DNS:adguard-home,Adguard home DNS
  • 笔记博客:mastodon,outline,b3log/siyuan
  • 网站监控:uptime-kuma
  • RSS: rsshub,freshrss,ttrss
  • 智能家居:Home Assistant,doods2
  • 音视频:Jellyfin
  • 聊天:Snikket