Skip to content

Instantly share code, notes, and snippets.

View JasonkayZK's full-sized avatar
🏠
ただいま!❤️

Jasonkay JasonkayZK

🏠
ただいま!❤️
View GitHub Profile
@JasonkayZK
JasonkayZK / xcall
Created July 21, 2025 02:18
Call command between multiple servers.
#!/bin/bash
# Dependency: password-less SSH login
#
# Define server array (easily extensible)
servers=(
"server-1"
"server-2"
"server-3"
)
@JasonkayZK
JasonkayZK / xsync
Created July 21, 2025 02:15
Sync files between servers.
#!/bin/bash
# Dependency:
# 1. rsync: yum/apt install -y rsync
# 2. password-less SSH login
#
# 0. Define server list
servers=("server-1" "server-2" "server-3")
# 1. check param num
@JasonkayZK
JasonkayZK / notifyResult.sh
Created July 15, 2025 07:13
Send system notify on MacOS after execute command.
function notifyResult () {
if [ $? -eq 0 ]; then
osascript -e 'display notification "The command finished" with title "Success"'
else
osascript -e 'display notification "The command failed" with title "Failed"'
fi
}
@JasonkayZK
JasonkayZK / sys-notify.sh
Created July 15, 2025 07:04
一个可以发送系统通知的脚本。
#!/bin/bash
# 帮助函数
show_help() {
echo "Usage: $0 [Option] [message]"
echo "Show system notification"
echo
echo "Option:"
echo " -h, --help Show help info"
echo " -t, --title TITLE Set notification title (Default: Notify)"
@JasonkayZK
JasonkayZK / const_generic_mem_limit.rs
Created November 21, 2022 07:57
Rust code colloections
// 目前只能在nightly版本下使用
#![allow(incomplete_features)]
#![feature(generic_const_exprs)]
fn something<T>(val: T)
where
Assert<{ core::mem::size_of::<T>() < 768 }>: IsTrue,
// ^-----------------------------^ 这里是一个 const 表达式,换成其它的 const 表达式也可以
{
//
@JasonkayZK
JasonkayZK / k3s-helm-install.sh
Last active February 6, 2023 13:22
k3s-helm-install.sh
# Install K3S
curl -sfL https://get.k3s.io | sh -
# Copy k3s config
mkdir $HOME/.kube
sudo cp /etc/rancher/k3s/k3s.yaml $HOME/.kube/config
sudo chmod 644 $HOME/.kube/config
# Check K3S
kubectl get pods -n kube-system
@JasonkayZK
JasonkayZK / frequently-used-command.sh
Last active October 20, 2022 06:01
Show frequently-used command
# CentOS
history | awk '{CMD[$4]++;count++;}END { for (a in CMD)print CMD[a] " " CMD[a]/count*100 "% " a;}' | grep -v "./" | column -c3 -s " " -t | sort -nr | nl | head -n10
# Ubuntu
history | awk '{CMD[$2]++;count++;}END { for (a in CMD)print CMD[a] " " CMD[a]/count*100 "% " a;}' | grep -v "./" | column -c3 -s " " -t | sort -nr | nl | head -n10
# MacOS(zsh)
history | awk '{CMD[$2]++;count++;}END { for (a in CMD)print CMD[a] " " CMD[a]/count*100 "% " a;}' | grep -v "./" | column -c3 -s " " -t | sort -nr | nl | head -n10
@JasonkayZK
JasonkayZK / 📊 Weekly development breakdown
Last active September 4, 2025 01:00
🏊 Weekly development time
XML 6 mins ███████████████░░░░░░ 71.5%
Java 2 mins █████▉░░░░░░░░░░░░░░░ 28.4%