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: 基本數學....

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....

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....

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

Android Media Framework

Android APIs for media playback: MediaPlayer and MediaCodec. MediaPlayer mediaPlayer.setDataSource(path); //fd or url mediaPlayer.setDisplay(SurfaceHolder sh); //SurfaceView or VideoView mediaPlayer.prepare(); // MediaPlayer.start(); // MediaCodec /* init use MediaExtractor to get mime data create decoder by mime type configure decoder by video format and surface view */ MediaExtractor mExtractor; MediaCodec mDecoder; mExtractor = new MediaExtractor(); mExtractor.setDataSource(filePath); MediaFormat format = mExtractor.getTrackFormat(track_index); String mime = format.getString(MediaFormat.KEY_MIME); if mime.startsWith("video/") mExtractor.selectTrack(track_index); mDecoder = MediaCodec.createDecoderByType(mime); mDecoder.configure(format, surface, null, 0 /* Decoder */); mDecoder....

June 16, 2016 · 3 min · oopsmonk

Android build error on Ubuntu 16.04 LTS

After update system from Ubuntu 14.04 to 16.04, I got some problems, when I was building Android source code. openjdk-7-jdk is gone Add PPA for OpenJDK7 sudo add-apt-repository ppa:openjdk-r/ppa sudo apt remove openjdk-* icedtea-* icedtea6-* sudo apt update && sudo apt install openjdk-7-jdk git ccache automake lzop bison gperf build-essential zip curl zlib1g-dev zlib1g-dev:i386 g++-multilib python-networkx libxml2-utils bzip2 libbz2-dev libbz2-1.0 libghc-bzlib-dev squashfs-tools pngcrush schedtool dpkg-dev liblz4-tool make optipng maven If you have other java version in system, make sure your java version is correct....

June 7, 2016 · 2 min · oopsmonk