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
# 建立 generate_ip_table.sh 腳本檔案 | |
cat << 'EOF' > generate_ip_table.sh | |
#!/bin/bash | |
# 這是一個用來從 DHCP 租約列表中查找 IP 地址的腳本 | |
# 定義輸入和輸出檔案的名稱,這樣更容易修改 | |
LEASE_FILE="dhcp_lease_list.txt" | |
MAC_FILE="MAC_TABLE.txt" | |
OUTPUT_FILE="IP_table.txt" |
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
import io | |
import re | |
# 1. 準備數據 | |
# DHCP 租約列表數據 | |
dhcp_lease_data = """ | |
Reading leases from /var/lib/dhcp/dhcpd.leases | |
Processing: 0% completeProcessing: 0% completeProcessing: 0% completeProcessing: 1% completeProcessing: 1% completeProcessing: 1% completeProcessing: 1% completeProcessing: 2% completeProcessing: 2% completeProcessing: 2% completeProcessing: 2% completeProcessing: 3% completeProcessing: 3% completeProcessing: 3% completeProcessing: 3% completeProcessing: 4% completeProcessing: 4% completeProcessing: 4% completeProcessing: 4% completeProcessing: 5% completeProcessing: 5% completeProcessing: 5% completeProcessing: 5% completeProcessing: 6% completeProcessing: 6% completeProcessing: 6% completeProcessing: 6% completeProcessing: 7% completeProcessing: 7% completeProcessing: 7% completeProcessing: 7% completeProcessing: 8% completeProcessing: 8% completeProcessing: 8% completeProcessing: 8% completeProcessing: 9% completeProcessing: 9% completeProcessing: 9% comple |
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
awk ' | |
# 處理第一個檔案 (dhcp_lease_list.txt) | |
FNR==NR { | |
# 只處理包含 ":" 的行 (過濾掉表頭和 "Processing" 行) | |
if ($1 ~ /:/) { | |
# 建立一個陣列,以 MAC (第一個欄位) 為索引,IP (第二個欄位) 為值 | |
leases[$1] = $2 | |
} | |
# 繼續讀取下一行,不要執行下面的程式碼區塊 | |
next |
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 | |
# --- 預設設定 --- | |
INPUT_FILE="IP_table.txt" | |
BMC_IP_COLUMN=3 | |
NAME_COLUMN=1 | |
REFRESH_INTERVAL=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 | |
# --- 設定區 --- | |
# (其他設定保持不變) | |
INPUT_FILE="IP_table.txt" | |
IP_COLUMN=2 | |
PASSWORD='你的遠端密碼' | |
REMOTE_USER="root" | |
# 遠端指令可以保持原樣,因為 -f 會處理背景化 | |
REMOTE_COMMAND="pkill -f ptat; nohup ./ptat -ct 4 -mt 3 -id > ptat.log 2>&1 &" # 這裡的 & 可有可無,因為-f會處理 |
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 | |
# --- 設定區 --- | |
# 要讀取的檔案名稱 | |
INPUT_FILE="IP_table.txt" | |
# 要使用的 IP 位在第幾個欄位 (column) | |
IP_COLUMN=2 | |
# 要傳送的本地檔案名稱 | |
SOURCE_FILE="stress_cpu.sh" |
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
import diff_match_patch | |
import re | |
from pathlib import Path | |
from typing import List, Tuple | |
# --- Configuration Variables (Text Colors) --- | |
TEXT1_DELETION_COLOR = "#ff0000" # Red | |
TEXT2_INSERTION_COLOR = "#008000" # Green | |
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
/* Firefox 72.0 */ | |
/* You need to modify about:config, set the option toolkit.legacyUserProfileCustomizations.stylesheets to True.*/ | |
/*@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); set default namespace to XUL */ | |
/* https://www.reddit.com/r/FirefoxCSS/comments/elczdc/correctly_hide_url_bar_in_firefox_720_using/fdiwmv7/?utm_source=share&utm_medium=web2x */ | |
#navigator-toolbox {z-index: 1;} | |
.tab-content[selected="true"] { | |
background: rgba(65, 85, 145, 0.4) !important; |
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
/* Firefox 70.0.1 */ | |
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); /* set default namespace to XUL */ | |
/* | |
#TabsToolbar { | |
visibility: collapse !important; | |
} | |
#titlebar-buttonbox{height: var(--tab-min-height) !important;} | |
#titlebar{ margin-bottom: calc(-2px - var(--tab-min-height) ) !important;} | |
*/ |
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
#!/usr/bin/python | |
# -*- coding:utf-8 -*- | |
""" | |
Compare MultiProcessing and Normal Way | |
Case:crawl 84 images in 81 plurk posts | |
(sec) | |
MultiProcessing : |
NewerOlder