發表文章

PHP彷JWT打包產生需要的資料,把回傳回來的資料驗證解碼

執行: http://sandbox.onlinephpfunctions.com/code/8349c158d68cdf644dd07d802f3782384fb4e7b7 使用範例: 加密的密碼 $salt = '11223344'; // 需要傳遞的陣列 $codevalue_array = array(   'Amt' => '111',   'MerchantOrderNo' => 'ertgyhujioiuytre' ); // 打包產生需要的資料 $send_code = jwtenc($salt,$codevalue_array); var_dump($send_code); // 把回傳回來的資料驗證解碼 $codevalue = jwtdec($salt,$send_code); var_dump($codevalue);

JS 產生亂數(前2碼英文小寫,後6碼數字)

圖片
程式碼 RUN test: https://jsbin.com/moqusix/3/edit?html,js,output ref: https://www.w3schools.com/jsref/prop_html_innerhtml.asp https://github.com/mtchang/code/blob/master/myrandomstring.html

OpenCart2 的密碼編碼方式

OpenCart2 的密碼編碼方式

Web App Manifest

把 WEB APP 圖示放到桌面, 啟動時候有各轉場的動作。 這篇寫得很清楚 https://developer.mozilla.org/en-US/Apps/Progressive https://developers.google.com/web/updates/2014/11/Support-for-installable-web-apps-with-webapp-manifest-in-chrome-38-for-Android https://w3c.github.io/manifest/ 最常見的應用 https://makeappicon.com/webclip https://developer.apple.com/library/content/documentation/AppleApplications/Reference/SafariWebContent/ConfiguringWebApplications/ConfiguringWebApplications.html

Nginx Ip Whitelist (白名單快速轉成 nginx 使用的清單)

圖片
Nginx Ip Whitelist by pass whitelist ref: http://www.kitploit.com/2016/11/fireaway-next-generation-firewall-audit.html # 白名單設定方式可以參考 stackoverflow 這一篇 https://stackoverflow.com/questions/13917866/nginx-ip-whitelist # 中文可以參考這一篇 https://www.centos.bz/question/nginx-ip-whitelist/ 想把白名單快速轉成 nginx 使用的清單, 但是又不想寫太多程式。 所以直接用 google spreadsheets 轉成 csv 功能 透過 linux shell script 轉換成為 nginx 可以使用的清單 在實際工作動作: 客服人員:編輯 spreadsheets 檔案 系統人員:白名單轉成檔案驗證,並 reload nginx 生效. ## ---------------------------------------------------- ## linux script ## ---------------------------------------------------- #!/bin/bash # 編輯網址 , google doc 權限設定控制 # 將 google doc 白名單取出成為 csv URL="https://docs.google.com/spreadsheets/d/{請改成你的網址}/pub?gid=0&single=true&output=csv" echo "w3m -dump '${URL}' > whitelist.csv" | sh # 備份原本的白名單 mv -f customer_ip customer_ip.bak echo "# $(date -R) update." > customer_ip # 去除註解 grep -v '#' "whitel...

推力(Nudge):決定你的健康、財富與快樂

圖片
推力:決定你的健康、財富與快樂 此書的作者 http://www.books.com.tw/exep/prod/booksfile.php?item=0010445555 推力:決定你的健康、財富與快樂 Nudge: Improving Decisions About Health, Wealth, and Happiness 演講內容: 作者:Richard Thaler 在Google的演講 http://www.youtube.com/watch?v=Dz9K25ECIpU 泛科學有一篇寫得很清楚, 可以快速的了解這本書要傳達的概念。 http://pansci.asia/archives/69875 傳統的文字激勵法 荷蘭機場的蒼蠅便斗

Linux Performance 效能評估工具

圖片
這個文章說明了系統個連接點的效能評估工具與方式。 http://www.brendangregg.com/linuxperf.html netflix 工程師先透過 10 個工具在 60 秒告訴你,系統的效能摘要狀況... http://techblog.netflix.com/2015/11/linux-performance-analysis-in-60s.html 接下來要仔細的分析效能上面的問題,透過 Brendan’s Linux Performance Tools tutorial 的這一篇文章來解釋。 每個指令都是獨有專精的效能評估工具 例如 : perf https://perf.wiki.kernel.org/index.php/Main_Page 他是可以顯示CPU 上面資訊的計數器 及分析軟體、硬體的性能。 http://wiki.csie.ncku.edu.tw/embedded/perf-tutorial    成大資工WIKI 看起來就是折磨研究生的工具,但是工程師的好朋友。(泣...) 其他就慢慢研究,遇到再來使用了。