2014年1月22日 星期三

websocketd

Like inetd, but for WebSockets. Turn any application that uses STDIN/STDOUT into a WebSocket server.
https://github.com/joewalnes/websocketd/wiki

可寫個bash就能把這個bash轉到Websocket上,用Websocket的send()就可以傳給這個bash的STDIN,STDOUT就會傳到Websocket的onmessage(event)裡。

執行時可下參數 --devconsole就會有個console在web上,方便debug

參數--staticdir=web可將web裡的html檔或其他靜態檔讓client存取,不用另外開web server

連接websocket時,可用new WebSocket('ws://' + location.host + '/');

2014年1月13日 星期一

Clojure

http://en.wikipedia.org/wiki/Clojure
Lisp的變體,可以在JVM、CLR、Javascript engine上面執行。像Lisp一樣,它是code as data(Homoiconicity),還有個複雜的巨集系統。
http://www.clojure-toolbox.com/
a Clojure Language Crash Course

特點應該是Concurrent programming和Multithread

2014年1月10日 星期五

Install wxPython on CentOS

http://pkgs.org/centos-6/epel-x86_64/wxPython-2.8.12.0-1.el6.x86_64.rpm.html

Install Howto

  1. Download the latest epel-release rpm from
    http://dl.fedoraproject.org/pub/epel/6/x86_64/
  2. Install epel-release rpm:
    # rpm -Uvh epel-release*rpm
  3. Install wxPython rpm package:
    # yum install wxPython

2014年1月9日 星期四

Python proxy設定

必需設定環境變數http_proxy和https_proxy
% export http_proxy=http://your.proxy.server:port
% export https_proxy=http://your.proxy.server:port

2013年12月12日 星期四

How to PAUSE and CONTINUE a Linux process

Use kill command to send -STOP signal to pause a process and -CONT signal to continue it.

Example on CentOS6 Desktop:
1. Open a Terminal (name as T1) on Desktop and send "ps -aux | grep bash" to see how much bash in there.

2. Open another Terminal (name as T2) on Desktop and on T1 send "ps -aux | grep bash" to see process id of new created bash (T2)

3. On T1, send "kill -STOP " to pause T2
>T2 is hang

4. On T1, send "kill -CONT " to continue T2
>T2 is back to work
This is useful if a script is running on T2 and you want to pause it and continue it later

Reference:
http://tombuntu.com/index.php/2007/11/23/how-to-pause-a-linux-process/