Note-taking and file sharing with Syncthing and Joplin

You can find many note-taking services, like, Evernote, Google Keep, Notion, Obsidian and online storage services such as, Dropbox, Google Drive, OneDrive, iCloud. They are easy to use and secure. But, secure is not equal to private! A way to keep privacy is host private services by self. Edward Snowden’s Privacy Tips: “Get Rid Of Dropbox,” Avoid Facebook And Google This is how I share/edit notes and files with different devices which service providers are unable to peek and analyze my private contents....

June 5, 2022 · 4 min · oopsmonk

Install Perf on Ubuntu 20.04

What is Perf? Perf or perf-event is a Linux profiler and is part of the Linux Kernel which can help you solve advanced performance and troubleshooting functions. It covers hardware level (CPU/PMU, Performance Monitoring Unit) features and software features (software counters, tracepoints) as well. Install on Ubuntu If perf has not installed on the system $ perf WARNING: perf not found for kernel 5.4.0-109 You may need to install the following packages for this specific kernel: linux-tools-5....

April 28, 2022 · 2 min · oopsmonk

Policy Configuration of SELinux and SEAndroid

A Note for SELinux and SEAndroid policy configuration. SEAndroid Security-Enhanced Linux in Android SELinux for Android 8 - Treble mode SEAndroid安全機制中的文件安全上下文關聯分析 - file_context SEAndroid安全機制中的進程安全上下文關聯分析 - process Android 8 Treble mode: Kernel early mount PRODUCT_FULL_TREBLE, PRODUCT_FULL_TREBLE_OVERRIDE, BOARD_SEPOLICY_DIRS Android 4.3 ~ 6 TE macro define: external/sepolicy/te_macros Android 8 TE macro define: system/sepolicy/te_macros ##################################### # domain_trans(olddomain, type, newdomain) # Allow a transition from olddomain to newdomain # upon executing a file labeled with type....

November 17, 2017 · 5 min · oopsmonk

Faster R-CNN Use Caffe Framework

Install caffe framework and run Faster R-CNN demo on Ubuntu 16.04. Test environment CPU: Intel(R) Core(TM) i3-4130 CPU @ 3.40GHz 4-Cores GPU: ASUSTeK GeForce GTX 1060 with 6GB Memory HD: WDC WD5000AAKX OS: Ubuntu 16.04 Test Flow Install software requirement Video pre-processing: get jpeg images from source video Image Labeling Use Faster R-CNN to genrate trained model Run Faster R-CNN demo Requirement Hardware: Good graphic card with large memory (6GB memory is okay, but it has problem in VGG traing....

August 31, 2017 · 12 min · oopsmonk

[Paper] - An Evolutionary Study of Linux Memory Management for Fun and Profit

Memory management主要的功能是page mapping, memory protection, and sharing, 但隨著時間不斷的演進已經算是kernel裡不小的subsystem. 這份研究分析2009~2015年之間4587筆有關memory management(mm)的patches, Linux版本由v2.6.32.1 ~ v4.0-rc4. Source: An Evolutionary Study of Linux Memory Management for Fun and Profit Memory Bugs 5種bugs存在mm: memory error, checking, concurrency, logic and programming. 透過heat map可清楚看到主要bug發生地方 主要的bug fix在: Memory Allocation, Garbage Collection (GC), Virtual Memory Management. 大部份memory leak並不是因為忘了free, 而是錯誤的page fault handling和 free page的計算. MM較大的問題是很難去track正確的狀態. Memory optimization 定義3種optimization patches data structure: 避免nested data structure. Scalability的實現, scalability問題是因為locking for atomic access to shared data structures....

June 13, 2017 · 2 min · oopsmonk

Linux Graphic Stack相關的名詞

Linux graphic 架構還滿複雜的, 在看時需要大略了解几個名詞及之間的關係. X Window System: 目前來到第11版本所以叫X11, 是以X window System Core protocol為基礎的window system. wayland: 由於X11太過複雜且在embbeded system中的效能不佳, 用來取代X window System Core protocol. weston (wayland compositor): 以wayland protocol來實做的compositor做為參考的範例, 實用上會用Westeros, Clutter…等. KMS/UMS: Kernel mode-setting 及User mode-setting. OpenGL: 由Khronos Group制定的跨平台graphic API. GLX: 是一個extension, 做為OpenGL與X window system之間的橋樑. 就像embedded system的EGL, MacOS的AGL. DRM(Direct Rendering Manager): 為了防止世界被破壞, 保護世界的和平. 防止同時使用graphic buffer. DRI(Direct Rendering Infrastructure): Mesa及DRM之間的橋樑. Ref: Introduction to the Direct Rendering Infrastructure CRTC (CRT Controller): Crtc is in charge of reading the framebuffer memory and routes the data to an encoder....

May 30, 2017 · 1 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