Monday, March 2, 2009

what is written for us?

yes, i want to get the answer very much.
so, do you know anything about that?

i think the biggest problem is that i have nothing to share with you.
so, maybe that be an answer to me.

just follow the mind.



其实,以上文字来自观看下面2部电影的感受,热烈推荐:
贫民窟的百万富翁
《好好先生》Yes.Man

Wednesday, February 25, 2009

自然码双拼表

自然码双拼表
Q iu
W ua,ia
E er
R uan,van
T ve
Y uai,ing
U sh,u
I ch,i
O o,uo
P un,vn
A a
S iong,ong
D uang,iang
F en
G eng,ng
H ang
J an
K ao
L ai
Z ei
X ie
C iao
V zh,ui,v
B ou
N in
M ian

a     A
ai    L
an    J
ang   H
ao    K
ch    I
ei    Z
en    F
eng   G
er    E
i     I
ia    W
ian   M
iang  D
iao   C
ie    X
in    N
ing   Y
iong  S
iu    Q
ng    G
o     O
ong   S
ou    B
sh    U
u     U
ua    W
uai   Y
uan   R
uang  D
ui    V
un    P
uo    O
v     V
van   R
ve    T
vn    P
zh    V

Tuesday, February 24, 2009

git 之目录

在本地 local 目录 git init
然后在本地 remote 目录 git init

cd local #developer’s local repository
git pull ../remote master #get the latest code from ‘remote’ repository
git push ../remote master #push the recent commits from here to the ‘remote’ folder 
使用Git remote命令
GitHub 所用的方式比较方便,就像这样:
git remote add origin ../remote/ #one time for all
git pull origin master # pull from the ‘remote’ directory
git push origin master #push recent commits from here to the ‘remote’ folder 
Git加ssh
如果有一个 ssh 帐号的话,那么可以在远程机器上做 git 仓库,那么就可以随时随地的同步了。
git remote add origin ssh://jesper@myserver.com/~/project.git/

在 ssh 机器上设置一下:

$ ssh jesper@myserver.com
Welcome to myserver.com!
$ mkdir project.git && cd project.git/
$ git –bare init
Initialized empty Git repository in /home/jesper/project.git
$ exit
Bye!

git 配合有了 pub/priv KEY 的 ssh,会让人觉得生活很美好。
你觉得呢?


参考:
Using Local File-based Git — Server Laziness

Sunday, February 22, 2009

The Restart Button

生活也许就像电脑一样,
当你遇到无法解决的问题时,
也许重启是最快速有效的办法,
虽然,
这可能会导致你丢失很多你正在进行的事情,
但,
跟老不响应相比,要好很多吧。

GUI + CLI

Finder 中有插件可以实现 open terminal here.

其实,应该可以给 Finder 加一条 terminal 输入框,
然后随时提供当前界面中选择的文件列表变量,比如 $SEL。
那么就可以很方便的做一些操作了,比如 copy,rename,tar 等等。

GUI 的优势在于不规则的选择,CLI 的优势在于 规则的操作,
CLI 的操作比较直接,GUI 的操作大多比较间接,
GUI 的操作大多有多余的操作,比如新建文件夹,在 GUI 中就是 新建 -> 重命名。
而在 CLI 中则是你写好了名字,敲一下回车就创建完毕,是一步操作。

Wednesday, February 18, 2009

Just

等一列地铁要5分钟,
看一场电影要3小时,
月缺月圆要1月,
春去春来要1年,
想念一个人要1生,
说一句关心的话只需要1秒:
天凉了,窝里多垫点草。

看到这条短信的时候心里非常暖,
很是感动。
愿人们都平安。

凡事,从自己出发,换位思考。

Life with CPAN

如果使用 CPAN 遇到问题,就先看看这儿吧,基本上都能搞定。

[译] 使用 ssh 执行远程命令

原文:Run Remote Commands with SSH

ssh 是一个神奇的工具。

你可以使用它连接2台电脑,或者在不登录到终端的情况下在远程机器上执行一段命令。

下面演示如何查看系统磁盘使用情况:

root@admin:~ # ssh root@www 'df -h'
Filesystem Size Used Avail Use% Mounted on
/dev/ubda 3.5G 2.1G 1.4G 61% /
tmpfs 96M 4.0K 96M 1% /dev/shm

是不是很神奇,但好像不是非常有用。 如果你在多台服务器上配置好 public/private key pairs,然后就可以肆意在那些机器上。具体情况,下回分解。

现在呢,你可以通过已有的知识来做很多事情,比如查询服务器上 web服务 的进程数,而不用登录到服务器上然后敲入那些命令。 你要做的只是将要执行的命令用引号引起来然后放到 ssh 命令后面,就行了。 下面给出一个例子:用 root 帐号登录到服务器并查询服务器上的所有进程,将结果通过 pipes 传给本地,通过 grep apache 获得所有 apache 进程,然后通过 grep -v grep 过滤掉 grep apache 命令本身,这样就只剩下 apache 进程了,然后通过 wc -l 就能得到所有的 apache 进程数了。

root@admin:~ # ssh root@www 'ps -ef | grep apache | grep -v grep | wc -l'
11

或者看看如何显示系统的资源使用情况和最占用 CPU 的进程:

root@www:~ # ssh root@www 'top -b -n 1 | head -n 8'
top - 11:01:04 up 20 days, 6:47, 1 user, load average: 0.44, 0.21, 0.09
Tasks: 60 total, 1 running, 59 sleeping, 0 stopped, 0 zombie
Cpu(s): 1.7% user, 1.5% system, 0.0% nice, 96.8% idle
Mem: 195620k total, 186276k used, 9344k free, 16380k buffers
Swap: 525304k total, 516k used, 524788k free, 26912k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
 7399 root 19 0 936 936 740 R 9.2 0.5 0:00.20 top

或者只是看看都谁登录呢:

root@www:~ # ssh root@www 'who'
brock pts/0 Oct 21 10:31 (75.72.194.149)
jim pts/1 Oct 25 06:25 (128.101.163.128)

如果你想知道怎么样才能在执行上面命令的时候不用输入密码,你可以看看这一篇 设置 SSH keys ,下次登录就不用输入密码了