添加 drone
@ -1,2 +1,8 @@
|
|||||||
## 创建新项目或导入项目时总是自动使用IDEA自带的maven 通过以下设置可以更改默认使用的版本
|
## 创建新项目或导入项目时总是自动使用IDEA自带的maven 通过以下设置可以更改默认使用的版本
|
||||||
`File->New Projects Setup ->Settings for New Projects ->Build,Execution,Deployment->BuildTools->Maven->(Maven Home path,User settings,Local reposit)`
|
|
||||||
|
`File->New Projects Setup ->Settings for New Projects ->Build,Execution,Deployment->BuildTools->Maven->(Maven Home path,User settings,Local reposit)`
|
||||||
|
|
||||||
|
## 设置Git 版本控制文件状态颜色
|
||||||
|
|
||||||
|
`Setting->Version Control->File Status Colors`
|
||||||
|
|
||||||
|
210
devops/cicd/drone/drone-template.md
Normal file
@ -0,0 +1,210 @@
|
|||||||
|
**官方地址**
|
||||||
|
|
||||||
|
https://docs.drone.io
|
||||||
|
|
||||||
|
**官方触发方式文档**
|
||||||
|
|
||||||
|
https://docs.drone.io/pipeline/triggers/
|
||||||
|
|
||||||
|
- CICD .drone.yml 模板示例
|
||||||
|
|
||||||
|
```yml
|
||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
name: ds-cloud
|
||||||
|
|
||||||
|
#分支触发 https://docs.drone.io/pipeline/triggers/
|
||||||
|
trigger:
|
||||||
|
branch:
|
||||||
|
- dev
|
||||||
|
steps:
|
||||||
|
- name: build-jar # 流水线名称
|
||||||
|
image: maven:3.8.5-openjdk-17 # 定义创建容器的Docker镜像
|
||||||
|
volumes: # 将容器内目录挂载到宿主机,仓库需要开启Trusted设置
|
||||||
|
- name: maven-cache
|
||||||
|
path: /root/.m2 # 将maven下载依赖的目录挂载出来,防止重复下载
|
||||||
|
- name: maven-build
|
||||||
|
path: /mnt/app/build # 将应用打包好的Jar和执行脚本挂载出来
|
||||||
|
commands: # 定义在Docker容器中执行的shell命令
|
||||||
|
- mvn clean package -Ptest -DskipTests=true # 应用打包命
|
||||||
|
- cd docker
|
||||||
|
- sh copy.sh #复制文件到指定地址
|
||||||
|
- cd ../
|
||||||
|
- cp -r docker /mnt/app/build/
|
||||||
|
|
||||||
|
- name: build-docker
|
||||||
|
image: plugins/docker
|
||||||
|
volumes: # 将容器内目录挂载到宿主机,仓库需要开启Trusted设置
|
||||||
|
- name: maven-build
|
||||||
|
path: /mnt/app/build # 将应用打包好的Jar和执行脚本挂载出来
|
||||||
|
- name: docker
|
||||||
|
path: /var/run/docker.sock # 挂载宿主机的docker
|
||||||
|
- name: dockerc #挂载docker-compose 如果没有用到可以不挂载
|
||||||
|
path: /usr/local/bin/docker-compose
|
||||||
|
#settings:
|
||||||
|
# dockerfile: /mnt/app/build/Dockerfile
|
||||||
|
commands: # 通过定义好的脚本文件 停止当前容易并重新构建
|
||||||
|
- cd /mnt/app/build/docker
|
||||||
|
- chmod +x deploy.sh
|
||||||
|
- sh deploy.sh stop
|
||||||
|
- sh deploy.sh rm
|
||||||
|
- sh deploy.sh build
|
||||||
|
- sh deploy.sh modules
|
||||||
|
- docker ps
|
||||||
|
|
||||||
|
volumes: # 定义流水线挂载目录,用于共享数据
|
||||||
|
- name: maven-build
|
||||||
|
host:
|
||||||
|
path: /www/mnt/maven/build # 从宿主机中挂载的目录
|
||||||
|
- name: maven-cache
|
||||||
|
host:
|
||||||
|
path: /www/mnt/maven/cache
|
||||||
|
- name: docker
|
||||||
|
host:
|
||||||
|
path: /var/run/docker.sock
|
||||||
|
- name: dockerc
|
||||||
|
host:
|
||||||
|
path: /usr/local/bin/docker-compose
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
- copy 脚本文件
|
||||||
|
|
||||||
|
```sh
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# 复制项目的文件到对应docker路径,便于一键生成镜像。
|
||||||
|
usage() {
|
||||||
|
echo "Usage: sh copy.sh"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# copy jar
|
||||||
|
echo "begin copy ds-gateway "
|
||||||
|
cp ../ds-gateway/target/ds-gateway.jar ./ds/gateway/jar
|
||||||
|
|
||||||
|
echo "begin copy ds-miniapps "
|
||||||
|
cp ../ds-modules/ds-miniapps/ds-miniapps-service/target/ds-miniapps-service.jar ./ds/modules/miniapps/jar
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
- deploy 脚本文件
|
||||||
|
|
||||||
|
```shell
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# 使用说明,用来提示输入参数
|
||||||
|
usage() {
|
||||||
|
echo "Usage: sh 执行脚本.sh [port|base|modules|stop|rm|stopbase|rmbase]"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# 开启所需端口
|
||||||
|
port(){
|
||||||
|
# firewall-cmd --add-port=80/tcp --permanent
|
||||||
|
# firewall-cmd --add-port=8080/tcp --permanent
|
||||||
|
# service firewalld restart
|
||||||
|
echo "开启所需端口(未实现)"
|
||||||
|
}
|
||||||
|
|
||||||
|
# 启动基础环境(必须)
|
||||||
|
base(){
|
||||||
|
docker-compose up -d ds-nacos
|
||||||
|
}
|
||||||
|
# 停止基础环境
|
||||||
|
stopbase(){
|
||||||
|
docker-compose stop ds-nacos
|
||||||
|
}
|
||||||
|
# 删除基础环境
|
||||||
|
rmbase(){
|
||||||
|
docker-compose rm ds-nacos -f
|
||||||
|
}
|
||||||
|
|
||||||
|
# 启动程序模块(必须)
|
||||||
|
modules(){
|
||||||
|
docker-compose up -d ds-gateway ds-miniapps
|
||||||
|
}
|
||||||
|
|
||||||
|
# 关闭module环境/模块
|
||||||
|
stop(){
|
||||||
|
docker-compose stop ds-gateway ds-miniapps
|
||||||
|
}
|
||||||
|
|
||||||
|
# 删除module环境/模块
|
||||||
|
rm(){
|
||||||
|
docker-compose rm ds-gateway ds-miniapps -f
|
||||||
|
docker rmi docker-ds-gateway docker-ds-miniapps
|
||||||
|
}
|
||||||
|
|
||||||
|
build(){
|
||||||
|
docker-compose build ds-gateway ds-miniapps
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# 根据输入参数,选择执行对应方法,不输入则执行使用说明
|
||||||
|
case "$1" in
|
||||||
|
"port")
|
||||||
|
port
|
||||||
|
;;
|
||||||
|
"base")
|
||||||
|
base
|
||||||
|
;;
|
||||||
|
"modules")
|
||||||
|
modules
|
||||||
|
;;
|
||||||
|
"stop")
|
||||||
|
stop
|
||||||
|
;;
|
||||||
|
"rm")
|
||||||
|
rm
|
||||||
|
;;
|
||||||
|
"stopbase")
|
||||||
|
stopbase
|
||||||
|
;;
|
||||||
|
"rmbase")
|
||||||
|
rmbase
|
||||||
|
;;
|
||||||
|
"build")
|
||||||
|
build
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
usage
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
- docker-compose.yml
|
||||||
|
|
||||||
|
```yml
|
||||||
|
version: '3'
|
||||||
|
services:
|
||||||
|
ds-gateway:
|
||||||
|
container_name: ds-gateway
|
||||||
|
build:
|
||||||
|
context: ./ds/gateway
|
||||||
|
dockerfile: Dockerfile #指定Dockerfile文件 通过dockerfile文件进行构建
|
||||||
|
ports:
|
||||||
|
- "8080:8080"
|
||||||
|
networks:
|
||||||
|
- ds-network
|
||||||
|
ds-miniapps:
|
||||||
|
container_name: ds-miniapps
|
||||||
|
build:
|
||||||
|
context: ./ds/modules/miniapps
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
ports:
|
||||||
|
- "15101:15101"
|
||||||
|
networks:
|
||||||
|
- ds-network
|
||||||
|
networks:
|
||||||
|
ds-network:
|
||||||
|
external: true
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
|
183
git/gitbash/git各种删除.md
Normal file
@ -0,0 +1,183 @@
|
|||||||
|
记录一下GIT的各种删除操作,删除操作用的比较少,经常忘记,每次要用的时候都现搜
|
||||||
|
|
||||||
|
## 删除Git历史提交中的大文件
|
||||||
|
|
||||||
|
作者:阿斯蒂芬
|
||||||
|
链接:https://www.zhihu.com/question/54419234/answer/2538641471
|
||||||
|
来源:知乎
|
||||||
|
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
|
||||||
|
|
||||||
|
- 显示大文件路径与文件名
|
||||||
|
|
||||||
|
- - 以便分析文件类型, 后续通过适配符批量删除
|
||||||
|
|
||||||
|
- 追查大文件来源
|
||||||
|
|
||||||
|
- - 分析来自哪个branch哪个commit, 由谁提交
|
||||||
|
- 以便预防类似问题二次发生
|
||||||
|
|
||||||
|
### 1.显示当前最大的10个文件:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
git verify-pack -v .git/objects/pack/pack-*.idx | sort -k 3 -g | tail -10
|
||||||
|
```
|
||||||
|
|
||||||
|
会显示类似如下列表(共10行), 其中第一大段为文件的**ID**
|
||||||
|
|
||||||
|
**10d4c5bea321160601323af6464277f5c0000000** *blob 7367001 6000049 160008000*
|
||||||
|
|
||||||
|
**7d48cc9a0000000000abbd55aeda21207db1d4** *blob 7367000 6100048 160008924*
|
||||||
|
|
||||||
|
### 2. 根据ID 反查文件名(二选一)
|
||||||
|
|
||||||
|
#### 2.1 只需要文件名(简单场景)
|
||||||
|
|
||||||
|
```sh
|
||||||
|
git rev-list --objects --all |grep 10d4c5bea321160601323af6464277f5c0000000
|
||||||
|
```
|
||||||
|
|
||||||
|
#### 2.2 反查更详细的文件信息(多branch场景)
|
||||||
|
|
||||||
|
```sh
|
||||||
|
git whatchanged --all --find-object=10d4c5bea321160601323af6464277f5c0000000
|
||||||
|
```
|
||||||
|
|
||||||
|
输出将会包含以下信息:
|
||||||
|
|
||||||
|
- commit (branch)
|
||||||
|
- Author
|
||||||
|
- Date
|
||||||
|
- path and file name
|
||||||
|
|
||||||
|
### 3. 根据文件名在历史记录中批量删除
|
||||||
|
|
||||||
|
替换下列代码中的 path_to_file为希望删除的文件名, 支持*[通配符](https://www.zhihu.com/search?q=通配符&search_source=Entity&hybrid_search_source=Entity&hybrid_search_extra={"sourceType"%3A"answer"%2C"sourceId"%3A2538641471})
|
||||||
|
|
||||||
|
```sh
|
||||||
|
git filter-branch --force --index-filter 'git rm --cached --ignore-unmatch path_to_file' --prune-empty --tag-name-filter cat -- --all
|
||||||
|
```
|
||||||
|
|
||||||
|
举例:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
git filter-branch --force --index-filter 'git rm --cached --ignore-unmatch */*/*.png' --prune-empty --tag-name-filter cat -- --all
|
||||||
|
```
|
||||||
|
|
||||||
|
如果你的文件名包含空格, 则应交替使用单双引号:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
git filter-branch --force --index-filter \ "git rm --cached --ignore-unmatch 'src/file name with blank'"
|
||||||
|
```
|
||||||
|
|
||||||
|
注意: 只能删除当前所在branch的文件, 所以如果文件来自于另一个branch, 应先切换branch:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
git checkout that_branch
|
||||||
|
```
|
||||||
|
|
||||||
|
如果删除文件的所在分支已经不存在,可以通过查看日志恢复那个分支
|
||||||
|
|
||||||
|
```sh
|
||||||
|
#通过git reflog找到最后一次的提交记录
|
||||||
|
git reflog
|
||||||
|
#进行恢复 比如要恢复的分支名和提交记录id分别为dev-web-config 3c96c99
|
||||||
|
git checkout -b git checkout -b dev-web-config 3c96c99
|
||||||
|
```
|
||||||
|
|
||||||
|
#### 预期terminal输出:
|
||||||
|
|
||||||
|
少量文件成功被删除: *rm 'some-file.png'*
|
||||||
|
|
||||||
|
大量历史commit被重写: *Rewrite 7930b2dd7bff910000000000000000001a8cdf7014 (1512/1721) (41 seconds passed*
|
||||||
|
|
||||||
|
最终一些branch可能没有变化: *WARNING: Ref 'a_branch' is unchanged*
|
||||||
|
|
||||||
|
但是有些branch被改写了: *b_branch -> b_branch*
|
||||||
|
|
||||||
|
### 4. (可选项) 更新本地Git仓库
|
||||||
|
|
||||||
|
删除操作之后, 再用第2步的指令查询对应ID不会返回任何值, 表明文件已删除;
|
||||||
|
|
||||||
|
但用第1步的指令查询前10的大文件会发现列表并没有变化, 如需要查询经过上一步删除之后的新前10大文件, 则需要更新本地Git仓库
|
||||||
|
|
||||||
|
(ps. 也可以将第1步指令末尾改为20, 查看前20的大文件)
|
||||||
|
|
||||||
|
> 此时你会发现本地目录中的.git文件并不会马上就变小,而是与原来是一样的,
|
||||||
|
> 是因为Git仓库历史有个缓存期,如果不主动回收、清理仓库历史,一般的这些记录还会保存一段时间,以备你突然后悔了,没办法找回删掉的文件。
|
||||||
|
> 通过以下命令主动回收资源:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
rm -rf .git/refs/original/
|
||||||
|
git reflog expire --expire=now --all
|
||||||
|
git gc --prune=now
|
||||||
|
git gc --aggressive --prune=now
|
||||||
|
```
|
||||||
|
|
||||||
|
以上仓库更新代码, 合并至一行:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
rm -rf .git/refs/original/;git reflog expire --expire=now --all;git gc --prune=now;git gc --aggressive --prune=now
|
||||||
|
```
|
||||||
|
|
||||||
|
### 5. 更新到远程服务器
|
||||||
|
|
||||||
|
```sh
|
||||||
|
git push --force --all
|
||||||
|
```
|
||||||
|
|
||||||
|
> 如果出现提示remote: GitLab: You are not allowed to force push code to a protected branch on this project.
|
||||||
|
> 需要在[gitlab](https://www.zhihu.com/search?q=gitlab&search_source=Entity&hybrid_search_source=Entity&hybrid_search_extra={"sourceType"%3A"answer"%2C"sourceId"%3A2538641471})里面取消分支protected
|
||||||
|
|
||||||
|
在多人共同修改的分支上, 建议改用以下命令进行push, 以预防冲突
|
||||||
|
|
||||||
|
```sh
|
||||||
|
git push --force-with-lease
|
||||||
|
```
|
||||||
|
|
||||||
|
### 6.(可选项)在其他本地机器上进行强制更新
|
||||||
|
|
||||||
|
即如何进行force pull.
|
||||||
|
|
||||||
|
这里以master branch为例:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
git checkout master
|
||||||
|
git branch new-branch-to-save-current-commits
|
||||||
|
git fetch --all
|
||||||
|
git reset --hard origin/master
|
||||||
|
```
|
||||||
|
|
||||||
|
如果有删除远程分支操作:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
git branch -D <branch-name-to-delete>
|
||||||
|
git remote update origin --prune
|
||||||
|
```
|
||||||
|
|
||||||
|
### 删除因为.gitignore未设置忽略上传到远程仓库的文件
|
||||||
|
|
||||||
|
有些新项目可能没有设置好.gitignore导致上传一些文件到远程仓库,比如``.vscode`,`.idea`这种文件
|
||||||
|
|
||||||
|
一般处理方式我说三种:
|
||||||
|
|
||||||
|
#### 1.在仓库中添加一个.gitignore文件,可以忽略指定文件夹或文件,从而避免将.idea文件夹提交上去。在.gitignore文件中添加以下代码即可忽略.idea文件夹内容,(删除不掉已经上传到远程的)
|
||||||
|
|
||||||
|
```text
|
||||||
|
.idea/
|
||||||
|
```
|
||||||
|
|
||||||
|
#### 2.使用git filter-branch命令,将.idea文件夹从提交历史中删除。这个方法需要谨慎使用,因为它可以修改提交历史,可能会影响到其他人的工作。如果确定只有自己在使用该仓库,可以使用以下命令:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
git filter-branch --tree-filter 'rm -rf .idea' HEAD
|
||||||
|
```
|
||||||
|
|
||||||
|
#### 3.使用git rm命令,删除.idea文件夹,并将删除的操作提交到仓库中。这种方法简单易行,但是需要注意的是,需要先提交一个删除操作,才能生效。具体的步骤如下:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
git rm -r --cached .idea
|
||||||
|
git commit -m "remove .idea folder"
|
||||||
|
git push origin master
|
||||||
|
```
|
||||||
|
|
||||||
|
建议第一种和第二种配合使用
|
31
windows/系统异常/BltLocker.md
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
# BitLocker 驱动器加密
|
||||||
|
|
||||||
|
**关闭加密方法**
|
||||||
|
|
||||||
|
最近感觉系统分盘不太合适 决定调整一下驱动器存储空间大小,使用傲梅分区助手进行分区后发现 `E:`盘被加上了BitLocker锁
|
||||||
|
|
||||||
|
以管理员身份进入CMD,输入以下命令进行解密 其中`E:` 是要进行解密的盘符如果是其他盘被锁定则更换盘符后执行便可
|
||||||
|
|
||||||
|
```bash
|
||||||
|
#简略帮助命令
|
||||||
|
manage-bde -?
|
||||||
|
#查看驱动器状态
|
||||||
|
manage-bde -status
|
||||||
|
#关闭加密命令 关闭前需要先对驱动器解锁
|
||||||
|
manage-bde -off E:
|
||||||
|
```
|
||||||
|
|
||||||
|
**查找恢复密钥**
|
||||||
|
|
||||||
|
登录microsoft账号查看恢复密钥
|
||||||
|
|
||||||
|
https://account.microsoft.com/devices/recoverykey
|
||||||
|
|
||||||
|
**备份**
|
||||||
|
|
||||||
|
| 设备名称 | 密钥 ID | 恢复密钥 | 驱动器 | 密钥上传日期 |
|
||||||
|
| --------------- | -------- | ------------------------------------------------------- | ------ | ------------ |
|
||||||
|
| DESKTOP-KSV2JI8 | 1F5D1EA8 | 016544-589963-530200-055748-687632-076241-012397-156684 | FDV | 2022/2/13 |
|
||||||
|
| DESKTOP-KSV2JI8 | B515671E | 187561-490501-653180-482526-135069-343420-147642-138171 | OSV | 2022/2/13 |
|
||||||
|
| DS | ABE241EB | 226116-455631-466400-651211-413006-378884-256157-247357 | OSV | 2023/11/9 |
|
||||||
|
|
BIN
计算机/数据结构/assets/image-20231010214602780-16969455650701.png
Normal file
After Width: | Height: | Size: 621 KiB |
BIN
计算机/数据结构/assets/image-20231010214602780.png
Normal file
After Width: | Height: | Size: 621 KiB |
BIN
计算机/数据结构/assets/image-20231010214614892.png
Normal file
After Width: | Height: | Size: 912 KiB |
BIN
计算机/数据结构/assets/image-20231010214748182-16969456705053.png
Normal file
After Width: | Height: | Size: 270 KiB |
BIN
计算机/数据结构/assets/image-20231010214748182.png
Normal file
After Width: | Height: | Size: 270 KiB |
BIN
计算机/数据结构/assets/image-20231010214936469.png
Normal file
After Width: | Height: | Size: 308 KiB |
BIN
计算机/数据结构/assets/image-20231010215027946-16969458293928.png
Normal file
After Width: | Height: | Size: 244 KiB |
BIN
计算机/数据结构/assets/image-20231010215027946.png
Normal file
After Width: | Height: | Size: 244 KiB |
BIN
计算机/数据结构/assets/image-20231010215053315-169694585478710.png
Normal file
After Width: | Height: | Size: 397 KiB |
BIN
计算机/数据结构/assets/image-20231010215053315.png
Normal file
After Width: | Height: | Size: 397 KiB |
@ -66,8 +66,16 @@
|
|||||||
|
|
||||||
### 二叉树
|
### 二叉树
|
||||||
|
|
||||||
|
![image-20231010215053315](assets/image-20231010215053315-169694585478710.png)
|
||||||
|
|
||||||
|
![image-20231010215027946](assets/image-20231010215027946-16969458293928.png)
|
||||||
|
|
||||||
### 图
|
### 图
|
||||||
|
|
||||||
|
![image-20231010214602780](assets/image-20231010214602780-16969455650701.png)
|
||||||
|
|
||||||
|
![image-20231010214614892](assets/image-20231010214614892.png)
|
||||||
|
|
||||||
### 堆
|
### 堆
|
||||||
|
|
||||||
堆(heap)就是用数组实现的二叉树,它没有使用父指针或者子指针。
|
堆(heap)就是用数组实现的二叉树,它没有使用父指针或者子指针。
|
||||||
@ -390,6 +398,8 @@ public static void bubbleSort(int[] array){
|
|||||||
|
|
||||||
### 快速排序
|
### 快速排序
|
||||||
|
|
||||||
|
![image-20231010214748182](assets/image-20231010214748182-16969456705053.png)
|
||||||
|
|
||||||
## 查找算法
|
## 查找算法
|
||||||
|
|
||||||
### 线性查找
|
### 线性查找
|
||||||
|