OCNモバイルONE開通までの流れ
月末にOCNモバイルONE(音声対応)に申し込んで、開通までの流れを記録した。MNPはしていない。
月末は混むといわれているが、7営業日(+週末2日)で全て完了したので、まあ順調だったな方ではなかろうか。
第1週 月曜
goo SimSellerでgooのスマホ+OCNモバイルONE(音声対応)を注文
第1週 火曜(1営業日経過)
クレジットカード決済が完了した旨のメールが届く
第1週 水曜(2営業日経過)
商品が発送された旨のメールが届く
第1週 木曜(3営業日経過)
商品が到着(gooのスマホ+OCNモバイルONEの申込書)
申込書に従い、OCNモバイルONEフォームにアクティベーションコード等を入力して、SIM申し込み
ここからOCNモバイルONEのSIMが届くまでできること
- Wi-Fiを使った通信
- SMS認証を必要としないアプリ
第1週 金曜(4営業日経過)
OCNモバイルONE申込受付完了の旨のメールが届く
第2週 月曜(5営業日経過+週末2日)
OCNモバイルONEのSIMが到着
ここからOCN会員登録証が届くまでできること
- 4G/3G通信(ただしOCNモバイルONEアプリの利用(通信量の確認等)は不可)
- SMS認証を必要とするアプリ
第2週 水曜(7営業日経過+週末2日)
OCN会員登録証が到着
登録証に記載されたメールアカウントでメールを確認すると、050plusの番号とパスワードが記載されたメールが届いていた
ここからできること
- OCNモバイルONEアプリ
- 050plusアプリ
- OCN光モバイル割申し込み(OCN光を使っていれば)
google-java-formatをEmacsとCotEditorとVimで使う
google-java-formatはGoogle Java Styleに合わせてJavaコードを整形してくれるツール。とあるのだが、実際整形してくれるのは長すぎる行の折り返しやインデント調整などだけで、import文のソートや定数名の大文字化などは(まだ)してくれない、微妙なツール。
ビルド
HomebrewなどでJava>=1.7とMavenをインストールしておく。
$ pwd ~/local/src $ git clone https://github.com/google/google-java-format.git $ cd google-java-format/ $ mvn clean package --projects core $ ls core/target/ classes/ maven-status/ generated-sources/ original-google-java-format-0.1-SNAPSHOT.jar generated-test-sources/ surefire-reports/ google-java-format-0.1-SNAPSHOT.jar test-classes/ maven-archiver/ $ cd ~/local/bin $ cat <<EOF > google-java-format #!/bin/bash java -jar ~/local/src/google-java-format/core/target/google-java-format-0.1-SNAPSHOT.jar $@ EOF $ chmod a+x google-java-format
これで google-java-format
コマンドが使えるようになった。
Emacsで使う
~/.emacs.d/init.el に以下設定を追加する。
;; load-pathが通っているところに google-java-format.el を持ってくるか、以下を追加 ; (load "~/local/src/google-java-format/core/src/main/scripts/google-java-format.el") (require 'google-java-format) (setq google-java-format-executable "~/local/bin/google-java-format")
Javaファイルを開き
M-x google-java-format-buffer
でバッファ全体が整形される- リージョン選択してから
M-x google-java-format-region
でその選択部分のみ整形される
CotEditorで使う
~/Library/Application\ Support/CotEditor/ScriptMenu/ に以下の内容のファイルを追加する。
#!/bin/bash # # %%%{CotEditorXInput=AllText}%%% # %%%{CotEditorXOutput=ReplaceAllText}%%% FORMATTED=`~/local/bin/google-java-format -` echo "$FORMATTED"
CotEditorを起動し直すかスクリプトメニューを更新して、Javaファイルを開きメニューバーから実行すると、開いているファイル内容全体が整形される。
CotEditorスクリプトに選択行番号(or 開始・終了オフセット)を渡せれば、選択範囲のみ整形もできるのだが、できなさそう。
NetflixのgithubリポジトリはWeb技術の百貨店だった
検索しているとなにかとNetflixのgithubリポジトリがヒットするので、全部(2015/07/18現在分)調査してみた。
github APIで https://github.com/Netflix のリストを全部取得して、名前・概要・URL・最終更新日時 (なんの更新だ?) を抽出。
AWS用のプロダクトが多かったのでまずそれらと、その他という分類にした。その他はほとんどがJavaライブラリ・システムだが、一部WebアプリケーションやPythonライブラリがある。
日本語での説明はReadmeやWikiを見て書いているが、理解が正しくないかもしれない。
AWS用
aws-autoscaling
Tools and Documentation about using Auto Scaling
- URL: https://github.com/Netflix/aws-autoscaling
- Last updated: 2015-07-02T19:52:09Z
AWSでオートスケーリングを使うときのためのup/downスクリプトとドキュメント。
asgard
Web interface for application deployments and cloud management in Amazon Web Services (AWS). Binary download: http://github.com/Netflix/asgard/releases Snapshot builds: https://netflixoss.ci.cloudbees.com/job/asgard-master/ Twitter: http://twitter.com/AsgardOSS
- URL: https://github.com/Netflix/asgard
- Last updated: 2015-07-16T16:43:30Z
AWSのアプリケーションデプロイや管理のためのWebアプリケーション。
SimianArmy
Tools for keeping your cloud operating in top form. Chaos Monkey is a resiliency tool that helps applications tolerate random instance failures.
- URL: https://github.com/Netflix/SimianArmy
- Last updated: 2015-07-18T03:20:21Z
AWSオートスケーリング環境をより安全に、効率的にするための補助ツール。
eureka
AWS Service registry for resilient mid-tier load balancing and failover.
- URL: https://github.com/Netflix/eureka
- Last updated: 2015-07-18T04:15:02Z
AWS環境内でロードバランシング、フェールオーバを実現するためのシステム。AWS Elastic Load Balancerとは違うらしい。
edda
Service to track changes in your cloud
- URL: https://github.com/Netflix/edda
- Last updated: 2015-07-15T02:40:33Z
AWSリソース、履歴管理のためのツール。
frigga
Utilities for working with Asgard named objects
- URL: https://github.com/Netflix/frigga
- Last updated: 2015-06-15T20:49:29Z
AWS object nameの生成、パースのためのライブラリ。Asgardで使われる。
aminator
A tool for creating EBS AMIs. This tool currently works for CentOS/RedHat Linux images and is intended to run on an EC2 instance.
- URL: https://github.com/Netflix/aminator
- Last updated: 2015-07-17T14:20:14Z
AWSでマシンイメージを作るためのツール。
ice
AWS Usage Tool
- URL: https://github.com/Netflix/ice
- Last updated: 2015-07-17T18:06:16Z
AWS利用のための補助ツールとWebアプリケーション。
アカウント、リージョン、サービス、リソース利用状況の管理など。
glisten
Ease of use Groovy library for building JVM applications with Amazon Simple Workflow (SWF)
- URL: https://github.com/Netflix/glisten
- Last updated: 2015-07-15T13:53:17Z
Amazon Simple Workflow Service (SWF) アプリケーションをGroovyで実装するためのライブラリ。
s3mper
s3mper - Consistent Listing for S3
- URL: https://github.com/Netflix/s3mper
- Last updated: 2015-07-08T01:14:31Z
Amazon S3のインデックス一貫性をチェックするためのツール。
security_monkey
Security Monkey
- URL: https://github.com/Netflix/security_monkey
- Last updated: 2015-07-17T19:22:31Z
AWSアカウント情報のセキュアでない部分の発見・警告をするツール。
その他
astyanax
Cassandra Java Client
- URL: https://github.com/Netflix/astyanax
- Last updated: 2015-07-17T12:09:51Z
Cassandraクライアントライブラリ。Hectorより良いらしい。
通常のCassandra利用の他、recipesで行ロックやオブジェクトストア、Reverse Index検索、メッセージキューを実現するAPIを提供している。
curator
ZooKeeper client wrapper and rich ZooKeeper framework
- URL: https://github.com/Netflix/curator
- Last updated: 2015-07-17T17:23:27Z
Zookeeperクライアントライブラリ。
全体はApache Curatorになったので、Netflix拡張のみがある。今はzkclientとのブリッジAPIだけ。
Priam
Co-Process for backup/recovery, Token Management, and Centralized Configuration management for Cassandra.
- URL: https://github.com/Netflix/Priam
- Last updated: 2015-07-18T01:33:51Z
Cassandra補助ツール。
バックアップ・リカバリ、トークン管理、シードディスカバリ、設定管理、AWSサポート、など。REST APIを提供している。
CassJMeter
JMeter plugin to run cassandra tests.
- URL: https://github.com/Netflix/CassJMeter
- Last updated: 2015-06-15T20:43:38Z
Cassandra性能計測用Apache JMeterプラグイン。
servo
Netflix Application Monitoring Library
- URL: https://github.com/Netflix/servo
- Last updated: 2015-07-17T09:47:59Z
簡単にJMX MBeanを実装するためのライブラリ。
exhibitor
ZooKeeper co-process for instance monitoring, backup/recovery, cleanup and visualization.
- URL: https://github.com/Netflix/exhibitor
- Last updated: 2015-07-16T16:58:25Z
Zookeeper補助ツール。
データバックアップ・リストア、ログ整理、ZKノード可視化など。REST APIを提供している。
netflix.github.com
- URL: https://github.com/Netflix/netflix.github.com
- Last updated: 2015-07-15T10:17:57Z
gradle-template
- URL: https://github.com/Netflix/gradle-template
- Last updated: 2015-07-15T07:28:47Z
archaius
Library for configuration management API
- URL: https://github.com/Netflix/archaius
- Last updated: 2015-07-14T04:30:42Z
Javaプロダクト設定管理のためのAPIを提供するライブラリ。Apache commons configurationの拡張として実装されている。
ZookeeperやDBから設定情報を取得し動的な設定反映を実現できる。
governator
Governator is a library of extensions and utilities that enhance Google Guice to provide: classpath scanning and automatic binding, lifecycle management, configuration to field mapping, field validation and parallelized object warmup.
- URL: https://github.com/Netflix/governator
- Last updated: 2015-07-10T04:01:42Z
Google Guice拡張ライブラリ。
クラスパス制御、設定情報、バリデーションなどのためのアノテーションを提供する。
netflix-commons
Common utilities for Netflix OSS projects
- URL: https://github.com/Netflix/netflix-commons
- Last updated: 2015-06-20T17:27:53Z
Netflixプロダクトで使われる共通ライブラリ。
blitz4j
Logging framework for fast asynchronous logging
- URL: https://github.com/Netflix/blitz4j
- Last updated: 2015-07-17T15:42:19Z
ロギングライブラリ。
Hystrix
Hystrix is a latency and fault tolerance library designed to isolate points of access to remote systems, services and 3rd party libraries, stop cascading failure and enable resilience in complex distributed systems where failure is inevitable.
- URL: https://github.com/Netflix/Hystrix
- Last updated: 2015-07-18T05:04:17Z
分散システムの依存関係を整理し、部分ダウンなどによる失敗に対し速やかなリカバリを実現するためのシステム。
レイテンシなどを可視化するダッシュボードを提供する。
Turbine
SSE Stream Aggregator
- URL: https://github.com/Netflix/Turbine
- Last updated: 2015-07-13T07:47:44Z
Server-Sent Event JSONデータストリームを1つにまとめるツール。Hystrixのダッシュボードで使われている。
ribbon
Ribbon is a Inter Process Communication (remote procedure calls) library with built in software load balancers. The primary usage model involves REST calls with various serialization scheme support.
- URL: https://github.com/Netflix/ribbon
- Last updated: 2015-07-16T16:08:58Z
ロードバランシング、フォールトトレラント、非同期モデルによるHTTP/TCP/UDP通信、キャッシング・バランシングを実現するためのクライアントライブラリ。
denominator
Portably control DNS clouds using java or bash
- URL: https://github.com/Netflix/denominator
- Last updated: 2015-07-10T01:19:47Z
DNS制御ツール・ライブラリ。
karyon
The nucleus or the base container for Applications and Services built using the NetflixOSS ecosystem
- URL: https://github.com/Netflix/karyon
- Last updated: 2015-07-15T14:13:48Z
Netflixプロダクトなどを活用した、Webサービス実装のためのフレームワーク。
Governator、Archaius、Eureka等に対応。
EVCache
A distributed in-memory data store for the cloud
- URL: https://github.com/Netflix/EVCache
- Last updated: 2015-06-15T20:49:06Z
Memcachedとspymemcachedをベースにした、オンメモリデータストア。
recipes-rss
RSS Reader Recipes that uses several of the Netflix OSS components
- URL: https://github.com/Netflix/recipes-rss
- Last updated: 2015-07-15T21:55:01Z
archaius、astyanax、blitz4j、eureka、governator、hystrix、karyon、ribbon、servoの利用の参考にするためのコード。
Cloud-Prize
Description and terms for the Netflix Cloud Prize, which runs from March-September 2013. Read the rules, fork to your GitHub account to create a Submission, then send us your email address.
- URL: https://github.com/Netflix/Cloud-Prize
- Last updated: 2015-06-15T20:46:06Z
netflix-graph
Compact in-memory representation of directed graph data
- URL: https://github.com/Netflix/netflix-graph
- Last updated: 2015-07-10T07:09:16Z
有向グラフデータを扱うためのライブラリ。
zuul
Zuul is an edge service that provides dynamic routing, monitoring, resiliency, security, and more.
- URL: https://github.com/Netflix/zuul
- Last updated: 2015-07-17T09:42:44Z
認証、モニタリング、リクエストの動的ルーティング、ストレステスト、リクエスト・レスポンスの制御などを扱うためのライブラリ。
Webアプリケーションの前面に設置する。
suro
Netflix's distributed Data Pipeline
- URL: https://github.com/Netflix/suro
- Last updated: 2015-07-17T09:47:52Z
分散データストリームシステム。受け取ったデータをファイルに書き出したり、分散ファイルシステムに書き出したりする。
Apache Kafkaとも連携する。
brutal
A multi-network asynchronous chat bot framework using twisted
- URL: https://github.com/Netflix/brutal
- Last updated: 2015-07-01T18:35:40Z
pytheas
Web Resources and UI Framework
- URL: https://github.com/Netflix/pytheas
- Last updated: 2015-06-15T20:51:15Z
データ可視化のためのWebアプリケーションを構築するためのライブラリ。Jerseyベース。
gcviz
Garbage Collector Visualization Tool/Framework
- URL: https://github.com/Netflix/gcviz
- Last updated: 2015-06-18T16:47:10Z
JVMのガベージコレクションログを可視化するWebアプリケーション。
Lipstick
Pig Visualization framework
- URL: https://github.com/Netflix/Lipstick
- Last updated: 2015-07-15T22:21:50Z
Apache Pigのワークフローを可視化するWebアプリケーション。
NfWebCrypto
Web Cryptography API Polyfill
- URL: https://github.com/Netflix/NfWebCrypto
- Last updated: 2015-07-16T19:24:34Z
W3C Web Cryptography API実装の1つ。Google Chrome (amd64 Linux) 用プラグインで、実用的ではなさそう。
genie
Federated Job Execution Engine
- URL: https://github.com/Netflix/genie
- Last updated: 2015-07-15T02:37:47Z
feign
Feign makes writing java http clients easier
- URL: https://github.com/Netflix/feign
- Last updated: 2015-07-18T00:13:52Z
JavaでHTTPクライアントを実装するためのライブラリ。
Nicobar
- URL: https://github.com/Netflix/Nicobar
- Last updated: 2015-07-16T19:32:51Z
動的モジュール読み込みアプリケーションを実装するためのライブラリ。
blesk
Netflix blesk is a lightweight client for pushing notifications to web based applications/sites.
- URL: https://github.com/Netflix/blesk
- Last updated: 2015-06-15T20:45:42Z
Bleskサーバを持つWebアプリケーションに通知を送信するためのクライアントライブラリ。
Bleskサーバの実装が無いため詳細不明。
dynomite
A generic dynamo implementation for different k-v storage engines
- URL: https://github.com/Netflix/dynomite
- Last updated: 2015-07-17T02:43:03Z
Dynamoにインスパイアされた分散KVS。
RedisかMemcachedに依存している。
aegisthus
A Bulk Data Pipeline out of Cassandra
- URL: https://github.com/Netflix/aegisthus
- Last updated: 2015-07-16T10:09:57Z
Cassandraに保存されたデータ (SSTable) をMapReduce/Pigで処理するためのライブラリ。
zeno
Netflix's In-Memory Data Propagation Framework
- URL: https://github.com/Netflix/zeno
- Last updated: 2015-07-17T15:29:15Z
データ管理・分配のためのオンメモリシステム。
staash
A language-agnostic as well as storage-agnostic web interface for storing data into persistent storage systems, the metadata layer abstracts a lot of storage details and the pattern automation APIs take care of automating common data access patterns.
- URL: https://github.com/Netflix/staash
- Last updated: 2015-07-13T14:36:20Z
PigPen
Map-Reduce for Clojure
- URL: https://github.com/Netflix/PigPen
- Last updated: 2015-07-15T13:32:07Z
ClojureでMapReduceアプリケーションを実装するためのライブラリ。Clojureで書くとPigかCascadingのコードに変換される。
fabricator
- URL: https://github.com/Netflix/fabricator
- Last updated: 2015-07-07T20:51:37Z
DI (Dependency Injection) ライブラリ。
Fido
- URL: https://github.com/Netflix/Fido
- Last updated: 2015-07-12T15:10:11Z
マルウェア検出などに前後する人手のセキュリティタスクを効率化するためのツール。
dyno
Java client for Dynomite
- URL: https://github.com/Netflix/dyno
- Last updated: 2015-06-26T05:53:36Z
Dynomite用Javaクライアントライブラリ。
ReactiveLab
Experiments and prototypes with reactive application design.
- URL: https://github.com/Netflix/ReactiveLab
- Last updated: 2015-07-15T17:18:25Z
サービス指向アーキテクチャ + Reactive application designのための実験的なコード集、とあるが要するにReactiveX (RxJava)を使ったコード集。
msl
Message Security Layer
- URL: https://github.com/Netflix/msl
- Last updated: 2015-07-15T01:52:46Z
セキュアなメッセージング層の実装。認証、キー交換などをサポート。
spectator
- URL: https://github.com/Netflix/spectator
- Last updated: 2015-06-29T16:16:56Z
多次元時系列データを記録するためのライブラリ。主にServoと連携し、Javaアプリケーション内の指標の記録を目的としているよう。
inviso
- URL: https://github.com/Netflix/inviso
- Last updated: 2015-06-24T06:46:04Z
sketchy
- URL: https://github.com/Netflix/sketchy
- Last updated: 2015-07-06T22:06:35Z
Webページのスクリーンショット取得、スクレイプのためのアプリケーション
PhantomJSを使用しJSレンダリングにも対応。
atlas
- URL: https://github.com/Netflix/atlas
- Last updated: 2015-07-17T16:35:04Z
多次元時系列データ管理システムとライブラリ。欠損値の扱いに対応したインタラクティブな集計、チャートによる可視化ができる。
Atlas Stack Languageという独自クエリを用いる。
Scumblr
- URL: https://github.com/Netflix/Scumblr
- Last updated: 2015-07-17T15:53:02Z
Googleなど検索エンジンやAppStore、SNSなどを定期的に検索し、結果を保存、条件に応じて処理を実行するWebアプリケーション。
Workflowable
- URL: https://github.com/Netflix/Workflowable
- Last updated: 2015-07-17T17:47:15Z
ワークフロー (処理の流れ) を定義するためのライブラリ。
Raigad
Co-Process for backup/recovery, Auto Deployments and Centralized Configuration management for ElasticSearch
- URL: https://github.com/Netflix/Raigad
- Last updated: 2015-07-09T13:44:31Z
Elasticsearchデータのバックアップ・リストア、設定情報のデプロイ、ノードのデプロイ・モニタリングをサポートするためのツール。
Prana
A sidecar for your NetflixOSS based services.
- URL: https://github.com/Netflix/Prana
- Last updated: 2015-07-13T16:47:15Z
Netflixプロダクトを容易に使うためのWebアプリケーション。Karyonベース。
EurekaやRibbon、Archaiusなどに対応。
ocelli
- URL: https://github.com/Netflix/ocelli
- Last updated: 2015-06-23T15:49:02Z
ロードバランシングをリアクティブに実装するためのクライアントライブラリ。
Wikiを見ると前はRxLoadBalancerという名前だったよう。
iep
Insight Engineering Platform Components
- URL: https://github.com/Netflix/iep
- Last updated: 2015-07-15T11:24:02Z
iep-shadow
Shadowed versions of rx/platform libraries for Insight Engineering Platform use
- URL: https://github.com/Netflix/iep-shadow
- Last updated: 2015-06-15T20:50:08Z
上記iepで利用するライブラリ。普通はここを参照することはなさそう。
netflixoss-build-infrastructure
Project used to test our gradle publishing to bintray
- URL: https://github.com/Netflix/netflixoss-build-infrastructure
- Last updated: 2015-06-18T19:07:27Z
Surus
- URL: https://github.com/Netflix/Surus
- Last updated: 2015-07-15T08:08:08Z
Pig・Hive用UDF。現在は予測モデル評価、異常検知についてのコードがある。
vector
Vector is an on-host performance monitoring framework which exposes hand picked high resolution metrics to every engineer’s browser.
- URL: https://github.com/Netflix/vector
- Last updated: 2015-07-17T06:45:32Z
サーバモニタリング・可視化Webアプリケーション。Performance Co-Pilotに依存している。
security-bulletins
Security Bulletins that relate to Netflix Open Source
- URL: https://github.com/Netflix/security-bulletins
- Last updated: 2015-06-15T20:51:43Z
Netflixプロダクトに組み込むことを目的にしたセキュリティ通知? 詳細不明。
ember-nf-graph
Composable graphing component library for EmberJS.
- URL: https://github.com/Netflix/ember-nf-graph
- Last updated: 2015-07-15T14:00:39Z
Ember.jsでチャートを描画するためのライブラリ。
ember-nf-graph-examples
Hosted examples of ember nf-graph components
- URL: https://github.com/Netflix/ember-nf-graph-examples
- Last updated: 2015-06-19T18:24:49Z
上記ember-nf-graphのデモサイトを構築するためのコード。
peeringdb-py
PeeringDB Python library
- URL: https://github.com/Netflix/peeringdb-py
- Last updated: 2015-06-24T20:29:09Z
Redisと連携しキャッシュを実装することもできる。
ベランダの散水環境整え
ベランダに水道蛇口が1つあるものの、それを使ってベランダの掃除をする道具がなかったのでAmazonなどで揃えた。
蛇口に外ネジ泡沫キャップが付いており、それの内側直径をノギスで測ると21mm。蛇口側のネジ山の直径は22mmだったので、以下のアダプタが合うと思い購入した。
結果、アダプタとニップルでうまく装着できた。
あとはニップルに合うホースコネクタとホースを買うだけで良いので、念のためと、同じブランドの以下のものを選択した。
ホースで水をまき、窓はスクイジー、床は100円ショップのデッキブラシで汚れを落とす。ホースを使わない時はS字フックで掛けているが、傷みやすいだろうか。
梅雨が終わる前に揃った。ベランダにほこりがたまっていると、虫が繁殖するそうだから、さっさと片付けてしまうのが吉。
Markdownファイルで外部ファイルをインポートするならcog
Markdownドキュメント内で外部のファイルの内容を引用したい場面が多々ある。プログラムや設定ファイルの説明などを加工としているときに多い。
外部ファイルの内容をコピーしてMarkdownドキュメントにペーストしても解決するが、外部ファイルの内容が変更された時には、Markdownドキュメント側も変更する必要があり、保守が大変になる。
cogというコードジェネレータを使ってこの問題を解決した。
例えば以下の様なMarkdownファイルを用意する。
以下はZookeeper用Dockerfileである。 <!-- [[[cog import cog filepath = "/home/laclefyoshi/Documents/zookeeper/Dockerfile" label = "#lst:zookeeper_dockerfile" format = ".dockerfile" caption = "Zookeeper用Dockerfile" cog.outl("```{%s %s .numberLines caption=\"%s\"}" % (label, format, caption)) with open(filepath) as f: cog.outl("".join(f.readlines()).strip()) cog.outl("```") ]]] --> <!-- [[[end]]] -->
filepath
に適切なファイルを配置し、cogコマンドでこのファイルを処理させる。
$ cog.py memo.md
結果は以下のとおり。
以下はZookeeper用Dockerfileである。 <!-- [[[cog import cog filepath = "Dockerfile" label = "#lst:zookeeper_dockerfile" format = ".dockerfile" caption = "Zookeeper用Dockerfile" cog.outl("```{%s %s .numberLines caption=\"%s\"}" % (label, format, caption)) with open(filepath) as f: cog.outl("".join(f.readlines()).strip()) cog.outl("```") ]]] --> ```{#lst:zookeeper_dockerfile .dockerfile .numberLines caption="Zookeeper用Dockerfile"} FROM centos MAINTAINER SAEKI Yoshiyasu <@laclefyoshi> WORKDIR /tmp RUN yum install -y java-1.7.0-openjdk-devel.x86_64 tar.x86_64 ENV JAVA_HOME /usr/lib/jvm/java RUN curl -O http://ftp.tsukuba.wide.ad.jp/software/apache/zookeeper/zookeeper-3.4.6/zookeeper-3.4.6.tar.gz RUN tar zxvf zookeeper-3.4.6.tar.gz RUN cp zookeeper-3.4.6/conf/zoo_sample.cfg zookeeper-3.4.6/conf/zoo.cfg RUN mkdir -p /tmp/zookeeper RUN mv zookeeper-3.4.6 /opt/ WORKDIR /opt/zookeeper-3.4.6 ENTRYPOINT ["./bin/zkServer.sh"] CMD ["start-foreground"] EXPOSE 2181 ``` <!-- [[[end]]] -->
これをpandocでHTML出力すると、以下のようになる。
逆にコードの中にドキュメントを書く(文芸的プログラミング)という方法もあるが、今回はドキュメントの割合が大きかったので、こういう解決策を選んだ。
Markdownで相互参照を使うならpandoc-crossref
LaTeXだと\label
と\ref
を使えばいい具合に相互参照できる(参照番号を付けてくれる)が、Markdownだとそういう記法は無い。
pandocというドキュメントコンバータを使うと、Markdown(など)の形式のドキュメントを入力にして、様々な処理を加え、Markdownや他の形式のドキュメントを出力することができる。その「様々な処理」はpandocに内蔵されたものの他、プラグインで拡張することができる。
そして、プラグインの1つにMarkdownドキュメント内での相互参照を実現するpandoc-crossrefがある。
例えば以下の様なMarkdownファイルを用意する。
はじまり [@fig:a_image]に示す画像は特に意味が無い。 ![これはイメージです](http://mirrors.creativecommons.org/presskit/logos/cc.logo.large.png){#fig:a_image} [@eq:b_equation]はどこかで見たことがある数式である。 $$ x^2 + y^2 = 1 $$ {#eq:b_equation} [@tbl:c_table]はただの表である。 | head1 | head2 | |:--|:--| | 1/1 | 1/2 | | 2/1 | 2/2 | : 例 {#tbl:c_table} [@lst:d_code]は動きそうである。 ```{#lst:d_code .python .numberLines caption="Pythonっぽいコード"} import sys print(sys.version()) print("Hello, Pandoc") ``` おわり
このファイルをpandocコマンドとpandoc-crossrefプラグインで処理し、Markdown形式で出力する。
$ pandoc -s --filter pandoc-crossref -f markdown -t markdown note.md
その結果が以下のとおり。
--- chapDelim: '.' crossrefYaml: 'pandoc-crossref.yaml' eqnPrefix: - 'eq.' - 'eqns.' figPrefix: - 'fig.' - 'figs.' figureTemplate: $$figureTitle$$ $$i$$$$titleDelim$$ $$t$$ figureTitle: Figure listingTemplate: $$listingTitle$$ $$i$$$$titleDelim$$ $$t$$ listingTitle: Listing lofTitle: | List of Figures =============== lolTitle: | List of Listings ================ lotTitle: | List of Tables ============== lstPrefix: - 'lst.' - 'lsts.' rangeDelim: '-' tableTemplate: $$tableTitle$$ $$i$$$$titleDelim$$ $$t$$ tableTitle: Table tblPrefix: - 'tbl.' - 'tbls.' titleDelim: ':' ... はじまり fig. 1に示す画像は特に意味が無い。 ![Figure 1: これはイメージです](http://mirrors.creativecommons.org/presskit/logos/cc.logo.large.png) eq. 1はどこかで見たことがある数式である。 $$ x^2 + y^2 = 1 \qquad(1)$$ tbl. 1はただの表である。 head1 head2 ------- ------- 1/1 1/2 2/1 2/2 : Table 1: 例 lst. 1は動きそうである。 <div id="lst:d_code" class="listing python numberLines"> Listing 1: Pythonっぽいコード ``` {.python .numberLines} import sys print(sys.version()) print("Hello, Pandoc") ``` </div> おわり
ファイル先頭に設定情報が書き込まれているところは置いておいて、元の入力Markdownで@...
、#...
としていたところが、参照番号に置き換わっていることがわかる。
pandocコマンドの出力をHTMLにすると、よくわかる。
日本語文章の中にfig.
、eq.
、tbl.
、lst.
というのは見た目が良くないが、これはYAMLで設定ファイルを書くことで変更できる。
figureTitle: "図 " tableTitle: "表 " listingTitle: "コード " figPrefix: "図." eqnPrefix: "式." tblPrefix: "表." lstPrefix: "コード."
pandocコマンド実行時に設定ファイルのパスを渡す
$ pandoc -s --filter pandoc-crossref -M "crossrefYaml=crossref_config.yaml" note.md
結果は以下のとおり。
--- chapDelim: '.' crossrefYaml: 'crossref_config.yaml' eqnPrefix: '式.' figPrefix: '図.' figureTemplate: $$figureTitle$$ $$i$$$$titleDelim$$ $$t$$ figureTitle: 図 listingTemplate: $$listingTitle$$ $$i$$$$titleDelim$$ $$t$$ listingTitle: コード lofTitle: | List of Figures =============== lolTitle: | List of Listings ================ lotTitle: | List of Tables ============== lstPrefix: 'コード.' rangeDelim: '-' tableTemplate: $$tableTitle$$ $$i$$$$titleDelim$$ $$t$$ tableTitle: 表 tblPrefix: '表.' titleDelim: ':' ... はじまり 図. 1に示す画像は特に意味が無い。 ![図 1: これはイメージです](http://mirrors.creativecommons.org/presskit/logos/cc.logo.large.png) 式. 1はどこかで見たことがある数式である。 $$ x^2 + y^2 = 1 \qquad(1)$$ 表. 1はただの表である。 head1 head2 ------- ------- 1/1 1/2 2/1 2/2 : 表 1: 例 コード. 1は動きそうである。 <div id="lst:d_code" class="listing python numberLines"> コード 1: Pythonっぽいコード ``` {.python .numberLines} import sys print(sys.version()) print("Hello, Pandoc") ``` </div> おわり
Cardboardを組み立てた
簡単な気分転換としてCardboardを組み立てた。通販でたまたま適度な薄さの段ボールを手に入れたのがきっかけ。
Google I/O 2015でボタン付きがリリースされたが、公開されているパーツPDFは2014のもの(2015/06/14現在)。レターサイズに印刷して、途切れている部分を糊付けし、山折りオンリーで組み合わせるだけ。Apple製品じゃないが、直感的だと思う。ボディの固定用に輪ゴム、100円ショップで凸レンズ2枚、磁石2個、マジックテープの購入が必要。
iPhone6で使えるアプリが、サードパーティのお試し版みたいなものしかなく、画像を頭を動かしながら見た。マグネットセンサが無いのか、磁石は効かなかった。なるほど没頭感はそこそこあるが、眼鏡を付けたままだとちょっと邪魔に感じる。
Google Glass以降片目端末が流行ったが、やはりゴーグル型こそ未来の情報端末のイメージがある。コンタクトレンズ型でもいいから、視野全体に付加情報を表示しまくり、情報大洪水を実感してみたいものだ。