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
| To be, or not to be, that is the question: | |
| Whether 'tis nobler in the mind to suffer | |
| The slings and arrows of outrageous fortune, | |
| Or to take arms against a sea of troubles | |
| And by opposing end them. To die—to sleep, | |
| No more; and by a sleep to say we end | |
| The heart-ache and the thousand natural shocks | |
| That flesh is heir to: 'tis a consummation | |
| Devoutly to be wish'd. To die, to sleep; | |
| To sleep, perchance to dream—ay, there's the rub: |
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
| """ | |
| 圖片模糊檢測程式 | |
| 目標:嚴格篩選出確定模糊的圖片進行刪除,寧可放過模糊,也不可錯殺清晰。 | |
| pip install opencv-python pandas numpy | |
| """ | |
| import cv2 | |
| import os | |
| import pandas as pd | |
| import numpy as np | |
| import time |
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
| def right_align_strings(str1, str2): | |
| # 找出兩個字串中較長的長度 | |
| max_length = max(len(str1), len(str2)) | |
| # 對兩個字串進行右對齊 | |
| aligned_str1 = str1.ljust(max_length) | |
| aligned_str2 = str2.ljust(max_length) | |
| return aligned_str1, aligned_str2 |
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
| # 1 | |
| for char in n1: | |
| n1Dic[char] = n1Dic.get(char, 0) + 1 | |
| # 2 | |
| for char in n1: | |
| if char in n1Dic: | |
| n1Dic[char] += 1 | |
| else: | |
| n1Dic[char] = 1 |
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 calendar | |
| def count_pills_consumed(): | |
| # 記錄A、B的總消耗 | |
| count_A = 0 | |
| count_B = 0 | |
| # 依照規則遍歷一年 | |
| for month in range(1, 13): # 1 到 12 月 | |
| days_in_month = calendar.monthrange(2023, month)[1] # 該月天數 |
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
| # 1. 計算工作集百分比 | |
| $CompObject = Get-WmiObject -Class WIN32_OperatingSystem | |
| $MemoryPercentage = ((($CompObject.TotalVisibleMemorySize - $CompObject.FreePhysicalMemory) * 100) / $CompObject.TotalVisibleMemorySize) | |
| Write-Host "Memory usage in Percentage: $MemoryPercentage" | |
| # 2. 計算工作集總量 (GB) | |
| # Get all processes | |
| $allProcesses = Get-WmiObject WIN32_PROCESS | |
| # Sum the WorkingSetSize of all processes | |
| $totalProcessMemoryBytes = ($allProcesses | Measure-Object -Property WorkingSetSize -Sum).Sum |
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
| #include <iostream> | |
| int main() { | |
| if (__cplusplus == 202002L) | |
| std::cout << "C++20\n"; | |
| else if (__cplusplus == 201703L) | |
| std::cout << "C++17\n"; | |
| else if (__cplusplus == 201402L) | |
| std::cout << "C++14\n"; | |
| else if (__cplusplus == 201103L) | |
| std::cout << "C++11\n"; |