git を使って未処理/処理済みを管理する思いつきメモ

datetime=`date +%Y%m%d-%H%M%S`

untracked_files=`git ls-files --others --exclude-standard --full-name`
modified_files=`git ls-files --modified --exclude-standard --full-name`
for untracked_file in $untracked_files; do untracked_file_process $untracked_file done for modified_file in $modified_files; do modified_file_process $modified_file done git add . git commit -a -m $datetime git push origin `git rev-parse --abbrev-ref HEAD` xxx_file_process は static_content_minify とか


WebSocket 弾幕

WebSocket 通信とHTML5の学習を目的とした

ブラウザ上で弾幕を表示する趣味アプリ

※WebSocket 通信とHTML5が無知な状態から

イメージとしては、サーバ側が弾幕の玉を出す命令をだし、

ブラウザ上で弾幕を表示する。

実際にできるのかはやってみないとわからん。

これにより、

サーバパフォーマンステストとクライアントパフォーマンステスト的ななにかと、

このアプリの場合、MVCを サーバとクライアントで分断してるのかしら

的な感覚をつかむこと。

 

 

まずは言葉の定義の理解から

WebSocket とは http://ja.wikipedia.org/wiki/WebSocket

rfc6455(http://tools.ietf.org/html/rfc6455)

ふむ。

プロトコルについて、最初は http リクエストするけど、

そのレスポンスで(サーバ側で) 101 Swicthing protocol を返すことで、

ws: または wss: のスキームに変化する。

ふむふむ。

もちろん、WebSocket プロトコルを理解できるサーバおよびクライアントが

用意されることが前提ですね。

 

今日は WebSocket の概要を知ってみただけ。

次回は、rfc6455 を読む。

 

CLI Server Dynamic Monitoring Tools

 

[サーバリソース全体の概要をウォッチする] 


[top] 

言わずと知れた タスク/プロセス/Load/Cpu/Memory/Swap の概要情報を表示する

 Description : N/A

f:id:president_hanage:20140128150624p:plain

[atop]

topで表示する内容にNetwork/Disk が追加され、より詳細に表示。

Description : An advanced interactive monitor for Linux-systems to view the load on

            : system-level and process-level.

            : The command atop has some major advantages compared to other

            : performance-monitors:

            :    - Resource consumption by all processes

            :    - Utilization of all relevant resources

            :    - Permanent logging of resource utilization

            :    - Highlight critical resources

            :    - Watch activity only

            :    - Watch deviations only

            :    - Accumulated process activity per user

            :    - Accumulated process activity per program

            : For more informations: http://www.atcomputing.nl/Tools/atop

            : The package does not make use of the patches available at

            : http://www.atcomputing.nl/Tools/atop/kernpatch.html

 f:id:president_hanage:20140128150205p:plain

 [htop]

top がカラーになって新登場。

Description : htop is an interactive text-mode process viewer for Linux, similar to top(1).

f:id:president_hanage:20140128152140p:plain

[glances]

表示内容は top とほぼ変わらず。(Python で書かれいる)

Description : Glances is a CLI curses based monitoring tool for both GNU/Linux and BSD. Glances uses the PsUtil library to get information from your system. It is developed in Python.

f:id:president_hanage:20140128153234p:plain

 

[ディスク/ファイルに関するリソースの詳細をウォッチする]


 [iotop]

ディスクI/O 発生量をプロセスと共にリスト表示する

Description : Linux has always been able to show how much I/O was going on

            : (the bi and bo columns of the vmstat 1 command).

            : iotop is a Python program with a top like UI used to

            : show of behalf of which process is the I/O going on.

f:id:president_hanage:20140128154236p:plain

[ftop]

プロセスで使用しているファイルをツリー形式で表示

Description : Ftop is to files what top is to processes. The progress of all open files

            : file systems can be monitored.

            : The selection of which files to display is possible through

            : a wide assortment of options. As with top, the items are displayed in

            : order from most to least active.

f:id:president_hanage:20140128154544p:plain

 

[ネットワークに関するリソースの詳細をウォッチする]


[iftop]

ネットワークトラフィック量に関する表示

Description : iftop does for network usage what top(1) does for CPU usage. It listens to

            : network traffic on a named interface and displays a table of current bandwidth

            : usage by pairs of hosts. Handy for answering the question "why is our ADSL link

            : so slow?".

f:id:president_hanage:20140128161550p:plain

[jnettop]

iftop よりちょっとだけ詳細に。

Description : Nettop is visualising active network traffic as top does with processes.

            : It displays active network streams sorted by bandwidth used. This is

            : often usable when you want to get a fast grip of what is going on on your

            : outbound router.

f:id:president_hanage:20140128162041p:plain

[ntop] 

これはいいや

[netstat]

watchと組み合わせて $ watch netstat -lnput な感じ

 [カーネルに関するリソースの詳細をウォッチする]


 [slabtop]

カーネル slab キャッシュ情報を表示する

Description : N/A

f:id:president_hanage:20140128162515p:plain

 

 

 

Perl モジュールインストール

任意の Perl プログラムで使用しているモジュールをインストールする

$ sudo cpanm Module-Used
$ find ........... | xargs modules-used | sudo xargs cpanm

 ※ modules-used は cpanm Module-Used で。

 

perl::empty like php


sub empty
{
    my ( $val_ref ) = @_;

    #return 1 unless defined $val_ref;
    unless ( my $ref = ref $val_ref ) {
        return $val_ref ? 0 : 1;
    }
    elsif ( $ref eq 'SCALAR' ) {
        return $$val_ref ? 0 : 1;
    }
    elsif ( $ref eq 'ARRAY' ) {
        return scalar @{$val_ref} ? 0 : 1;
    }
    elsif ( $ref eq 'HASH' ) {
        return scalar keys %{$val_ref} ? 0 : 1;
    }

    return undef;
}