Skip to content

Instantly share code, notes, and snippets.

View wuqian's full-sized avatar

wuqian

  • 快手
  • beijing, china
View GitHub Profile
@wuqian
wuqian / tramp-open-file
Last active August 29, 2015 14:05
Emacs use Tramp to manage remote files
Tramp open remote file
M-x /usr@machine:/path/to.file
@wuqian
wuqian / autossh.sh
Last active August 29, 2015 14:05
autossh proxy
autossh -M 20000 -D 8001 [email protected] -p 6666
autossh -M 20000 -L 127.0.0.1:8080:127.0.0.1:9050 [email protected]
@wuqian
wuqian / DensityUtil.java
Created August 14, 2014 02:10
DensityUtil
import android.content.Context;
public class DensityUtil {
/**
* 根据手机的分辨率从 dp 的单位 转成为 px(像素)
*/
public static int dip2px(Context context, float dpValue) {
final float scale = context.getResources().getDisplayMetrics().density;
return (int) (dpValue * scale + 0.5f);
@wuqian
wuqian / eclipse.desktop
Last active August 29, 2015 13:59
eclipse.desktop
[Desktop Entry]
Name=Eclipse
Comment=ANDROID DEV SDK
Encoding=UTF-8
Exec=/usr/local/eclipse/eclipse
Icon=/usr/local/eclipse/icon.xpm
Terminal=false
Type=Application
Categories=Application;Development;
@wuqian
wuqian / clamp.java
Created March 31, 2014 06:13
clamp
private final static int clamp(int x, int low, int high) {
return (x < low) ? low : ((x > high) ? high : x);
}
@wuqian
wuqian / reverse.clj
Last active January 1, 2016 19:59
clojure reverse
(reduce conj '() [1 2 3 4])
@wuqian
wuqian / gist:6796851
Last active December 24, 2015 12:19
ubuntu 12.04 安装过程
1. 系统安装
2. 网络链接
3. 显卡驱动安装
4. git安装
5. vim安装
6. 中文/输入法安装
hdiutil convert -format UDRW -o <output-file> <input-iso-file>
diskutil list /dev/disk
diskutil unmountDisk /dev/diskN
dd if=<dmg-file> of=/dev/rdisk1
@wuqian
wuqian / gist:3937510
Created October 23, 2012 07:48
object-c selector
//定义
SEL class_func;
//赋值
@interface foo
-(int)add:int val;
@end
class_func = @selector(add:int);
//执行
@wuqian
wuqian / 卸载 Xcode 3.2版本
Created September 21, 2012 06:18
卸载 Xcode 3.2版本
sudo /Developer/Library/uninstall-devtools --mode=all