Ostatnio aktywne 9 months ago
此腳本用於快速檢視 Linux 系統的基本資訊,包括作業系統、CPU、記憶體、檔案描述符、網路設定、TCP 參數、連線追蹤與當前開啟的 TCP 連線狀況,方便系統管理與效能調校。
chmod +x system_info.sh
./system_info.sh > system_report.txt
timmy / 使用 psutil 監控系統資源
0 polubień
0 forków
1 plików
Ostatnio aktywne 9 months ago
| 1 | import psutil |
| 2 | |
| 3 | # 獲取 CPU 使用率 |
| 4 | cpu_usage = psutil.cpu_percent(interval=1) |
| 5 | print(f"CPU 使用率: {cpu_usage}%") |
| 6 | |
| 7 | # 獲取記憶體資訊 |
| 8 | memory_info = psutil.virtual_memory() |
| 9 | print(f"總記憶體: {memory_info.total / (1024**3):.2f} GB") |
| 10 | print(f"可用記憶體: {memory_info.available / (1024**3):.2f} GB") |
timmy / Wake on LAN (WOL)
0 polubień
0 forków
1 plików
Ostatnio aktywne 10 months ago
這段 Python 程式碼 用於 實現 Wake-on-LAN (WOL),它能透過 網路廣播 (UDP) 發送 Magic Packet,來喚醒遠端電腦(如伺服器或 NAS)。
| 1 | import socket |
| 2 | |
| 3 | |
| 4 | class WakeOnLan: |
| 5 | """ |
| 6 | WOL(Wake on LAN) |
| 7 | """ |
| 8 | |
| 9 | def __init__(self, macaddress): |
| 10 | try: |
timmy / 使用 arp-scan 掃描區域網路中的設備
0 polubień
0 forków
1 plików
Ostatnio aktywne 10 months ago
| 1 | #!/bin/bash |
| 2 | |
| 3 | # 定義預設的配置設定 |
| 4 | SHELL=/bin/sh |
| 5 | PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin |
| 6 | TZ='Asia/Taipei' |
| 7 | |
| 8 | # 將配置設定寫入環境變數 |
| 9 | export PATH |
| 10 | export LANG=en_US.UTF-8 |
timmy / Dnsmasq 設定與網路管理
0 polubień
0 forków
1 plików
Ostatnio aktywne 10 months ago
| 1 | bogus-priv # Block fake private IP responses |
| 2 | no-resolv # Ignore /etc/resolv.conf for upstream DNS |
| 3 | dns-forward-max=150 # Limit parallel DNS queries to 150 |
| 4 | clear-on-reload # Clear cache when dnsmasq reloads |
| 5 | domain-needed # Ignore queries without a domain name |
| 6 | no-negcache # Do not cache negative (non-existent) DNS responses |
| 7 | no-poll # Do not poll /etc/resolv.conf for changes |
| 8 | strict-order # Use upstream DNS servers in the order they are listed |
| 9 | |
| 10 | # AdGuard DNS 封鎖廣告和追蹤器。 |
Nowsze
Starsze