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
@echo off | |
for /d /r . %%d in (__pycache__) do ( | |
echo Deleting %%d | |
rd /s /q "%%d" | |
) | |
pause |
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
```cmd | |
mklink python3.13.exe C:\Users\{user_name}\AppData\Local\Programs\Python\Python313\python.exe | |
``` |
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
Get-ChildItem -File -Filter "*.xlsx" | ForEach-Object { | |
$folderName = [System.IO.Path]::GetFileNameWithoutExtension($_.Name) | |
if (-not (Test-Path -Path $folderName)) { | |
New-Item -ItemType Directory -Name $folderName | |
} | |
} |
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 fnmatch | |
from pathlib import Path | |
def read_gitignore(gitignore_path): | |
ignore_patterns = [] | |
if gitignore_path.exists(): | |
with gitignore_path.open(encoding="utf-8") as f: | |
for line_text in f: | |
line = line_text.strip() |
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
/** | |
* 格式化字串或陣列,將其與後續參數結合。 | |
* | |
* @param {string|array} input - 要格式化的字串或陣列 | |
* @param {...*} values - 用於替換預留位置的字串的值 | |
* @returns {string} 格式化後的字串 | |
* @throws {Error} 如果 input 不是字串或陣列,將拋出錯誤 | |
* | |
* @example | |
* // 基本用法 |
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
$ipAddress = (Get-NetIPAddress -AddressFamily IPv4 -InterfaceAlias "乙太網路").IPAddress | |
Write-Host $ipAddress |
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 threading | |
def check_ssh(ip, port=22): | |
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
sock.settimeout(3) | |
try: | |
sock.connect((ip, port)) | |
sock.close() |
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
@echo off | |
SET st3Path=C:\Program Files\Sublime Text\sublime_text.exe | |
rem 移除原本的 | |
@reg delete "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text" /f | |
rem 為所有檔案類型新增 | |
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3" /t REG_SZ /v "" /d "Open with Sublime Text 3" /f | |
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3" /t REG_SZ /v "Icon" /d "%st3Path%,0" /f | |
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3\command" /t REG_SZ /v "" /d "%st3Path% \"%%1\"" /f | |
rem 為資料夾新增 | |
@reg add "HKEY_CLASSES_ROOT\Directory\shell\Open with Sublime Text 3" /t REG_SZ /v "" /d "Open with Sublime Text 3" /f |