Skip to content

Instantly share code, notes, and snippets.

View JonasGao's full-sized avatar
🙂
Cured ! Thanks God

Jonas Gao JonasGao

🙂
Cured ! Thanks God
  • Earth
  • Big Data
View GitHub Profile
@JonasGao
JonasGao / request_cert_and_deploy.sh
Created May 8, 2024 06:50
Call acme request cert, then deploy cert to remote server.
#!/bin/bash
set -e
DOMAIN_KEY="example.cn"
# 1. Request cert by acme.sh
# Copy cert and key files to acme_target directory after issued.
TARGET_PREFIX=$(date +%Y%m%d)
@JonasGao
JonasGao / ln-pki.sh
Last active May 8, 2024 06:05
Link pki for nginx from /etc/pki/nginx/xxxx/xxx.xx.xx/... to /etc/pki/nginx/xxx.xx.xx.xx
#!/bin/bash
# Directory structure
# ─ /etc/pki/nginx
# ├─ 20231204_3m
# │ └─ example.com
# │ ├─ chain
# │ └─ key
# ├─ example.com.cer --> 20231204_3m/example.com/chain
# └─ private
@JonasGao
JonasGao / docker-compose.yaml
Created May 2, 2024 03:31
Zookeeper development environment deploy on docker compose.
version: '3.1'
services:
zookeeper:
image: zookeeper:3.8.4-jre-17
restart: always
hostname: zoo1
ports:
- 2181:2181
deploy:
resources:
#!/bin/bash
rsync -avzh --progress --stats some_file_dir/ demo@127.0.0.1:/data/some_file_dir/
#!/bin/bash
ACTION=$1
TOMCAT_HOME=$2
STARTUP_SH="startup.sh"
STOP_SH="shutdown.sh"
PORTER=$(which tomcat-porter 2>/dev/null)
HEALTH_HTTP_CODE=(200 404 403 405)
APP_START_TIMEOUT=30
[ -z "$ACTION" ] && echo "ERROR: Not found argument 1" && exit 1
export RUSTUP_DIST_SERVER=https://mirrors.ustc.edu.cn/rust-static
cargo build --release
#!/bin/bash
[ -z "$1" ] && echo "Please provide a password" && exit 1
[ "${#1}" -lt 8 ] && echo "Password length must greater then 8" && exit 2
ADD_USER="<Please replace here>"
echo "Adding user $ADD_USER"
useradd $ADD_USER
echo "Succeed add user $ADD_USER"
echo -e "$1\n$1\n" | passwd --stdin $ADD_USER
echo "Changed $ADD_USER password"
#!/bin/bash
[ -z "$1" ] && echo "Please provide DEV" && exit 1
[ -z "$2" ] && echo "Please provide MTN" && exit 2
DEV=$1
MNT=$2
PAR="${DEV}1"
printf """Partition~
Will:
Init disk: \"$DEV\"
Create partition: \"$PAR\"
@JonasGao
JonasGao / log_rotate.sh
Created January 30, 2024 07:17
Rotate nginx log
#!/bin/bash
cd /usr/local/nginx/logs
PID=$(cat nginx.pid)
DATE=$(date +%Y%m%d)
LOG="access.log"
FILE="$LOG.$DATE"
GZ="${FILE}.gz"
echo "Working in $(pwd), PID: $PID"
[ -f $GZ ] && echo "\"$GZ\" already exists, skip." && exit 1
mv $LOG $FILE
@JonasGao
JonasGao / Gradlew.ps1
Created January 12, 2024 03:15
Download gradle with proxy example.
$env:JAVA_OPTS = "-Dhttps.proxyHost=127.0.0.1 -Dhttps.proxyPort=7890"
.\gradlew.bat