發表文章

目前顯示的是 2022的文章

OpenSSL PFX to Key and Crt

PFX 轉換成 crt 與 key 檔  openssl pkcs12 -in [yourfilename.pfx] -clcerts -nokeys -out [certificatename.crt] openssl pkcs12 -in [yourfilename.pfx] -nocerts -out [keyfilename-encrypted.key]

Linux 排程crontab 排程工作

 查看 現有排程 crontab -l 查看指定 user排程 sudo crontab -u d -l MIN HOUR DOM MON DOW CMD # ┌───────────── 分鐘 (0 - 59) # │ ┌─────────── 小時 (0 - 23) # │ │ ┌───────── 日 (1 - 31) # │ │ │ ┌─────── 月 (1 - 12) # │ │ │ │ ┌───── 星期幾 (0 - 7,0 是週日,6 是週六,7 也是週日) # │ │ │ │ │ # * * * * * /path/to/command # 每天早上 8 點 30 分執行 30 08 * * * /home/d/script.sh --your --parameter # 每週日下午 6 點 30 分執行 30 18 * * 0 /home/d/script.sh --your --parameter # 每週日下午 6 點 30 分執行 30 18 * * Sun /home/d/script.sh --your --parameter # 每年 6 月 10 日早上 8 點 30 分執行 30 08 10 06 * /home/d/script.sh --your --parameter # 每月 1 日、15 日、29 日晚上 9 點 30 分各執行一次 30 21 1,15,29 * * /home/d/script.sh --your --parameter # 每隔 10 分鐘執行一次 */10 * * * * /home/d/script.sh --your --parameter # 從早上 9 點到下午 6 點,凡遇到整點就執行 00 09-18 * * * /home/d/script.sh --your --parameter 修改現有排程 crontab -e

linux 掛載網路磁碟機

確認是否有連線網路磁碟機 df -k 確認是否有正確掛載資訊 vi /etc/fstab 確認是否有正確掛載資訊 /dev/mapper/centos-swap swap                     swap     defaults         0 0 如沒有,請補上資訊如以下 範例∶ //IP/資料夾/GitLab /media/資料夾/ cifs username=帳號,password=密碼,gid=1000,uid=1000 0 0 確認正確掛載資訊後,重新mount所有磁碟機 mount -a

[MsSQL] 查詢所有table 語法

 SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE='BASE TABLE'

[iOS,XCode,Pod] 當Pod instal 發生錯誤

圖片
開啟專案時,pod instal 發生錯誤 [!] Automatically assigning platform `iOS` with version `11.0` on target `M2Test` because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`. 解決方法∶ 1 打開Podfile 2 移除第二行 #platform:ios, ‘9.0’ 中的# 3 打開終端機重新 pod install [!] Couldn't determine repo type for URL: `https://cdn.cocoapods.org/`: Permission bits for '/Users/D/.netrc' should be 0600, but are 644 解決方法∶ chmod 600 ~/.netrc

[MVC] 使用 Html.Raw 從Model 產出 JSON 字串

Checkmarx 弱點:Reflected XSS All Clients 該元素的值於程式流程中沒有被正確地過濾(Filter)或驗證,並最終顯示於使用者端方法DisplayDetails()這可能為跨站腳本(Cross-Site-Scripting)攻擊 一般在輸出網頁時內嵌 JSON 轉成 JavaScript <script> var DataItem = @Html.Raw(Newtonsoft.Json.JsonConvert.SerializeObject(Model.DataItem)); </script> 但如果model 裡有含html字串,會導致XSS 風險 宣告產出如下: <script> var DataItem = @Html.Raw( Newtonsoft.Json.JsonConvert.SerializeObject(Model.DataItem, new Newtonsoft.Json.JsonSerializerSettings { StringEscapeHandling = Newtonsoft.Json.StringEscapeHandling.EscapeHtml })); </script> JsonConvert.DefaultSettings = () => new JsonSerializerSettings { StringEscapeHandling = Newtonsoft.Json.StringEscapeHandling.EscapeHtml };

[linux]查看哪個資料夾使用量最高

  使用 du -h -x --max-depth=1   查看哪個資料夾使用量最高 du -h -x --max-depth=1 刪除檔案 rm filename rm abc.txt