Skip to content

Instantly share code, notes, and snippets.

View wuqian's full-sized avatar

wuqian

  • 快手
  • beijing, china
View GitHub Profile
@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 / 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 / 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 / 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 / xorg.conf
Created September 27, 2014 03:40
R.A.T.7 mouse support for Ubuntu
Section "InputClass"
Identifier "R.A.T."
MatchProduct "R.A.T.7|R.A.T.9"
MatchDevicePath "/dev/input/event*"
Option "Buttons" "17"
Option "ButtonMapping" "1 2 3 4 5 0 0 8 9 7 6 12 0 0 0 16 17"
Option "AutoReleaseButtons" "13 14 15"
Option "ZAxisMapping" "4 5 6 7"
EndSection
@wuqian
wuqian / blur.java
Created October 14, 2014 05:44
android blur
private Bitmap blur(Bitmap sentBitmap, Context context) {
Bitmap bitmap = sentBitmap.copy(sentBitmap.getConfig(), true);
final RenderScript rs = RenderScript.create(context);
final Allocation input = Allocation.createFromBitmap(rs, sentBitmap, Allocation.MipmapControl.MIPMAP_NONE,
Allocation.USAGE_SCRIPT);
final Allocation output = Allocation.createTyped(rs, input.getType());
final ScriptIntrinsicBlur script = ScriptIntrinsicBlur.create(rs, Element.U8_4(rs));
script.setRadius(10.f /* e.g. 3.f */);
script.setInput(input);
@wuqian
wuqian / start_vpn.sh
Created November 10, 2014 09:55
start vpn from command line
#start vpn
nmcli con up id yt
#stop vpn
nmcli con down id yt
@wuqian
wuqian / gist:88814600dfe3329212a6
Created November 12, 2014 03:12
vpn 连接日志
$sudo plog -f
@wuqian
wuqian / my_pub
Last active August 29, 2015 14:09
my_pub
ssh-dss AAAAB3NzaC1kc3MAAACBAItm7NP8wy3FGCj7O+5eoQH04OhI+E7zBfhEb1FTxuT47We5GL+q1ysOV3rifYJJ5fXc7JLiId2S6IzCFVZDAwNN3TSnI+ifMWxAVRoadQfA5JOPMypLBIUy20ud12ByL9vDHDegh76fJS0Z4qQQlSIBhhBwJq2DiWR480j7+TfdAAAAFQDbQuhGie/AJPcL7q8LHkOIHnqwJQAAAIBDRAKCQQXccQanKcpufmFAoKa2K+WWjCXGgP+miw0OA/2m6Cr8xes9ybkPZxvlHLkZqyr2tPPgWanmR+qnnQIBuUFmDnJobCU/+Uh6BMuZDBwo8HWHl+/okJeBQv1n3FZjvYf4PMroB5bQWtRqKd9frkBlTaWBvuLwgZzvTLHiVgAAAIByt2Jth/92TpF37tZ/6jt+cmZxsZX0yYIwsEtItBrhgRz7E0YomF8T/37SlMD6foncCJ+xea07ehf9uiqS3HYrWW66vTtn7ko1WC0dhAxR5xxjigGGzPEPp5SJRYEDvsX6djR3drhchBoN43cPibbXMM31uSZms64UrVpEn1UdEA== wuqian@wuqian-ubuntu
@wuqian
wuqian / gist:0f06f23a788a9a089d97
Created November 15, 2014 14:08
on-terminal-to-disable-alt-to-show-menu-tabs
http://askubuntu.com/questions/314948/on-terminal-to-disable-alt-to-show-menu-tabs