失速列車

以前球隊在回防時, 教練總會說"快跑! 別回頭, 到定點再休息". 關於人生, 喘息點在哪兒? 我想就在滴水穿石之間! 失速的這個月 Week14 (04/07) 網路文章 Adding A New System Service To Android 5: Tips and How To 由下到上打造一個android system service. HW -> HAL -> JNI -> Service -> Manager -> Registering. Adding New System Service in Android Native system service. 33 Foods that Starve Cancer 滿有趣的論點, 細胞沒有supplement會死亡沒錯, 但microscopic cancers能否自己生出新的血管? 大部份的癌症無關基因, 超過40歲體內難免會有microscopic cells, 並可能轉變成cancer cells? Week15 (04/14) img2ascii.py 參考網路上的做法, 加了些參數方便調整輸出的內容. pillow提供便利的API. 網路文章 Every attempt to manage academia makes it worse Goodhart’s Law: “When a measure becomes a target, it ceases to be a good measure.” 為了打分數而訂出的評分系統, 不就是考試?! 衡量對錯本來就很難(也許本身就是個假議題), 就像"找到一個對的人做對的事". The Cobra Effect: 在大公司應該是無可避免的. 網路資源 Python libhunt 可用找lib, 比較lib之間的活躍程度, Code Quality L1是較差, L5較佳. 除了python之外, 還有C++, Android, Java, Javascript…等. 讀書心得 The Handstand Builder For Women - Week1 Recap Week1, 有些人說Handstand不太需要flexibility, 我的經驗是stretches也是很重要的, 靈活的關節/彈性的肌肉能避免運動傷害. Reverse Plank: 有助於倒立時開胸姿態 Handstand against the wall: 讓身體習慣倒立姿態 Crescent Lunge/Seated Hamstring Stretch: 腿離地時腳筋的柔軟度很重要, 柔軟度不夠需要更大的肌力做平衡. Week16 (04/21) 網路文章 What is the difference between venv, pyvenv, pyenv, virtualenv, virtualenvwrapper, pipenv, etc? 一般是用virtualenv測試module需要哪些python packages, pyenv來測試module在不同的python2.6, python2.7, python3.5, python3.6是否正常. virtualenvwrapper是加強virtualenv的plugin, 將不同的環境放在同一個目錄方便管理. ...

April 28, 2017 · 2 min · oopsmonk

Android USB Media Transfer Protocol(MPT)

Study USB MTP Device and Host mode in Android M. Source Code Cross Reference: Android 6.0.1_r10 MTP Device Mode Enable device mode: Settings -> Developer options -> Select USB Configuration -> MTP UsbDeviceManager: Setting USB config to mtp device/lge/hammerhead/init.hammerhead.usb.rc : on property:sys.usb.config=mtp system/core/rootdir/init.usb.configfs.rc: on property:sys.usb.config=mtp && property:sys.usb.configfs=1 USB plug to PC: MtpReceiver: listen to android.hardware.usb.action.USB_STATE and bring up MtpService UsbDeviceManager: get uevent USB_STATE=CONFIGURED from kernel MtpService: create MtpDatabase MtpDatabase: create volume and storage path MtpService: starting MTP server in MTP mode ...

April 18, 2017 · 2 min · oopsmonk

Slow and Fast

以前球隊在回防時, 教練總會說"快跑! 別回頭, 到定點再休息". 關於人生, 喘息點在哪兒? 我想就在滴水穿石之間! Week9 (03/03) 228的4天連假讓這週過的特別快. 網路文章 What Americans can learn from other food cultures Google breaks SHA-1 web crypto for good but Torvalds plays down impact on Git Announcing the first SHA1 collision Google 公怖與CWI Amsterdam合作生出了第一個SHA-1 collision, 對於使用SHA-1的Git來說會有什麼影響? 目前看來是影響不大, 主因如下: Git remote 與 local 發生衝突時local並不會被override. 相較於Git, PDF檔是較容易被破解的. Git可能會計劃使用SHA3-256為新的hash algorithm. 為什麼不選SHA256? “SHA256 acceleration is mainly an ARM thing” - Torvalds 網路資源 Math is Fun: Common Core Standards: 基本數學. 讀書心得 Learning How to Learn - Week1 這週以科學研究來看大腦對於學習的反應 可以把學習看的很單純, 就是"不斷"的吸收及練習, “不斷"意指長遠的時間1年, 5年, 10年…等, 而不是指當下不斷的行為. 很多名人傳記都有提及他們的看書習慣, Ex: Steven Jobs and Elon Musk. Think mode: focus, and diffuse. After leaning and sleeping brain form many synapses on the dendrite in your brain that is how your brain upgrade after a sleep or nap. Procrastination - The Pomodoro Technique: an intense 25 minutes followed by 5 minutes relaxation or a little reward. Memory - long term memory and working memory are two major memory systems. Research has shown that if you try to glue things into your memory by repeating something twenty times in one evening, for example, it won’t stick nearly as well as if you practice it the same number of times over several days. Sleep - When you sleep, your brain cells shrink, which allows toxins to be more easily washed away. Week10 (03/10) 網路文章 I Was Wrong About Speed Reading: Here are the Facts Reading包含几種不同的方法: saccade, scan, and skim. 以前只知道scan and skim, 但saccadé是法文, 意思跟scan似乎是一樣的. 在reading時有几個過程: fixate, saccade and process. Subvocalization是必要的, 用來幫助理解(process). 從解剖學及神經學來看, 速讀是有極限的. 英文極限約500wpm, 超過這個速度還能讀懂文章, 我想對於文章內容很熟的成份居多. 文中提到的tips其實就是six-way paragraphs的方法. ...

March 31, 2017 · 5 min · oopsmonk

在Shell使用vi-mode

Vi用慣了, 那在shell也可以vi-style嗎? 答案是可以的! 這個方法可使用在常用的shell, 例如bash, ksh, zsh, mksh. btw, mksh 是Android使用的shell, 但Ubuntu預設的dash 是不支援的. 在shell中執行set -o vi 後按’i’進入insert mode, ‘ESC’為normal mode. 回到原本的模式則是set -o emacs 如下圖: Reference: Using vi-mode in your shell

March 28, 2017 · 1 min · oopsmonk

The First SHA1 Collision

CWI Institute in Amsterdam and Google genrate two PDF documents with the same SHA-1 digest. Google security blog - Announcing the first SHA1 collision SHA-1 collistion and Git If a file A with X hash in local repository and with X hash in remote (SHA-1 collistion between local and remote), would overwrite the local version? Nope. If it has the same SHA1, it means that when we receive the object from the other end, we will not overwrite the object we already have. So you have two cases of collision: the inadvertent kind, … The attacker kind … … So in this case, the collision is entirely a non-issue: you’ll get a “bad” repository that is different from what the attacker intended, but since you’ll never actually use his colliding object, it’s literally no different from the attacker just not having found a collision at all, but just using the object you already had (ie it’s 100% equivalent to the “trivial” collision of the identical file generating the same SHA1). See above. The only dangerous kind of collision is the inadvertent kind, but that’s obviously also the very very unlikely kind. Torvalds @ Git- Re: Starting to think about sha-256? ...

March 3, 2017 · 4 min · oopsmonk

新章

以前球隊在回防時, 教練總會說"快跑! 別回頭, 到定點再休息". 關於人生, 喘息點在哪兒? 我想就在滴水穿石之間! Week7 (02/17) 發現minimal-mistakes上缺了繁中, 便開了個PR#838 沒想到很快就被merge, 效率真快. 試玩BeautifulSoup 寫了個簡單的ck101Comics.py用來下載卡提諾×揪漫畫. 網路文章 Diving Into Android ‘M’ Doze & Diving into Doze Mode for Developers Android Doze在Nougat多了Light-Doze, Light-Doze的Maintenance Windows較短為了避免不同步問題, 當進入Deep-Doze(原本Marshmallow的Doze), Light-Doze會進入OVERRIDE不做任何事. 網路資源 E-book: Python for Informatics 讀書心得 Tuesdays with Morrie 讀完The Classroom, 直到這章節都是在講Mitch離開大學後的生活及偶然聽到電視上提到Morrie, 師生俩如何再度搭上線. Morrie對Mitch有很深的情感, Mitch稱他為’Coach’. “Dying,” Morrie suddenly said, “is only one thing to be sad over, Mitch. Living unhappily is something else. So many of the people who come to visit me are unhappy.” - The Classroom, p35. 論文學習 POSIX Has Become Outdated 透過libtrack觀察Andorid, OS X, and Ubuntu, 發現為了UX(user experience)與符合modern workload, 不同的OS實現原本不足且鮮少使用的POSIX abstractions, 其中IPC及Asynchronus I/O的部份更是被取代. 最後結論提到新的POSIX standard 需要著重於graphics, IPC, and threading. Week8 (02/24) 照顧小孩真的很殺時間, 尤其是老婆出國時. 西班牙海鮮燉飯(Paella Marinera) 試了做一次, 覺得是道擺盤容易, 色彩豐富, 但想做的好吃要再練練的料理. 另外Tortilla de patatas整個失敗…. ...

February 16, 2017 · 2 min · oopsmonk

Android Adoptable Storage

A study of adoptable storage in Android Marshmallow and Nougat. How to Setup a Private Disk (External USB Storage) Android adoptable storage allow APP install to external storage that can reserve more internal space for other APPs. Create Adoptable Storage Using Settings GUI Settings -> Storage & USB -> Portable storage -> Settings -> Format as internal Use sm (Storage Manager) Command Find disk id # sm list-disks disk:8,16 disk:8,0 Format as internal # sm partition disk:8,0 private # sm list-volumes all public:8,17 mounted 629C-FBAF emulated:8,2 unmounted null private mounted null emulated mounted null private:8,2 mounted 3f538e6e-e6a9-4163-ac1e-e4c6602b3c34 Now, it’s a private storage in system. ...

February 13, 2017 · 8 min · oopsmonk