Slip Ahead Logging

It's not your fault at all.

git に track されていないファイルを dired でマークする

必要にかられたので作成.表題の通り.

(defun dired-mark-git-untracked-files ()
  "Mark files not tracked in git in current dired session"
  (interactive)
  (let ((untracked-files (make-hash-table :test 'equal))
        (command (format "cd %s &&\
                          git ls-files --others" dired-directory)))
    (with-temp-buffer
      (flet ((message (&rest args) nil))
        (shell-command command (current-buffer) (current-buffer)))
      (goto-char (point-min))
      (while (not (eobp))
        (puthash (buffer-substring (line-beginning-position) (line-end-position))
                 t
                 untracked-files)
        (forward-line 1)))
    ;; In dired buffer
    (save-excursion
      (goto-char (point-min))
      (while (not (eobp))
        (condition-case nil
            (when (gethash (dired-get-filename t) untracked-files nil)
              (let ((inhibit-read-only t))
                (forward-line 0)
                (delete-char 1)
                (insert dired-marker-char)))
          (error nil))
        (forward-line 1)))))

様々なレイテンシ

いま話題のレイテンシ.数値に対する感覚は重要だ.

Latency numbers every programmer should know — Gist

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
Read 1 MB sequentially from memory ..... 250,000 ns  = 250 µs
Round trip within same datacenter ...... 500,000 ns  = 0.5 ms
Disk seek ........................... 10,000,000 ns  =  10 ms
Read 1 MB sequentially from disk .... 20,000,000 ns  =  20 ms
Send packet CA->Netherlands->CA .... 150,000,000 ns  = 150 ms

readline, libedit, linenoise

  • readline
  • libedit
  • linenoise
    • 600行強とシンプル
      • レガシーなUNIXへの対応を全く行わないことで,これを実現している
      • それでも2010年時点で使われているUNIXの99.9%以上では正しく動作するとか
    • Android のコアライブラリに同梱されているらしい

Treasure Data

Treasure Data はいわゆるログ解析基盤のためのクラウドサービスです。 (現在 beta ですが、利用させていただいています)。 TD は、

  • ログをいくらでも貯めこんでくれる
  • HiveQL を client 経由で投げるとクラウドの向こう側で Hadoop が起動し結果を返してくれる
  • クエリをスケジューラに入れておくと、定期的にその解析結果を MySQL などに突っ込んでくれる。こちらから閲覧するときはそれを SELECT するだけ

と、かゆいところに手が届くサービスです。

http://engineering.crocos.jp/post/21478792903/crocos

このようなサービスだったのか.

データ解析を行なうクラウドサービスの課題は多い.私がぱっと思いつくものだけでも,プライバシー保護の必要性や,データ転送によるレイテンシなどがある.

こうした課題が解決され,コンサルティングを含めた緻密なサービスが提供されるようになれば,企業におけるデータの解析・マイニングの光景も,今とは異なったものとなるのかもしれない.

まあ,私はその「今」を知らないわけですが.