- 博客(124)
- 资源 (2)
- 收藏
- 关注

原创 vim 基本配置
cat >> ~/.vimrc << EOF" 设置字符set encoding=utf-8set termencoding=utf-8set formatoptions+=mMset fencs=utf-8,gbksyntax on " 自动语法高亮set cursorline " 突出显示当前行set ruler " 打开状态栏标尺(行,列)set incsearch " 输入搜索内容时就显示搜索结果EOF...
2021-09-01 18:01:53
210

原创 ssh 配置免密码登录
ssh 配置免密码登录1.生成公钥ssh-keygen -t rsa2.发送公钥# 用户@ipssh-copy-id ubuntu@10.51.4.3
2021-07-23 18:07:14
185

原创 Python pip临时指定源下载和永久修改下载源
Python pip临时指定源下载#阿里云pip install flask -i https://mirrors.aliyun.com/pypi/simple/#d
2020-04-10 17:13:06
2113

原创 Centos7-修改yum源和epel源为阿里云
Centos7-修改yum源为阿里云1-切换到yum源所在目录cd /etc/yum.repos.d2-将旧yum原备份mv CentOS-Base.repo CentOS-Base.repo.bak3-使用wget获取阿里云源(wget安装)wget http://mirrors.aliyun.com/repo/Centos-7.repo4-把阿里云源改名为原文件名mv C...
2019-10-25 15:04:58
454
原创 MAC M1芯片使用golang的mock打桩库gomonkey没有权限问题解决
MAC M1芯片使用golang的mock打桩库gomonkey没有权限问题解决。
2023-04-04 17:41:55
2561
7
原创 macbookpro 2021 各种软件设置中找不到麦克风权限问题
【代码】macbookpro 2021 各种软件设置中找不到麦克风权限问题。
2022-10-21 10:34:30
2079
1
原创 python 使用asyncio + requests 实现异步发送http请求, 并有序返回requests响应结果
python async+requests异步发送请求
2022-07-09 17:04:03
284
原创 Golang获取N个月前的时间戳
Golang获取N个月前的时间戳func GetBeforeMonthTime(t time.Time, beforeMonth int) int64 { y := t.Year() var m time.Month // 判断是否跨年 num := int(t.Month()) - beforeMonth if num < 1 { y = t.Year() - 1 m = time.Month(12 - (beforeMonth - int(t.Month()))) } els
2022-05-24 16:25:22
85
原创 Golang生成同时包含数字字母的随机字符串
package main import ( "fmt" "math/rand" "time" "regexp") // 随机生成指定位数的大写字母和数字的组合func GetRandomString(l int) string { str := "123456789ABCDEFGHIJKLMNPQRSTUVWXYZ" bytes := []byte(str) result := []byte{} r := rand.New(rand.NewSource(ti.
2022-05-18 18:08:02
990
原创 python 识别二维码/条形码
python 识别二维码/条形码1. 安装包pip install -y pillow -i https://mirrors.aliyun.com/pypi/simple/pip install -y pyzbar -i https://mirrors.aliyun.com/pypi/simple/2. 使用from PIL import Image# 如果导入报错,安装工具: apt install -y zbar-toolsfrom pyzbar.pyzbar import deco
2022-05-06 16:27:29
1689
原创 修改sudo过期时间
修改sudo过期时间# 修改配置文件sudo vim /etc/sudoers# 文件末尾增加,单位为分钟,设置为0则每次都需要密码Defaults env_reset, timestamp_timeout=1000000
2022-04-29 17:35:44
588
原创 MAC设置静态ip
MAC设置静态ip# 查看所有网卡networksetup -listallnetworkservicesEthernetUSB 10/100/1000 LANWi-FiThunderbolt Bridge# 设置静态ip 网卡名 静态ip 子网掩码 dns networksetup -setmanual "Ethernet" 172.24.111.214 255.255.255.0 17
2022-04-25 15:47:24
585
原创 Docker部署 apisix 并使用golang插件(自定义鉴权方式)
apisix 使用golang插件(自定义鉴权方式)1. 安装apisix1.1 下载部署文件(example目录)1.2 保存example目录,修改docker-compose.yaml2. 自定义golang插件2.1 下载插件2.2 修改插件2.3 编译插件(需要golang环境)3 使用golang自定义插件3.1 修改apisix配置文件3.2 修改apisix的启动文件(docker-compose.yml)3.3 重启程序3.4 创建路由,并指定插件4 结果测试
2022-03-05 16:35:35
3912
4
原创 Mongo 导出/导入某个db
Mongo 导出某个db# 用户名 admin 数据库名 platform 导出路径 /home/mongodump -u admin --authenticationDatabase admin -d platform -o /home/
2022-01-19 15:32:52
536
原创 mac定时备份某个目录,存放到新目录
mac定时备份某个目录,存放到新目录每天备份一次定时备份是个好习惯,方便误删除等操作找回数据1. 创建备份文件需要存放的目录,并创建备份脚本此处因为选择了百度网盘自动同步,所以先将目录压缩到用户目录下,然后移动到百度网盘同步的目录下,如果不需要则可以省略mkdir ~/auto_back# 按照当天时间创建备份文件cat >> ~/auto_back/back.sh << EOF#!/bin/bash# 备份文件名t=`date +%Y-%m-%d`.
2022-01-12 18:42:14
1306
1
原创 ubuntu18.04安装zsh+oh-my-zsh
ubuntu18.04安装zsh+oh-my-zsh1. 安装zsh,并修改默认shell为zsh# 安装curl, zshapt install curl zsh -y# 修改默认shell为zshchsh -s /bin/zsh2. 修改密码配置文件搜索bash, 替换为zshvim /etc/passwd3. 安装git和oh-my-zsh# 安装gitapt-get install git -y# 下载oh-my-zsh(码云)sh -c "$(curl -fsS
2022-01-05 17:39:31
558
1
原创 常用压缩解压缩命令
zip# 压缩# 压缩整个目录zip -r xxx.zip xxx/# 指定文件压缩zip -r xxx.zip 1.txt 2.txt 3.txt# 解压缩unzip xxx.ziptar# 压缩# 压缩整个目录tar -cvf xxx.tar xxx/tar -cvf xxx.tar 1.txt 2.txt 3.txt# 解压缩tar -xvf xxx.tar...
2021-12-24 15:29:49
344
原创 Docker 批量删除已停止容器
Docker 批量删除已停止容器docker ps -a|grep Exited|awk '{print $1}'
2021-12-23 18:27:28
504
原创 alpine镜像修改下载源
echo "<http://mirrors.aliyun.com/alpine/latest-stable/main/>" > /etc/apk/repositoriesapk update
2021-12-15 18:42:14
1604
原创 K8S配置docker私有化仓库地址
K8S配置docker私有化仓库地址场景: 需要从harbor私有仓库中pull镜像1. 一行命令直接创建secret# 修改中参数kubectl create secret docker-registry <secret名称> --namespace=idea --docker-server=<仓库地址> --docker-username=<账号> --docker-password=<密码># yaml中containers同级添
2021-12-13 17:10:03
1539
原创 K8S 通过configMap引用环境变量
K8S 通过configMap引用环境变量以nginx为例1. 创建configMapconf.yaml配置中新建两个环境变量ENV_1和ENV_NAMEapiVersion: v1kind: ConfigMapmetadata: name: nginx-confdata: ENV_1: "111.111.111.111" ENV_NAME: "test"kubectl apply -f conf.yaml2. 创建pod,批量引用环境变量nginx.yam
2021-12-08 16:16:47
3803
原创 shell脚本, 检测cpu异常程序,自动杀死该程序
shell脚本, 检测cpu异常程序,自动杀死该程序自定义间隔时间自定义统计次数自定义exclude_pid列表#!/bin/bashmax_usage=90 # cpu超过当前值后开始根据pid计数, 连续超过30秒则杀死进程pid=0count=0exclude_pid=(7263)while [ 0 == 0 ]dobase_data=`top -c -b | head -10`now_pid=`top -c -b | head -10 |awk -F ' '
2021-11-20 15:38:09
762
原创 Shell 使用if 判断 string float 与 int
Shell 使用if 判断 string float 与 int# 判断intmax_usage=90# 获取当前程序cpu最高的值now_cpu_usage=`top -c -b | head -10 |awk '{print $9}' |awk 'NR==8'`# 判断当前最高cpu值(字符串float)是否大于判断值(int)if [ `echo "$now_cpu_usage > $max_usage" |bc` -eq 1 ]then echo "1111111111"
2021-11-20 15:34:08
812
原创 Shell for in数组
Shell for in 数组exclude_pid=(7263 123 333)for i in ${exclude_pid[@]};do echo $i;done
2021-11-20 15:28:38
3776
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人