Skip to content

Instantly share code, notes, and snippets.

@idiottiger
idiottiger / org-table-chinese-fix-size
Created September 14, 2017 12:50
解决 mac org table 中英文字体混排时表格宽度不一致
;;;中文与英文字体设置
;; Setting English Font
(set-face-attribute
'default nil :font "Monaco 14")
;; Chinese Font
(dolist (charset '(kana han symbol cjk-misc bopomofo))
(set-fontset-font (frame-parameter nil 'font)
charset
(font-spec :family "WenQuanYi Micro Hei Mono" :size 16)))
@idiottiger
idiottiger / add_js_interface.py
Created August 25, 2015 13:43
add @JavascriptInterface annotation
import re
import codecs
import tempfile
METHOD_PATTERN = re.compile('\s*[^/]+\s*(public|private|protected)\s+[^class]\s*[a-zA-Z][a-zA-Z0-9_]*\s+[a-zA-Z][a-zA-Z0-9_]*\s*\(')
JS_METHOD_PATTERN = re.compile('\s*[^/]+\s*public\s+[^class]\s*[a-zA-Z][a-zA-Z0-9_]*\s+[a-zA-Z][a-zA-Z0-9_]*\s*\(')
JS_INTERFACE_PATTERN = re.compile('\s*@JavascriptInterface')
JS_ANNOTATION = '\t@JavascriptInterface\n'
JS_ANNOTATION_CLASS_NAME = 'android.webkit.JavascriptInterface'
JS_ANNOTATION_IMP = 'import android.webkit.JavascriptInterface;\n'
In software engineering, the Initialization on Demand Holder (design pattern) idiom is a lazy-loaded singleton.
In all versions of Java, the idiom enables a safe, highly concurrent lazy initialization with good performance.
public class Something {
private Something() {}
private static class LazyHolder {
private static final Something INSTANCE = new Something();
}
@idiottiger
idiottiger / latency.txt
Last active August 29, 2015 14:11 — forked from jboner/latency.txt
Latency Comparison Numbers
--------------------------
L1 cache reference 0.5 ns
访问一级缓存
Branch mispredict 5 ns
分支误预测
L2 cache reference 7 ns 14x L1 cache
访问二级缓存
Mutex lock/unlock 25 ns
互斥锁 加锁/解锁
@idiottiger
idiottiger / android_utility_function_library_readme
Last active August 29, 2015 14:08
Android Utility Function Library
Android Utility Function Library
================================
If you need a feature that is native to Linux but not present on other
platforms, construct a platform-dependent implementation that shares
the Linux interface. That way the actual device runs as "light" as
possible.
If that isn't feasible, create a system-independent interface and hide
git 常用命令:
---------------------------------------
1. tag:
-------------------------
git tag 列出所有tag
git tag -a [tag-name] -m [tag-description] 创建 tag
git show [tag-name] 显示该 tag 的信息
git push origin [local-tag-name] 推送本地 tag 到远程
git push origin --tags 推送本地所有 tag 到远程
@idiottiger
idiottiger / homework.lisp
Last active December 29, 2015 13:19
homework of sicp
;;1.3 Define a procedure that takes three numbers as arguments and returns the sum of the squares of the two larger numbers.
(define (sq x)(* x x))
(define (f2 x y)(if (< x y) x y))
(define (f3 x y z)(f2 (f2 x y) (f2 y z)))
(define (sum_3 x y z)(- (+ (sq x) (sq y) (sq z)) (sq(f3 x y z))))
;;1.4 implemenets:
;; (define (a-plus-abs-b a b)
;; ((if (> b 0) + -) a b))
Create a file named /tmp/android.rules with the following contents (hex vendor numbers were taken from the vendor list page):
SUBSYSTEM=="usb", ATTRS{idVendor}=="0bb4", MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0e79", MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0502", MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0b05", MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", ATTRS{idVendor}=="413c", MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0489", MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", ATTRS{idVendor}=="091e", MODE="0666", GROUP="plugdev"
@idiottiger
idiottiger / demo.c
Created September 24, 2013 07:22
test the gist show in the blogspot
// test the gist file show in the blogspot
#include <stdio.h>
int main(){
println("hello world");
exit(0);
}
@idiottiger
idiottiger / open cv android
Last active October 13, 2015 23:38
open cv android
open cv android 学习:
------------------------------------------------------------------
1.基本数据结构: java name -> c/c++ name
Point Point3 -> CvPoint, CvPoint2D32f, CvPoint3D32f
Size -> CvSize, CvSize2D32f
Rect -> CvRect
Scalar -> CvScalar 数据容器,最多可保存4个double值
TermCriteria -> CvTermCriteria ??
Mat -> CvMat 单通道或者多通道矩阵
Imgproc 图像处理函数类