This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Dependency: password-less SSH login | |
# | |
# Define server array (easily extensible) | |
servers=( | |
"server-1" | |
"server-2" | |
"server-3" | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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)" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 目前只能在nightly版本下使用 | |
#![allow(incomplete_features)] | |
#![feature(generic_const_exprs)] | |
fn something<T>(val: T) | |
where | |
Assert<{ core::mem::size_of::<T>() < 768 }>: IsTrue, | |
// ^-----------------------------^ 这里是一个 const 表达式,换成其它的 const 表达式也可以 | |
{ | |
// |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
XML 6 mins ███████████████░░░░░░ 71.5% | |
Java 2 mins █████▉░░░░░░░░░░░░░░░ 28.4% |