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 / proxy.sh
Created April 15, 2025 11:44
Pull target image save to private registry.
#!/bin/bash
# 用法1: proxy docker.io/library/caddy:2-alpine
# 用法2: proxy -c docker.io/library/caddy:2-alpine
# 用法3: proxy docker.io/library/caddy:2-alpine library/caddy:2-alpine
remove_domain=false
if [ "$1" = "-c" ]; then
remove_domain=true
shift
@JonasGao
JonasGao / fuck-apifox-font.js
Last active March 20, 2025 05:46
替换 Apifox 界面字体
const fs = require("fs");
const path = require("path");
const asar = require("asar");
const src = "../resources/app.asar";
const dest = "../resources/app_copy";
// if dest exists, remove it
if (fs.existsSync(dest)) {
fs.rmSync(dest, { recursive: true });
function FindProxyForURL(url, host) {
if (dnsDomainIs(host, ".jetbrains.com")
|| dnsDomainIs(host, ".gradle.org")
|| dnsDomainIs(host, ".githubusercontent.com")) {
return "PROXY 172.16.201.206:7890; DIRECT";
} else {
return "DIRECT";
}
}
#parse("equalsHelper.vm")
public boolean sameWith(##
#if ($settings.generateFinalParameters)
final ##
#end
$class.name $instanceBaseName){
return this == $instanceBaseName &&
#set($i = 0)
#foreach($field in $fields)
#if ($i > 0)
RedisSessionHandlerValve valve = new RedisSessionHandlerValve();
Pipeline pipeline = Mockito.mock(Pipeline.class);
Container container = Mockito.mock(Container.class);
Context context = Mockito.mock(Context.class);
Mockito.when(context.getParent()).thenReturn(container);
Mockito.when(context.getName()).thenReturn("/");
Mockito.when(context.getPipeline()).thenReturn(pipeline);
Mockito.when(container.getName()).thenReturn("Nice");
@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/ [email protected]:/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