Merge branch 'master' of github.com:aborn/CodeSnippet

This commit is contained in:
Aborn Jiang 2023-08-19 17:04:50 +08:00
commit 17791df6ec
9 changed files with 80 additions and 1 deletions

View File

@ -26,6 +26,7 @@ git commit -m "Initial commit"
## 删除远程分支
git push origin :<branch_name> # v1.5+
git push origin --delete <branch_name> # v1.7+
git branch --delete dev # 删除本地分支
## 与远端关联
git remote add origin <remote-git-url>

View File

@ -1,5 +1,14 @@
#!/bin/sh
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
DIR="$( cd "$( dirname "$0" )" && pwd )"
CURRENT_DIR=`pwd`
echo "script dir $SCRIPT_DIR"
echo "dir $DIR"
echo "CURRENT_DIR $CURRENT_DIR"
cd $DIR
echo "CURRENT_DIR `pwd`"
echo "parameter $#"
echo "$1"

View File

@ -1 +1,27 @@
# docker 常用命令
# https://docs.docker.com/engine/reference/run/
# 创建用户自定义网桥
docker network create codepulse_net
# 将容器加入网桥
docker network connect codepulse_net codepulse_h5
# 查看自定义bridge网桥信息
docker network inspect b3e2fa1b291b
# 进入命令行界面
docker exec -it codepulse_h5 /bin/bash
# 镜像列表
docker image ls
# 删除镜像
docker image rm 61e8c95ada51
# 容器列表
docker container ls -a
# 删除容器
docker container rm

View File

@ -1,6 +1,9 @@
#!/usr/bin/env bash
# 常用操作命令
############################################
# 查看系统信息
uname -a
# grep的或操作查看当前打开的网络链接
lsof -i | grep -E "(LISTEN|ESTABLISHED)"
@ -16,12 +19,15 @@ mvn dependency:tree
# 手动安装jar包到本地
mvn install:install-file -Dfile=/Users/aborn/Downloads/joda-time-2.9.6.jar -DgroupId=joda-time -DartifactId=joda-time -Dversion=2.9.6 -Dpackaging=jar -DgeneratePom=true
# 检查网络端口监听也可以用(linux only)
# 检查网络端口监听也可以用(linux only), mac使用 lsof
sudo netstat -tupln
# mac下查看端口号占用情况如以下查看端口号20881被占用情况
# https://stackoverflow.com/questions/4421633/who-is-listening-on-a-given-tcp-port-on-mac-os-x
sudo lsof -nP -i:20881
sudo lsof -i -P | grep LISTEN
# 具体端口
sudo lsof -i -P | grep LISTEN | grep :$PORT
# grep查找递归查找关键字 Redis
grep -r "Redis" .
@ -120,3 +126,6 @@ cargo install bat
# 列出当前源&切换源
nrm ls
nrm use
## 软连接,将/opt目录下软件连接到/usr下
ln -s /opt/homebrew/bin/ispell /usr/local/bin/ispell

View File

@ -2,3 +2,7 @@
## 干掉java进程
sudo kill -9 `ps -ef |grep java|grep -v grep |awk '{print $2}'`
## 干掉端口号为 xx的 java程序
# sudo kill -9 `lsof -nP -i:8060 |grep java|awk '{print $2}'`

6
shell/powershell.sh Normal file
View File

@ -0,0 +1,6 @@
# 查看端口占用情况
netstat -ano
netstat -aon|findstr "2008"
# 查看指定 PID 的进程
tasklist|findstr "8912"

10
shell/reboot-hui.sh Executable file
View File

@ -0,0 +1,10 @@
#!/bin/sh
## 干掉端口号为 xx的 java程序
# sudo kill -9 `lsof -nP -i:8060 |grep java|awk '{print $2}'`
sudo kill -9 `lsof -nP -i:8010 |grep java|awk '{print $2}'`
sudo kill -9 `lsof -nP -i:8081 |grep java|awk '{print $2}'`
sudo kill -9 `lsof -nP -i:8082 |grep java|awk '{print $2}'`
sudo kill -9 `lsof -nP -i:8086 |grep java|awk '{print $2}'`
sudo kill -9 `lsof -nP -i:8088 |grep java|awk '{print $2}'`

6
shell/run-nacos.sh Executable file
View File

@ -0,0 +1,6 @@
#!/bin/sh
# 启动 nacos
cd /Users/aborn/software/nacos/bin
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_351.jdk/Contents/Home
sh startup.sh -m standalone

View File

@ -21,8 +21,16 @@ insert into temp values("gr", 108333, "goooogle");
# 查询表中某个字段(eleName)是否重复行
select * from <table-name> where a="avalue" group by `eleName` having count(eleName)<>1
# 按app进行分组统计金额
SELECT app as , sum(total_amount) as FROM order WHERE uid=2216620 and state='PAYED' GROUP BY app;
# 查询某个字段不重复的记录
select distinct domainKey from MetaInfo;
# 修改字段长度 (修改表user中字段name的长度为50)
alter table user modify column name varchar(50);
# 更新字段为null的值为新值
update mp_markdown_meta set post_time='1970-01-01 00:00:00' where isnull(post_time) ;