Skip to content

Instantly share code, notes, and snippets.

View mydansun's full-sized avatar
🎃
Working

Daniel Sun mydansun

🎃
Working
View GitHub Profile
@mydansun
mydansun / run_cpu.sh
Created April 28, 2024 09:10
Run CPU test
#!/bin/bash
# Get CPU usage
# Use the top command in batch mode to run once, take the first line, use awk to get the 8th column (idle value),
# then subtract it from 100 to get the CPU usage percentage.
CPU_USAGE=$(top -bn1 | grep "Cpu(s)" | sed "s/.*, *\([0-9.]*\)%* id.*/\1/" | awk '{print 100 - $1}')
CPU_USAGE=${CPU_USAGE%.*}
# Check if the CPU usage is less than 20%
if [ "$CPU_USAGE" -lt 20 ]; then
@mydansun
mydansun / rules.v4
Last active March 31, 2023 16:21
fxxk oracle cloud iptables
# Generated by iptables-save v1.8.7 on Fri Mar 31 15:15:21 2023
*filter
:INPUT ACCEPT [86:13330]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [81:57555]
:InstanceServices - [0:0]
COMMIT
# Completed on Fri Mar 31 15:15:21 2023
@mydansun
mydansun / ZhConversion.php
Created April 27, 2020 03:06
MediaWiki的繁简转换字典
<?php
/**
* Simplified / Traditional Chinese conversion tables
*
* Automatically generated using code and data in maintenance/language/zhtable/
* Do not modify directly!
*
* @file
*/