2014年11月9日 星期日

play docker on windows

1. Install boot2docker
Download the installer
https://github.com/boot2docker/windows-installer/releases
This will install boot2docker, VirtualBox and git for windows

2. Start the boot2docker
Execute "Git Bash"
$ boot2docker start
$ boot2docker ip
Using the ip address to login boot2docker vm

3. Using putty to login boot2docker vm
IP: (get from previous step)
port: 22
username: docker
password: tcuser

4. create a my-data container to share folder & a samba container
docker run -v /data --name my-data busybox true
docker run --rm -v /usr/local/bin/docker:/docker -v /var/run/docker.sock:/docker.sock svendowideit/samba my-data
(you can access share file in /(boot2docker's ip)/data in host windows)

5. Run a ubuntu container
$ docker run -it --volumes-from=my-data ubuntu
$
(you will in the container, using ctrl+p ctrl+q to detach)

6. check all container status
$ docker ps -a
(container id will be list)

7. Attach previous ubuntu container
$ docker attach [Container ID]
(just key-in the few heading numbers of container ID is OK)

8. Start playing around in container (in container)
$ apt-get update
$ apt-get install xxxxx
$ exit
(Will back to boot2docker vm)

9. Commit the container to a image
$ docker commit [Contain ID] your_name/image_name:tag

10. List all docker images
$ docker images
(previous commit image will be list)

11. Run a new container on new created image
$ docker run -it --volumes-from=my-data your_name/image_name:tag
$ exit

12. Delete container
$ docker rm [Container ID]

13. Delete image
$ docker rmi [image_name]

14. Back to "Git Bash", save the status of boot2docker
$ boot2docker save
(running status of boot2docker vm is saved)

15. resume boot2docker vm
$ boot2docker up

build freeipmi rpm on centos

1. install packages
#yum install rpm-build make gcc libgcrypt-devel texinfo

2. build rpms
#rpmbuild -ta freeipmi-X.Y.Z.tar.gz

Build ipmitool 1.8.18 rpm
# bunzip2 -c ipmitool-1.8.18.tar.bz2 | gzip -c > ipmitool-1.8.18.tar.gz
# rpmbuild -ta ipmitool-1.8.18.tar.gz

The ipmitool 1.8.18 rpm file is put on ~/rpmbuild/RPMS

2014年9月12日 星期五

pushd & popd

d就是directory,pushd 之後馬上切換到 路徑,在pushd 之後馬上在切換到,popd會切到,在popd一次會切到最一開始的路徑。
通常應該是寫bash script比較會用到
在這看到的應用(build docker images的script)
https://github.com/CentOS/CentOS-Dockerfiles
Wiki:
http://en.wikipedia.org/wiki/Pushd_and_popd

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