快速搭建v2ray
0783c7a821e71906579a5c8fae0b5765f7d19a65d5d7adf1d9fc89456874fb3455c40e47f61bd48d511d56671fc1da43a8ba6f78a37f172ff0fbf689e775e003301fccd8ddbafdf8af7a71f509e13925429030910bd305a2580c64a122d97e636f145bfee4e731f923409fcee2baadd7d61aebace455ba05a26a4b7092d7fd7bbd8b4f63c008d3ab7cf3ee8f5c9248aeda77314997c4f1e54bdb7bacf5bb06276fe85ff46e22508b04a7ccb79c4e1c311558d0df848e74014e8c4a35afe9539cadba0ac6b17e4223266981aec29c37b8d0314bfc9590b658065b2bdfd4be300597255ff73e773f012fd77d959be43fc1d280c2edc8e6e1a49 ...
toSee
0783c7a821e71906579a5c8fae0b5765f7d19a65d5d7adf1d9fc89456874fb34f858a876b23a627e2727fe73d1bef0a9153a8fe8f680893be708c51b4e5c3cda6ad26904979e981dcd28750d599ea9765d2ef7ea6874f633d8d6d070435ad3abc7c93ad533f91f32ddd0908fe9f9e86e17400988b1a37f1eedf4d1f76e52b433f5e6ca2d48608c8446546ff4c7d19ef45cb419326e3cfb1a60f14825f2da50c557cc4e832097a2a96097223e78a6932011c025c7dd410571c90415ae15d199fd4a1dba44a75d9891f515852263b18e0a531131f5563b6716e394d6d7b84c471d70388a822b85a1e689e0405d57a5456ba8d56cfac28968e6b ...
toDo
0783c7a821e71906579a5c8fae0b5765f7d19a65d5d7adf1d9fc89456874fb345fd45bf6a59111d263a347903155debee7cf4fc37800f9d5814590dea63ef1bb41e2b6a18a5bab40295246dd893a49fad09f72ba83632a8a1bfd512dfa78fa84c8c9813e2006ea100c4895893d762f78100f35dbc90a40eae3d9a708c39d682e9b95cde37cef7fad0df21c46f0205d4fe550bd8f64ff35d4190ed200052fb825df5897f41b858b222c05814e03fcc0aff1148a7e34c407342108f3d4b4f4081a7fdeb1ff1d848b52158c1db1ba305c42d4dcff7b63636e83fb300cbb9390245b45ea6aacaf02dc5e55a9db196c9f0410022dfbc4a461aa1e8 ...
linux修改jar包文件
使用 jar tvf jar 名称 | grep 目标文件名 查询出目标文件在 war 包中的目录
使用 jar xvf jar 名称 目标文件名(copy 上面查出的全路径) 将目标文件及所在 war 包中的目录解压到当前路径
修改目标文件的内容,或者将要新的目标文件替换掉提取出来的目标文件
使用 jar uvf jar 名称 目标文件名(和步骤(2)中的目标文件名相同) 将新目标文件替换到 jar 包中
1、具体这里以 blog.jar 为例进行操作
1、首先,查找你需要修改的文件
jar tvf blog-0.0.1-SNAPSHOT.jar | grep _fragments.html
2、解压文件到当前目录(会是个文件夹,但是不用管文件夹的其他文件,只找我们要改的文件)
jar -xvf blog-0.0.1-SNAPSHOT.jar BOOT-INF/classes/templates/_fragments.html
3、如果你有替换的文件就直接替换,没有则修改你需要修改的部分
vim _fragments.htmlcp 文件 目标文件
4、将修改的新文件替换到 ja ...
部署java项目
将运行的 jar 错误日志信息输出到 log.file 文件中,然后(>&1)就是继续输出到标准输出(前面加的&,是为了让系统识别是标准输出),最后一个&,表示在后台运行。
nohup java -jar 包名.jar > log.file 2>&1 &[1] 669 #669表示运行的pid
查看端口,查看进程,关闭进程
以 8088 端口为例:
netstat -aon|findstr "8088"
最后一列是 pid。假设为 5544
然后根据 pid 查询相应进程
tasklist|findstr "5544"
第一列是程序名称,假设为 java.exe
最后关闭进程
taskkill /f /t /im java.exe
直接使用命令关闭进程可能关不了,那么可以在任务管理器中直接找到该进程关闭。
根据端口直接关闭进程
以 8088 端口为例:
netstat -aon|findstr "8088"
最后一列是 pid。假设为 5544
taskkill /pid 5544 -t -f
反向代理后端项目并配置跨域
后台服务占用端口为 9003,用本地的 9004 代理 9003 并且配置跨域
server{ listen 9004; ## nginx监听端口号 location / { proxy_pass http://127.0.0.1:9003; # 允许 所有头部 所有域 所有方法 add_header 'Access-Control-Allow-Origin' '*'; add_header 'Access-Control-Allow-Headers' '*'; add_header 'Access-Control-Allow-Methods' '*'; # OPTIONS 直接返回204 if ($request_method = 'OPTIONS') { ...
收藏
Nginx 一网打尽:动静分离、压缩、缓存、黑白名单、跨域、高可用、性能优化…https://mp.weixin.qq.com/s/YhFaKTg5ZbzM8mkhclUnvQ
解决单页面应用,刷新后出现404或者404的错误
在 location 里加上 try_files $uri $uri/ /index.html;
具体配置如下:
server { listen 81; server_name project_mall; #charset koi8-r; #access_log logs/host.access.log main; location / { root study/project_mall; index index.html index.htm; # 解决单页面应用刷新出现403或者404错误 try_files $uri $uri/ /index.html; }}
开启gzip配置
配置示例
server{ listen 9005; ## nginx监听端口号 #开启gzip gzip on; #vary header支持,该选项可以让前端的缓存服务器缓存经过gzip压缩的页面 gzip_vary on; #设置允许压缩的页面最小字节数,页面字节数从header头的Content-Length中获取,默认值是0,不管页面是多大都进行压缩,建议设置成大于1K,如果小于1K可能会越压越大 gzip_min_length 612k; #压缩缓冲区大小,表示申请4个单位为16K的内存作为压缩结果的流缓存,默认值是申请与原始数据大小相同的内存空间来存储gzip压缩结果 gzip_buffers 128 128k; #压缩比率,用来指定gzip压缩比, 1:压缩比最小,速度最快;9:压缩比最大,传输速度最快,但处理也最慢,也比较的消耗CPU资源 gzip_comp_level 9; #用来指定压缩的 ...
配置文件下载,开启文件浏览列表
文件存储配置文件
server { listen 80; location /app { alias /usr/local/webserver/nginx/app/; autoindex on; #下面这个配置开不开启效果是一样的 #我还没发现有什么用 #建议先不加。 #猜测的应用场景:在网页上文件浏览时点击图片要求下载而不是预览就要打开下面的配置 #default_type application/octet-stream; } }
alias 指定虚拟目录autoindex on;打开目录浏览功能
假设服务器 ip 为 192.168.10.234那么访问 192.168.10.234:80/app/cgjc.apk 就能直接下载文件那么访问 192.168.10.234:80/app/cgjc-test.apk 就能直接下载文件
访问 192.16 ...
部署前端项目
前端项目存储位置/usr/local/webserver/nginx/project/crtoms
配置 0(推荐)
server{ listen 9005; ## nginx监听端口号 location / { root project/crtoms; # project在ngxin目录下,和html同级 try_files $uri $uri/ /index.html; } # 前端代理 location /api/ { #api是同一请求后缀 proxy_pass http://192.168.10.235:8888/; #后台内网地址 }}
假设服务器 ip 为 192.168.10.234那么此时访问方式就是 http:192.168.10.234:9095/
配置 1
server{ listen 9005; ## nginx ...
在.gitignore中添加新的规则对已经被git管理了的文件不生效的解决办法
解决办法:清理下 git 缓存即可执行以下命令
#删除git缓存git rm -r --cached .git add .git commit -m 'update .gitignore'
github高级搜索
github 搜索自己想要的项目,并添加更加详细的描述github 上搜索的例子
in:name springboot forks:>4000 language:java stars:>4000 pushed:>2020-01-01
in:readme springboot mybatis forks:>4000 language:java stars:>4000 pushed:>2020-10-01
关键词
in:name xxx
in:description xxx
in:readme xxx
starts:>2000
fork:>3000
size:>=5000 注意:单位是k
pushed:>2020-01-01
language:xxx
user:xxx
搜索的方式可以组合,叠加,用空格分开条件
更多高级搜索
配置视频播放
前提:nginx 需要安装 mp4 模块假设服务器 ip 为 192.168.10.234
播放 mp4 视频server { listen 80; location /securityMp4 { alias /home/DevelopKit/FILE/securityFile/; mp4; mp4_buffer_size 1m; mp4_max_buffer_size 2000m; # mp4_limit_rate on; # mp4_limit_rate_after 30s; limit_rate 260k; limit_rate_after 3m; }}
假设存在文件/home/DevelopKit/FILE/securityFile/a.mp4那么访问 192.168.10.234:80/securit ...
存储zset的写法
ZSetOperations zSetOperations = redisTemplate.opsForZSet();Set<ZSetOperations.TypedTuple<Map<String, Double>>> tuples = new HashSet<>();int cycleNum = dataShowMapper.getTrackDynamicGeometryDataNum(csrwId, xb) / 10000 + 1;// 循环次数CountDownLatch countDownLanch = new CountDownLatch(cycleNum);ExecutorService executor = Executors.newFixedThreadPool(cycleNum > 4 ? 4 : cycleNum);for (int i = 0; i < cycleNum; i++) { int start = i * 10000; int num = 10000; executor.ex ...
Gitlab在服务器上的安装
阅前注意本文档对于 gitlab 仓库管理只适用于 http 协议。如需 ssh 协议。请自行百度生成和配置公钥和私钥
本文档适用于 linux 的发行版为 centos7。其他的发行版 ubuntu、debian 等请自行百度
整理 by:张雨晗 2020.7.20
参考博客 1
参考博客 2
参考博客 3
目录:[TOC]
1.安装过程1.下载 rpm 文件gitlab 的 rpm 包下载地址
ctrl+鼠标左键点击打开链接,下载最新的 rpm 包
2.上传 rpm 文件。注意:linux 的运营规范里明确规定了第三方软件包放在/opt/文件夹下可以使用第三方工具。注意:xftp 禁用
也可以使用 win 下的 cmd 命令
示例
scp -P 221 D:\download\gitlab-ce-14.0.4-ce.0.el7.x86_64.rpm root@123.123.122.138:/opt/
之后再输入访问的密码即可。
3.安装1.安装所需要的环境yum -y install policycoreutils-python
yum -y install openssh ...
批量删除特定前缀key
redis-cli --scan --pattern "ops-coffee-*" | xargs -L 2000 redis-cli del
其中 xargs -L 指令表示 xargs 一次读取的行数,也就是每次删除的 key 数量,一次读取太多 xargs 会报错
SpringBoot中使用Quartz执行任务对象(job)中无法注入bean的问题
一、问题描述SpringBoot 整合 Quartz 进行定时任务开发时,job 中注入业务 Service,使用 @Autowired 注解获取对象为 null ,执行时报空指针异常
二、分析Spring 容器可以管理 Bean,但是 Quartz 的 job 是自己管理的,job 无法被容器识别,即使在自定义的 job 上面加上@Component 注解,依然无效,原因是 job 对象在 spring 容器加载的时候,能够注入 bean,但是在调度时,job 对象会重新创建,此时就导致了已经注入的对象丢失,因此报空指针异常。
三、解决办法
3.1 采用自定义静态工具类的方式,创建 AppContextUtil 类,实现 ApplicationContextAware 接口,此工具类会在 spring 容器启动后,自动加载,使用其提供的 Bean 方法获取想要的 bean 即可,代码如下:
import lombok.extern.slf4j.Slf4j;import org.springframework.beans.BeansException;import org.spr ...