為替レートのヒストリカルデータ

随分前にFXに手を出して、あっという間に目減りして投げ出してしまっていた。久しぶりに手を出してみようと思うが、今度は自分の直感を信じない方式で行きたい。なにはともあれヒストリカルデータは欲しいので調べてみたところ、みずほ銀行の提供しているデータが使いやすそうだ(2002年からの日次データ): 
www.mizuhobank.co.jp

あとはm^2J(2007年からの日次データ):
www.m2j.co.jp

毎時、毎日のトレードなんかしたくないので当面はこのデータでよかろう。

Archlinux で docker

ほぼ全部参考サイトからのコピペ。まずは探してみる。バージョンは 0.11 らしい:

$ sudo pacman -Ss docker
extra/docker-tray 1.5-1
    Docker is a docking application (WindowMaker dock app) which acts as a
    system tray for KDE and GNOME2.
community/docker 1:0.11.1-1
    Pack, ship and run any application as a lightweight container


インストールと確認:

$ sudo pacman -S docker
(snip)
$ docker version


サービス起動と自動起動設定:

$ sudo systemctl start docker
$ sudo systemctl status docker
$ sudo systemctl enable docker


コンテナ起動。イメージを落とすので時間がかかる:

$ sudo docker run -t centos /bin/echo "hello docker"
(snip)
hello docker


イメージの確認とコンテナの表示:

$ sudo docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
centos              centos6             0b443ba03958        6 weeks ago         297.6 MB
centos              latest              0b443ba03958        6 weeks ago         297.6 MB
centos              6.4                 539c0211cd76        14 months ago       300.6 MB

$ sudo docker ps -a
CONTAINER ID        IMAGE               COMMAND                CREATED             STATUS                     PORTS               NAMES
b9eae0cbf744        centos:centos6      /bin/echo 'hello doc   3 minutes ago       Exited (0) 3 minutes ago                       sad_leakey          


インタラクティブに実行:

$ sudo docker run -i -t centos /bin/bash
bash-4.1# whoami
root
bash-4.1# yum update -y
(snip)
bash-4.1# exit


終了したのでコンテナの確認。一つ増えた:

$ sudo docker ps -a
CONTAINER ID        IMAGE               COMMAND                CREATED             STATUS                      PORTS               NAMES
ab232d7cecb5        centos:centos6      /bin/bash              4 minutes ago       Exited (0) 23 seconds ago                       berserk_mclean      
b9eae0cbf744        centos:centos6      /bin/echo 'hello doc   12 minutes ago      Exited (0) 12 minutes ago                       sad_leakey    


これを保存して再実行:

$ sudo docker commit ab232d7cecb5 centos:updated
cf47b504c2dfd6a80515c56185cfaf8b10fafcb9efda145ad375ce3917119d88

$ sudo docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
centos              updated             cf47b504c2df        20 seconds ago      483.4 MB
centos              centos6             0b443ba03958        6 weeks ago         297.6 MB
centos              latest              0b443ba03958        6 weeks ago         297.6 MB
centos              6.4                 539c0211cd76        14 months ago       300.6 MB

$ sudo docker run -i -t centos:updated /bin/bash
bash-4.1# 


テスト用コンテナを全削除&さっき作ったイメージの削除:

$ sudo docker ps -aq | xargs sudo docker rm 
8b09c80b2318
a0d51a8494d2
ab232d7cecb5
b9eae0cbf744

$ sudo docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES

$ sudo docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
centos              updated             cf47b504c2df        6 minutes ago       483.4 MB
centos              centos6             0b443ba03958        6 weeks ago         297.6 MB
centos              latest              0b443ba03958        6 weeks ago         297.6 MB
centos              6.4                 539c0211cd76        14 months ago       300.6 MB

$ sudo docker rmi cf47b504c2df
Untagged: centos:updated
Deleted: cf47b504c2dfd6a80515c56185cfaf8b10fafcb9efda145ad375ce3917119d88


参考:

AWS EC2 で iptables の初期設定

取り敢えず現状の設定を保存する:

$ sudo iptables-save > iptables.org
$ cat iptables.org
# Generated by iptables-save v1.4.18 on Wed Jun  4 03:52:40 2014
*filter
:INPUT ACCEPT [231:16836]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [143:12612]
COMMIT
# Completed on Wed Jun  4 03:52:40 2014


これをコピーして編集:

$ cat iptables.new
# Generated by iptables-save v1.4.18 on Wed Jun  4 03:52:40 2014
*filter
:INPUT DROP [0:0]
:FORWARD DROP [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
COMMIT
# Completed on Wed Jun  4 03:52:40 2014


restore して save する:

$ sudo iptables-restore < iptables.new
$ sudo iptables -L
$ sudo /etc/rc.d/init.d/iptables save


参考: