發表文章

整理:Windows 11的剪取工具(螢幕截圖)

Windows 11的剪取工具 剪取工具就是執行以前Win XP/7/8/10的螢幕擷取功能,只是在Windows 11上整合並強化的他的功能,還可以錄影。 剪取工具快捷鍵 Print Screen 啟動剪取工具,以前是擷取畫面複製到剪貼簿。 Window + Shift + s 啟動剪取工具,以前是啟動區域剪取功能。 Alt + Print Screen 僅擷取目前作用中的視窗並複製到剪貼簿。 Window + Print Screen 擷取全視窗畫面直接存到檔案中,畫面會整個黑一下。 如果你當下應用程式是整版視窗的系統管理員,怎麼按都不會有反應;這時請將整版視窗縮小視窗,或是與其他應用並排一下再按剪取工具快捷鍵。 新舊版本名稱 以Windows 11 25h2來說,現在的螢幕擷取工具叫做'剪取工具',它整合了就的螢幕剪取和剪取工具,但是也導致升級時出現許多問題,像是按下Print Screen後沒反應、選取螢幕區域後沒有儲存到資料夾等等。而在早期的如Windows 11 22h2系統,它預設的就只是'螢幕剪取'這個程式。 Windows 11舊: 螢幕剪取 Windows 11新: 剪取工具 新的應用程式是可以在Microsoft Store中搜尋的到,如果你在英文網站上搜尋要以'Snipping Tool'來找,而在中文網站上搜尋則是以'剪取與繪圖'來找。 下面這個網址進去可以看到'剪取工具'英文名 https://apps.microsoft.com/detail/9mz95kl8mr0l?hl=en-GB&gl=ZA 下面這個網址進去可以看到'剪取工具'中文名 https://apps.microsoft.com/detail/9mz95kl8mr0l?hl=zh-TW&gl=TW 只是這兩者是同一個應用程式,以2025/03/19可看到的應用程式資訊我寫在下面: 上次更新日期 2026/3/10 發行日期 2018/2/28 估計大小 311.2MB 版本號 11.2601.0.0 Store上寫的不是'剪取工具'為什麼我還要稱呼它為'剪取工具'? 因為你在系統中找該應用程式的時候,以及開始裡頭找的時候,它是叫做...

解決tar內檔案名稱亂碼問題ubuntu

會有亂碼問題就是與系統的語系有關,Ubuntu預設中文都是UTF-8,使用localctl可以查看目前系統設置。 $ localectl     System Locale: LANG=zh_TW.UTF-8 ....

pyhon用matplotlib畫圖範例與設定字體

Python使用matplotlib畫圖範例 import matplotlib.pyplot as plt import numpy as np import os import zipfile # UserWarning: Glyph 26371 (\N{CJK UNIFIED IDEOGRAPH-6703}) missing from font(s) DejaVu Sans. from matplotlib import font_manager font_path = "/usr/share/fonts/opentype/noto/NotoSerifCJK-Medium.ttc" # 修改為字體實際路徑 font_prop = font_manager.FontProperties( fname = font_path) plt.rcParams[ "font.family" ] = font_prop.get_name() # Chart 1: 全球市場規模成長趨勢(折線圖) years = [ 2020 , 2024 , 2030 ] values = [ 60 , 280 , 1800 ] # 單位:十億美元 plt.figure() plt.plot(years, values, marker = 'o' , linestyle = '-' , color = 'blue' ) plt.title( "全球 AI 市場規模成長(十億美元)" ) plt.xlabel( "年份" ) plt.ylabel( "市場規模" ) plt.grid( True ) plt.tight_layout() # Prepare folder for images img_dir = "./ai_charts" os.makedirs(img_dir, exist_ok = True ) plt.savefig( f " { img_dir } /01_market_growth.png" ) plt.close()   Python列出matpl...

BASH游標的快速移動與清除

BASH游標的快速移動與清除 左右移動,依照字元 (Character) 為單位 Ctrl+F 向後移動1個字元,等同→ Ctrl+B 向前移動1格字元,等同← 左右跳移動,依照字 (Word) 為單位 Alt+F 向後移動到字的第一個字元,等同 Ctrl+→ Alt+B 向前移動到字的第一個字元,等同 Ctrl+← 移動到頭尾 Ctrl+E 移動到最後,等同Home Ctrl+A 移動到最後,等同End 清除字元,這適合截斷URL Ctrl+K 從目前位置清除往後的所有字元。 Ctrl+U 從目前位置清除往前的所有字元。

React整合TinyMCE編輯器

TinyMCE編輯器 是一個提供在網頁使用的所見即所得文字編輯器,但是有免費提供的GPLv2釋出版本。 商用需要與註冊官方網站並取得授權金鑰,否則部屬到網站上,編輯內容會被遮擋無法使用。 整合方式官方 都已經整理好,照著作就行囉!

解決部屬到Firebase Hosting SSR遭遇的Credential問題Error: invalid_grant: Invalid grant: account not found

這幾天將Next.js原本遷徙到secret manager來管理,只是一旦部屬Firebase Hosting SSR,遭遇了Credential錯誤問題 Error: invalid_grant: Invalid grant: account not found 究竟該如何解決呢?

簡記:解決Firebase部屬Next.js使用pnpm的部屬失敗問題

在本機端檢查與建置都會成功,但是總是在傳到雲端(cloud build)後發生錯誤 索性就安裝這個錯誤訊息所指出的套件 pnpm install @opentelemetry/api@1.9.0 解決這個部屬問題... 拿這個問GPT它會說,這應該是只有使用pnpm時才會發生,因為firebase-tools只使用與npm操作的狀況 另外,每次pnpm run build建置都會顯示的warning也很煩 pnpm install -D esbuild 0.19.2 裝完會寫說有東西需要approve我就確認 pnpm approve-builds 空白鍵選擇 esbuild再按確認,完畢!

簡記:Node.js使用google sheet API讀取(新版google-auth&typescript)

 這裡是serviceaccount的json放在環境變數中,並googleapis套件操作google sheet api。 因為新版google auth套件有改版把fromJSON()和給廢掉,導致升級版本程式要調整,跟google&AI弄了弄,範例都給我奇怪的結果,這篇把這些整理起來 pnpm add googleapis import { google , sheets_v4 } from 'googleapis' ; async function main ( ... args : string []) { const credentials = JSON . parse (process. env . SHEET_CREDENTIALS ); const authClient = new google . auth . JWT ({ scopes : [ 'https://www.googleapis.com/auth/spreadsheets' ] }) authClient . fromJSON ( credentials ); const sheetAPIs = google . sheets ({ version : 'v4' , auth : authClient }); const res = await sheetAPIs . spreadsheets . get ({ spreadsheetId : process. env . SHEET_ID }); if ( ! res . ok ) throw Error(`http error code:${ res . status }`); console . log ( res . data ) } const args = process . argv . slice ( 2 ); main ( ... args ). catch ( console . error ); scopes上面是提供讀寫 如果只讀取,就改成 scopes: ['https://www.go...

簡記:在typescript中自定義環境變數內容

在原始碼最上層建立檔案 env.d.ts 寫入以下相關, 其他所需的變數請自行舉一反三增加 declare namespace NodeJS { interface ProcessEnv { /** * App 執行環境 * - development: 開發環境 * - production: 正式環境 * - test: 測試環境 */ NODE_ENV : 'development' | 'production' | 'test' ; /** 僅伺服器端 */ PRODUCT_SHEET_CREDENTIALS : string ; PRODUCT_SHEET_ID : string ; STORAGE_CREDENTIALS : string ; STORAGE_BUCKET_NAME : string ; /** 公開給前端 */ NEXT_PUBLIC_FIREBASE_SDK_CONFIGS : string ; NEXT_PUBLIC_API_URL : string ; } }  

簡記:node.js v20中設定typescript與.env

pnpm init pnpm add -D typescript @types/node src/index.ts async function main ( ... args : string []) { console . debug ( 'process.env.NODE_ENV=' , process . env . NODE_ENV ) console . debug ( 'process.env.STORAGE_BUCKET_NAME=' , process . env . STORAGE_BUCKET_NAME ) } const args = process . argv . slice ( 2 ); main ( ... args ). catch ( console . error ); package.json "type" : "commonjs" , "scripts" : { "build" : "tsc" , "dev" : "pnpm run build && node --env-file=.env.development.local ." , "start" : "pnpm run build && node --env-file=.env.production.local ." }, tsconfig.json "compilerOptions" : { "module" : "CommonJS" , "moduleResolution" : "Node" , "outDir" : "dist" , "rootDir" : "src" 這個設定的優點是import不需要寫.js, 缺點就是沒有top-...