强哥's Blog

Happy coding

Debian阿里云镜像更新源

无意中发现了阿里云的Linux发行版镜像源http://mirrors.aliyun.com/,试用了一下速度不错,基本能达到1M/s,比网易的源要快不少了.

Debian用户把 /etc/apt/sources.list文件改成下面几行,然后apt-get update就可以了.

deb http://mirrors.aliyun.com/debian wheezy main contrib non-free
deb-src http://mirrors.aliyun.com/debian wheezy main contrib non-free

deb http://mirrors.aliyun.com/debian wheezy-updates main contrib non-free
deb-src http://mirrors.aliyun.com/debian wheezy-updates main contrib non-free

deb http://mirrors.aliyun.com/debian-security wheezy/updates main contrib non-free
deb-src http://mirrors.aliyun.com/debian-security wheezy/updates main contrib non-free

Android防止屏幕休眠

1、在Manifest文件里声明权限

android.permission.WAKE_LOCK

2, 得到 WakeLock实例 ,

PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);

mWakeLock = pm.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK,
                "SoundRecorder");
3,防止休眠
mWakeLock.acquire(); 
 
4,释放
if (mWakeLock.isHeld())
                mWakeLock.release();
(节选自录音机:com.android.soundrecorder.SoundRecorder.java)

 

sshfs mount、unmount

如果本地用户名和要mount的主机的用户名是相同的,则直接使用sshfs hostname: mountPoint,否则sshfs username@hostname: mountPoint,挂载用户主目录

如果想挂载其他目录:sshfs username@hostname:/path mountpoint

unmount :  fusermount -u mountPoint.