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 cv2 | |
import numpy as np | |
import mss | |
from pynput import mouse, keyboard | |
import threading | |
import time | |
from datetime import datetime | |
import ctypes | |
import ctypes.wintypes | |
import re |
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
# 檢查是否已載入 ImportExcel 模組,若無則嘗試載入 | |
if (-not (Get-Module -Name ImportExcel -ListAvailable)) { | |
Write-Host "ImportExcel module not found. Please install it using: Install-Module -Name ImportExcel -Scope CurrentUser" | |
exit | |
} | |
Import-Module ImportExcel | |
# 動態獲取當前使用者的桌面路徑,確保腳本在不同環境下可移植 | |
$desktopPath = [System.Environment]::GetFolderPath("Desktop") | |
$reportPath = Join-Path $desktopPath "SystemReport_$(Get-Date -Format yyyyMMdd).xlsx" |
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
# PowerShell 腳本:監控 DHCP 服務並透過非 TLS SMTP 發送電子郵件通知 | |
# 適用於 Microsoft Server 2022,範圍 10.10.10.0/24 | |
# 參數設定 | |
$ComputerName = "YourDHCPServer" # DHCP 伺服器名稱或 IP,請替換為實際值 | |
$ScopeId = "10.10.10.0" # DHCP 範圍(Scope)ID | |
$UsageThreshold = 80 # IP 佔用率閾值(百分比) | |
$SmtpServer = "smtp.yourcompany.com" # SMTP 伺服器地址,請替換為實際值 | |
$SmtpPort = 25 # SMTP 埠(非 TLS,標準埠 25) | |
$FromEmail = "[email protected]" # 發件人郵件地址,請替換 |
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
# Set source and destination folders | |
$src = "D:\sourceFiles" | |
$dst = "D:\destinationDirectory" | |
# Set log directory | |
$logDir = "C:\Logs" | |
if (!(Test-Path $logDir)) { | |
New-Item -ItemType Directory -Path $logDir | Out-Null | |
} |
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/env python3 | |
# -*- coding: utf-8 -*- | |
""" | |
產生 Windows 常用指令清單的 CSV 檔案 | |
Author: ChatGPT | |
Date: 2025-04-13 | |
Description: | |
將常用的 Windows 指令及其功能輸出為 UTF-8 編碼的 CSV 檔案。 | |
""" |
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 socket | |
import subprocess | |
import concurrent.futures | |
import platform | |
import asyncio | |
import logging | |
import json | |
import re | |
import matplotlib.pyplot as plt | |
from scapy.all import ARP, Ether, srp, conf |
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
# 指定年份: .\archive_year.ps1 -Year "2024" | |
param ( | |
[string]$Year = (Get-Date -Format "yyyy") # 預設為當前年份 | |
) | |
# 定義來源資料夾路徑為當前目錄 | |
$sourcePath = "." | |
# 使用參數指定的年份或預設年份 |
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
#Requires AutoHotkey v2.0 | |
#NoTrayIcon | |
#WinActivateForce | |
; 檢查管理員權限 | |
if !A_IsAdmin { | |
Run '*RunAs "' A_ScriptFullPath '"' | |
ExitApp | |
} |
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
""" | |
MIDI Music Generation Pipeline | |
- Creates multi-instrument MIDI composition | |
- Exports to PDF sheet music using MuseScore | |
- Converts to audio WAV using FluidSynth | |
Requires: music21, MuseScore 4, FluidSynth, and GeneralUser GS SoundFont | |
""" | |
from music21 import * | |
import os |
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 socket | |
import subprocess | |
from datetime import datetime | |
from concurrent.futures import ThreadPoolExecutor | |
# 定義風險端口列表 | |
risky_ports = [21, 23, 139, 445, 3389, 6667, 1080, 8080] # 可根據需求調整 | |
# 獲取本機 IP 地址 | |
def get_local_ip(): |
NewerOlder