Sunday, July 10, 2016

NAS automount Magic TV HD

Magic TV HD 可以供其他裝置連上,只要適合用NFS 格式。

NAS: Synology 216+II https://www.synology.com/zh-tw/products/DS216+II
MagicTV 3300D
Win/Mac can connect to NAS via SSH


1. 開啟Magic TV  NFS 功能 (1)
MENU > 增值功能 > 網絡磁碟 > 網絡儲存伺服器:開啟

2. 關啟NFS SSH 功能。
3. showmount -e IP of MagicTV
4. mount -t nfs ip of MagicTV:/mnt/path/to/extHD /volume1/magicTV
5. Synology 用 busybox, 第二個參考資料段script (2) 我部機run 有少少問題,所以我改成如下

#!/bin/sh

if [ "$(ping -c 3 192.168.11.231 | grep '0 received')" ]; then
        exit 1
else
        if  [ "$(df | grep '192.168.11.231')" ]; then
                echo "magic TV mount!"
        else
                mount -t nfs 192.168.11.231:/mnt/path/to/extHD /volume1/magicTV
    fi
fi

5. 將佢copy to /usr/local/etc (應該呢到換機先唔會洗) (3)
6. 在DSM > Task Schedule, set 佢5分鐘run 一次。
7. done.
8. 不過若果在抄資料過程中,magicTV 自動關機會... (哀)

參考資料:
1. http://www.hkepc.com/forum/viewthread.php?fid=219&tid=1833597
2. https://forum.synology.com/enu/viewtopic.php?f=39&t=6617&hilit=fstab&sid=71d9a809352e214395a34aa657f6dedf&start=30
3. https://forum.synology.com/enu/viewtopic.php?t=86232



Thursday, March 10, 2016

Pubkey connect from Dropbear SSH

越玩越開心,而家想用一部機用ssh remote send command 去另外一個 linux box 做野。

初時諗住兩邊一齊關掉wifi, 不過而家諗,我set 好一部機,另一部用remote 關未重方便!

不過dropbear 個setting 又有一點不同。

爬文後發現
https://forum.openwrt.org/viewtopic.php?id=4379

https://yorkspace.wordpress.com/2009/04/08/using-public-keys-with-dropbear-ssh-client/


root@openwrt ~: dropbearkey -t rsa -f ~/.ssh/id_rsa

root@openwrt ~: dropbearkey -y -f ~/.ssh/id_rsa | grep “^ssh-rsa ” >> ~/pub_key


加alias 入bash profile  (安裝 bash )才可

root@openwrt ~: vi ~/.bash_profile

[...]
alias ssh='ssh -i /root/.ssh/id_rsa'
[...]
那麼如何send command?
root@openwrt ~: ssh user@server 'send-command-to-server'


SFTP error Fatal: Received unexpected end-of-file from SFTP server

今天想用ssh, sftp, psftp.. 都出現以下error



Fatal: Received unexpected end-of-file from SFTP server 


再用logread 睇一下個log

root@openwrt ~> logread

[...]
Thu Mar 10 00:01:45 2016 kern.warn kernel: [514823.910000] jffs2: Node CRC ffffffff != calculated CRC f09e7845 for node at 01a329a4
Thu Mar 10 00:01:45 2016 kern.warn kernel: [514823.920000] jffs2: Node CRC ffffffff != calculated CRC f09e7845 for node at 01a329a4
Thu Mar 10 00:01:45 2016 kern.warn kernel: [514823.930000] jffs2: Node CRC ffffffff != calculated CRC f09e7845 for node at 0193aca8
Thu Mar 10 00:01:45 2016 kern.warn kernel: [514823.930000] jffs2: Node CRC ffffffff != calculated CRC f09e7845 for node at 0193aca8
Thu Mar 10 00:01:45 2016 kern.warn kernel: [514823.960000] jffs2: Node CRC ffffffff != calculated CRC f09e7845 for node at 01a1ca14
Thu Mar 10 00:01:45 2016 kern.warn kernel: [514823.960000] jffs2: Node CRC ffffffff != calculated CRC f09e7845 for node at 01a1ca14
Thu Mar 10 00:01:45 2016 kern.warn kernel: [514823.970000] jffs2: Node CRC ffffffff != calculated CRC f09e7845 for node at 018b4930
Thu Mar 10 00:01:45 2016 kern.warn kernel: [514823.980000] jffs2: Node CRC ffffffff != calculated CRC f09e7845 for node at 018b4930
Thu Mar 10 00:01:45 2016 kern.warn kernel: [514823.990000] jffs2: Node CRC ffffffff != calculated CRC f09e7845 for node at 0195e6ac
Thu Mar 10 00:01:45 2016 kern.warn kernel: [514824.000000] jffs2: Node CRC ffffffff != calculated CRC f09e7845 for node at 0195e6ac
[...]


先知道大件事,再試下一次reboot, 都係login 唔到,今次又冇左個jffs2 個warning... 應該唔關這件事。

要再爬文睇下點攪。不過而家只係用唔到sftp 同 ssh ... 唔知重有冇其他問題。


[...]
Thu Mar 10 00:47:05 2016 authpriv.info dropbear[3107]: Exit (root): Exited normally
Thu Mar 10 00:48:02 2016 authpriv.info dropbear[3174]: Early exit: Terminated by signal
Thu Mar 10 00:48:03 2016 authpriv.info dropbear[3474]: Not backgrounding





最後我的解決方法是重裝... 估計原因是由AA 直接升級到CC的問題...

Saturday, March 05, 2016

[Excel] VBA ColorIndex and Color

http://msdn.microsoft.com/en-us/library/office/cc296089%28v=office.12%29.aspx

Modify the marco to detect the color Interior.color


[Openwrt] Wifi Schedule via cron (No package required)

Reference: https://forum.openwrt.org/viewtopic.php?id=49797

1. Find out your wireless iface name.

root@openwrt ~ uci show wireless


[...] 

wireless.@wifi-iface[0]=wifi-iface
wireless.@wifi-iface[0].device='radio0'
wireless.@wifi-iface[0].network='lan'
wireless.@wifi-iface[0].mode='ap'


[...]

From the result, we know that the wireless iface is @wifi-iface[0].

2. Edit crontab to start schedule service.
root@openwrt ~ cat /etc/crontabs/root

30 0 * * *  uci set wireless.@wifi-iface[0].disabled=1 && uci commit wireless && wifi
30 6 * * *  uci set wireless.@wifi-iface[0].disabled=0 && uci commit wireless && wifi


3. if you are interested, you can use remote ssh command to turn on|off all your wifi in your home network. Write a script and loop through all your network router.

Please read Pubkey connect from Dropbear



Knockd in Chaos Calmer

Knocked is removed from Chaos Calmer, actually, it is not removed. As openwrt package is maintained by community, this obsolete program will be forgotten if no one takes care of it. However, this little program means some values for my little server...

What's is port knocking? http://blogger.gtwang.org/2013/10/port-knocking.html

Hope that I can't build it in my openwrt condition.,

Friday, March 04, 2016

Openwrt opkg update wget return 8

這一個月發現用opkg update 個openwrt 有以下error,

- 部機可以上到網, 所以應該唔係network 問題
- 可以ping 到www.openwrt.org 所以應該唔係dns 問題
(因為我曾懷疑是OpenDNS block 左個connection)

root@OpenWrt:~# opkg update
Downloading http://downloads.openwrt.org/attitude_adjustment/12.09/ar71xx/generic/packages/Packages.gz. Collected errors: * opkg_download: Failed to download http://downloads.openwrt.org/attitude_adjustment/12.09/ar71xx/generic/packages/Packages.gz, wget returned 8.
root@OpenWrt:~#

爬文:https://forum.openwrt.org/viewtopic.php?id=57593

爬了一會文發現原本的version (attitude adjustment) 已經不再更新,而package 更加移走了。所以opkg update 不能更新。


故我的openwrt 要做sysupgrade.. 今次去download 返個sysupgrade image

https://downloads.openwrt.org/chaos_calmer/15.05/ar71xx/generic/

找回原本個router 的image version ... 不要弄錯...

再在Luci 做sysupgrade 即可。

不過記得要抄走自己的script 先... 我唔記左.. 乜都冇... 首先要改返咁個opkg.conf
原文: https://forum.openwrt.org/viewtopic.php?id=55334

cat /etc/opkg.conf

dest root /
dest ram /tmp
lists_dir ext /var/opkg-lists
option overlay_root /overlay
src/gz chaos_calmer_base http://downloads.openwrt.org/chaos_calmer/15.05/ar71xx/generic/packages/base
src/gz chaos_calmer_luci http://downloads.openwrt.org/chaos_calmer/15.05/ar71xx/generic/packages/luci
src/gz chaos_calmer_management http://downloads.openwrt.org/chaos_calmer/15.05/ar71xx/generic/packages/management
src/gz chaos_calmer_packages http://downloads.openwrt.org/chaos_calmer/15.05/ar71xx/generic/packages/packages
src/gz chaos_calmer_routing http://downloads.openwrt.org/chaos_calmer/15.05/ar71xx/generic/packages/routing
src/gz chaos_calmer_telephony http://downloads.openwrt.org/chaos_calmer/15.05/ar71xx/generic/packages/telephony


更新要點:
1. Privoxy 改左config 位罝 由/etc/privoxy/config 轉左去 /etc/config/privoxy
2. 若果之前keep config 應該安返d package 就可以用返,不過唔需要用好多時間。

Monday, February 29, 2016

[cmd] Moving Whatsapp image script

Whatsapp 真係一個幾好用的溝通工具,不過佢的image storing 比較唔識合我屋企系統。在家中file 會分年月日來排但whatsapp 一個大folder 攪掂,所以我要寫個windows batch script 去改佢。

Sunday, February 21, 2016

最好的告别:关于衰老与死亡,你必须知道的常识

http://www.amazon.cn/gp/product/B013HS6BT0?psc=1&ref_=oh_aui_d_detailpage_o04_


這是一本題材比較沈重的書,死是必經的階段。但未到最後的一步,人應該如何去面對?現在的人用什麼方法去面對?

這本書可不只是說現實是無奈,但他卻說着現在(主要是美國)有很多人在離開這個世界的時候,想過着自主的生命。

羅曼諾夫博士的姿勢跑法

http://www.books.com.tw/products/0010686061


借用別人網站圖片連結一下。



今年二用在旺角一樓上書店購買,很多年都沒有到樓上書店買書了。近這一年想學習跑步更多,見其他網站有些推舉這本書的教學法,故重臨書店的時候順路看看有沒有這一本書。

不過見不同樓上書店各有特式,有些大眾,有些古老,有的專題,但談運動的略少。在六福樓上的那一間只有一個小各落有這一本。


若chi running 是心法,這本是身法。兩者皆相輔相乘,可能先入為主,個人比較接受chi running 的法則,但pose running 的教用相機調教姿勢真的很清楚,而且書中談及的前後訓練是比較實用。