新的 Github Profile 區塊
最近在 github 上發現一個功能,不確定是什麼時候開始有的 就是只要建立一個跟自己帳號同名的 repository 裡面 README.md 的內容就會顯示在 profile 上面 建立新的倉庫 輸入自己的帳號,github 會跟你說你發現了一秘密 ...
最近在 github 上發現一個功能,不確定是什麼時候開始有的 就是只要建立一個跟自己帳號同名的 repository 裡面 README.md 的內容就會顯示在 profile 上面 建立新的倉庫 輸入自己的帳號,github 會跟你說你發現了一秘密 ...
go 1.14 開始,go modules 可以在正式環境上使用了 你可能會建立自己私人的工具庫,這時要搭配 go modules 就需要做一些設定 基本的設定 假設現在要建立一個私有 module 倉庫,放在 gitlab.com/nyorc/module 1 2 mkdir module cd module 啟用 go module ...
Functional Programming 中文:函數式程式設計,是程式設計方法 (programming paradigm) 的其中一種 所謂的 Functional Programming 是以數學函數的概念來設計程式,並避免有狀態 (state) 與避免可變資料 (mutable data) 以下是一些 Functional Programming 的特點 ...
Manifesto Software Craftsmanship As aspiring Software Craftsmen we are raising the bar of professional software development by practicing it and helping others learn the craft. Through this work we have come to value: Not only working software, but also well-crafted software Not only responding to change, but also steadily adding value Not only individuals and interactions, but also a community of professionals Not only customer collaboration, but also productive partnerships ...
想要評估一份程式碼是不是好的設計,不會是比較資深的工程師說了就算數 其中一個方法就是從內聚跟耦合的程度來評估 Cohesion (內聚) 一個模組內的不同功能的相關程度 ...
最近在 code review 時,看到不少讓人頭暈的程式碼 在討論如何寫出更好的程式碼之外,應該要回顧幾個軟體開發原則,避免自己走歪路 DRY wiki: https://en.wikipedia.org/wiki/Don%27t_repeat_yourself 原文: Don't repeat yourself,如同字面上的意思,不要重複你的程式碼。 ...
把 user 設定成 sudoer 的方式 直接修改 /etc/sudoers 最暴力的作法,不小心打錯字就 game over 透過 visudo 指令去修改 visudo 會幫忙檢查有沒有打錯字 增加檔案到 /etc/sudoers.d/ 裡面 不會改動 /etc/sudoers 使用 ansible 的選擇 使用 ansible 來增加 sudo 權限時,我們只要在 /etc/sudoers.d/ 裡面增加有設定 sudoer 的檔案就好 ...
介紹 命名由來:小說 Ender’s Game (安德的遊戲 or 戰爭遊戲) 官網上的 slogan Automation for everyone 一個自動化工具,幫你完成組態管理、程式部署等工作 實現 Infrastructure as code (IaC) 其他類似的工具: Puppet, SaltStack, Chef, Terraform 優點: ...
server 需要經由跳板登入時有幾種做法 ssh tunnel ProxyCommand ProxyJump 這邊介紹 ProxyJump 的用法,算是目前最方便的方法 支援 ProxyJump 的是從 OpenSSH 7.3 開始,在 August 2016 released (http://www.openssh.com/txt/release-7.3) ssh 指令加上 -J 參數 經由 jump.host 登入 dist.host 1 $ ssh -J jump.host dist.host 需要打上 username port 的話,一樣的用法 ...
發現了使用 GPU 的 terminal emulator https://github.com/alacritty/alacritty https://sw.kovidgoyal.net/kitty/ 我目前幾乎所有的工作都在 terminal 上處理,無法接太慢的 terminal 程式 兩個都試用了一下,決定先以 alacritty 當主力試試 特色: 目前最快的 terminal emulator 使用 GPU 支援 Linux, BSD, macOS, Windows rust 開發 安裝 Debian / Ubuntu 1 $ apt install alacritty macOS 1 $ brew cask install alacritty 設定 把 alacritty.yml 放到以下的其中的一個位置就可以生效 ...
指令說明: http://httpd.apache.org/docs/current/programs/ab.html 安裝 debian 1 sudo apt-get install apache2-utils centos 1 yum install httpd-tools 執行結果 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 $ ab -n 100 -c 10 https://google.com/ This is ApacheBench, Version 2.3 <$Revision: 1826891 $> Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Licensed to The Apache Software Foundation, http://www.apache.org/ Benchmarking google.com (be patient).....done Server Software: gws Server Hostname: google.com Server Port: 443 SSL/TLS Protocol: TLSv1.2,ECDHE-ECDSA-CHACHA20-POLY1305,256,256 TLS Server Name: google.com Document Path: / Document Length: 220 bytes Concurrency Level: 10 Time taken for tests: 0.981 seconds Complete requests: 100 Failed requests: 0 Non-2xx responses: 100 Total transferred: 71000 bytes HTML transferred: 22000 bytes Requests per second: 101.95 [#/sec] (mean) Time per request: 98.091 [ms] (mean) Time per request: 9.809 [ms] (mean, across all concurrent requests) Transfer rate: 70.69 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 41 63 12.2 62 109 Processing: 16 24 9.0 21 56 Waiting: 15 24 8.7 21 56 Total: 64 87 17.8 83 150 Percentage of the requests served within a certain time (ms) 50% 83 66% 87 75% 91 80% 94 90% 107 95% 138 98% 150 99% 150 100% 150 (longest request) 說明 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 Concurrency Level (併發數量) Time taken for tests (本次壓力測試所花費的總秒數) Complete requests (完成的請求數) Failed requests (失敗的請求數) Total transferred (本次測試的總傳輸量) HTML transferred (本次測試的 HTML 傳輸量) Requests per second (每秒回應多少請求) (平均值) Time per request (每個請求所花費的時間) (ms) (平均值) Time per request (每個請求所花費的時間,所有同時連線數的平均值) (ms) (平均值) Transfer rate (傳輸速率) Connection Times min 最小值 mean[+/-sd] 平均值[標準差] median 中位數 max 最大值 Connect 建立 TCP 連線的時間花費 Processing 建立 TCP 連線後,Server 處理請求的時間花費 Waiting 發出請求到接到第一個 Byte 的等待時間 Total 總花費時間 (Connect + Processing) 常用組合 100 個請求量,10 個併發 ...
Swagger 官網: https://swagger.io/ 什麼是 Swagger Swagger 提供了一個規格來描述 API 長什麼樣子。 有了統一的規格,延伸出一系統的工具來輔助開發 API。 目前最新的 Spec 是 OAS (OpenAPI Specification) 3.0: https://swagger.io/specification/ 開源工具 Swagger 團隊身有開源三種工具 Swagger Codegen 產生程式碼,生成假 server, client sdk https://github.com/swagger-api/swagger-codegen Swagger Editor 編輯器,有語法檢查,同步產生文件頁面 https://github.com/swagger-api/swagger-editor Live Demo: https://editor.swagger.io/ 用 Docker 執行 ...
在軟體資訊領域,要不停的更新資訊。日常生活中也有著不少的事情要處理。 寫筆記成為健忘的我不可少的重要工具。 不停的摸索,參考 GTD 等方法,拜讀電腦玩物等部落格。 ...
在 Linux 的 Shell 環境中,要查看 PATH 變數時,通常都是 echo $PATH 當 PATH variable 中包含太多資料夾時,跟本看不懂 改以清單的方式顯示 PATH 內容 1 2 3 4 5 6 7 $ echo $PATH | tr ":" "\n" /usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /sbin /bin 1 echo "${PATH//:/$'\n'}" 1 echo -e "${PATH//:/\n}" 直接用 echo 的方式好像會因 echo 的版本而有差異 ...
Debian 的套件庫中只有 Firefox-ESR,跟 Firefox 官網的版本有點差距 想要使用最新的 Firefox 就是,直接從官網下載安裝!!! 下載 1 2 $ tar xvf firefox-72.0.2.tar.bz2 $ sudo mv firefox /opt 建立 firefox.desktop 1 $ sudo vi /usr/share/applications/firefox-stable.desktop 1 2 3 4 5 6 7 8 9 10 [Desktop Entry] Name=Firefox Stable Comment=Web Browser Exec=/opt/firefox/firefox %u Terminal=false Type=Application Icon=/opt/firefox/browser/chrome/icons/default/default128.png Categories=Network;WebBrowser; MimeType=text/html;text/xml;application/xhtml+xml;application/xml;application/vnd.mozilla.xul+xml;application/rss+xml;application/rdf+xml;image/gif;image/jpeg;image/png;x-scheme-handler/http;x-scheme-handler/https; StartupNotify=true 然後享用 Firefox ...
公司裡有一台 gitlab server,但是沒有人在更新,也沒有安裝 CI。 一開始使用覺得沒什麼差,經過沒幾天當我想要試試 CI/CD 時, 突然覺得沒有 CI/CD 的 Gitlab 跟本是個廢物。 ...
團隊在合作開發程式時,一定少不了 git 這個重要的工具,怎麼有效的使用 git 常常是一大課題。 這邊整理一下目前常見的幾種 git 分支管理策略。 Git flow 出處: https://nvie.com/posts/a-successful-git-branching-model/ 分支策略: ...
用 redis-cli 組合一個清除的指令 1 $ redis-cli --scan --pattern users:* | xargs redis-cli unlink 用 scan 找出要刪的 key 透過 xargs 傳給 unlink 刪掉 key KEYS vs SCAN 一樣都會掃過所有的 key,scan 不會阻塞整個 server,而是迭代的收集結果 ...
最近有機會寫一下 Python 就順便來改造一下 vim Autocompletion https://github.com/davidhalter/jedi https://github.com/deoplete-plugins/deoplete-jedi jedi 這個 library 提供編輯器對 python 程式碼的 autocompletion 跟 goto 的功能 我的 vim 是使用 deoplete 這套 autocompletion 工具,則是使用 deoplete-jedi 安裝 1 $ pip install jedi vimrc 使用 Plug 或其他 vim 套件管理安裝 ...
最近要在偶然拿到手的 EC2 instance 上安裝 docker,卻意外的無法照著官網的說明安裝! 原來是我拿到的 instance 是裝 Amazon Linux 2 這個 AWS 的特別版 OS 沒辦法直接使用一般的 yum 去安裝 ...