2019年7月18日 星期四

壓縮 disk image的好工具--pishrink

玩pi的朋友應該多少有點經驗--dd了整張sd的image,結果找不到同樣大小的sd卡restore回去
(明明號稱16G,有的就是只有15.5,有的就是15.9)
總不能每次都多買同型的卡幾張備用吧
最好是能shrink一下,這樣放在其他大媒體區也比較好收藏
這時候就要用pishrink工具了
詳細請參考這裡
經驗之談:
第一:我是在Ubuntu中安裝的,要做這動作的話,就要把img檔從其他網路資料夾中複製過來才能作業(既然是copy past,就真的要等ubuntu copy完才行)
第二:別忘了「 -s 」參數 ex:「pishrink -s src.img dst.img」
(原則上ubuntu的image可以直接在src.img中作業--也就是直接用「sudo pishrink.sh xxx.img 」就可以了,而NOOB就一定要在檔案外--新檔作業,所以保險起見,就用另存新檔的方式作業)


玩看看吧

update: 在壓完了image之後,日後在pi上面一定會需要再擴展大小的,這時請用「raspi-config --expand-rootfs」(jess/strech...)把其他磁區擴大到其sd上面的空間



2019年7月15日 星期一

for ubuntu,要用ssh連進去時,遇到connection reset.....

明明已經裝了openssh-server,也設好防火牆了
還是一直遇到connection reset by xxx.xxx.xxx. port...的訊息
這時要到那台ubuntu做openssh-server重組態指令
參考這裡

---------------------------------------------
rm /etc/ssh/ssh_host_*
dpkg-reconfigure openssh-server
---------------------------------
這行指令下去後,再出現產生RSA 、ECDSA 、ED25519等key的訊息才是成功的
這時就可以再試著ssh進去看看了

2019年7月10日 星期三

for linux,明明有安裝python3了,怎麼會還出現「/usr/bin/env: ‘python’: No such file or directory」錯誤訊息無法執行.py檔呢?

明明有安裝python3了,怎麼會還出現「/usr/bin/env: ‘python’: No such file or directory」錯誤訊息無法執行.py檔呢?
很多人有很多種做法,我是用這式方
-----------------------------------------
You can try the command line tool update-alternatives.
$ sudo update-alternatives --config python
If you get the error "no alternatives for python" then set up an alternative yourself with the following command:
$ sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 10
Change the path /usr/bin/python3 to your desired python version accordingly.
-----------------------------------------
來源參考這裡 的最終一PO

就將,一起加油吧

2019年7月9日 星期二

for c# asp.net IIS,上傳大檔遇到「HTTP 錯誤 413.1 - Request Entity Too Large」

系統跟人一樣,做人成功大家就愛找你吐苦水,系統好用大家都把東西往上傳
居然要上傳40幾mega的文件檔,
結果系統傳回 「HTTP 錯誤 413.1 - Request Entity Too Large」錯誤訊息
如何是好?
這時,有兩個東西要調整,一個是IIS,一個是web.config
就IIS而言,要改「uploadReadAheadSize」,參考 這裡
Configuration Editor很難找嗎?就是把 IIS的 default website console首頁的功能檢視方式改用「詳細資料」排列方式,再用「編輯」這個關鍵字在上面的篩選器列就可以找到「設定編輯器」
進入configure Editor後再從上方的combbox下拉區段切換到「system.webserver/systemRuntime」就可以輸入uploadReadAheadSize了
就web.config而言
除了改「maxRequestLength」這個設定值之外還不夠,
請到「system.webServer」這個段落,設定「maxAllowedContentLength」
-----example,其中的「1073741824」指的是1G的大小,出處在此------------
<system.webServer>
...
...
  <security>
   <requestFiltering>
    <requestLimits maxAllowedContentLength="1073741824" />
   </requestFiltering>  
   </security>
...
</system.webServer>
-------------------------------------------
改好,存檔
打完,收工 ...
(別說這個老梗你也知道啊!!)

2019年7月8日 星期一

for rapberrypi ,做完了rpi-update 重開機後,HDMI螢幕一片漆黑

參考
https://codefaq.org/raspberrypi/how-to-fixed-hdmi-no-signal-on-raspberry-pi-3/
要改boot.txt的地方有三處
...
disable_overscan=1
...
hdmi_force_hotplug=1
...
config_hdmi_boost=4
....

有的莓友可能漏寫到,猜想可能是改版之故
沒辦法,pi一直在改版

以上,大家加油了