OpenStackでコマンドラインでイメージを登録する例

$ glance image-create --name='image name' --is-public=true --container-format=bare --disk-format=qcow2 < file.img
イメージを標準入力から受け取るので、以下のようにcurlでダウンロードしながら、それを登録することもできる。
$ curl https://cloud-images.ubuntu.com/trusty/current/trusty-server-cloudimg-amd64-disk1.img | glance image-create --name='Ubuntu Server 14.04 LTS' --is-public=true --container-format=bare --disk-format=qcow2

Neutoron serverがpackage upgradeにより起動しなくなった場合の対応方法

Packageをアップデートした後、以下のエラーでNeutron serverが起動しなくなった。
# /etc/init.d/neutron-server start
neutron-db-check: ERROR: neutron database does not have version information. You must run the "neutron-db-manage stamp" command before starting neutron services.
以下のようにするとこの問題は解決した。
# neutron-db-manage --config-file /etc/neutron/neutron.conf stamp havana
No handlers could be found for logger "neutron.common.legacy"
INFO  [alembic.migration] Context impl MySQLImpl.
INFO  [alembic.migration] Will assume non-transactional DDL.

MySQLで他のサーバからの接続を許可する。

例:ユーザーuserが、すべてのマシンからDB: fooにアクセスすることを許可
 
mysql> grant all privileges on foo.* to 'user'@'%';

gitでログの中の特定の項目を出力

--pretty=format:"FORMAT"を使えばよい。FORMAT部分はman pageのPRETTY FORMATSを参照。

例:直前のコミットメッセージだけを出力。
$ git log -1 --pretty=format:"%s"

vimでコマンドの実行結果を取り込む

:r! command とするとのその出力がカーソル位置に取り込まれる。

:r! date

git diffで追加・削除の行数だけ取得する。

--shortstatをつければよい。
$ git diff 8044225f2 --shortstat
ファイル単位なら、--stat。
$ git diff 8044225f2 --stat
 book/src/abc.c    |  74 +++++++++++++++++++++++++++++++++++++++++----
 book/src/page.c   |  16 +++++++++---
 book/test/foo.c   | 110 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++-----
 3 files changed, 198 insertions(+), 12 deletions(-)

mozcのキーボードレイアウトを英語にする。

/usr/share/ibus/component/mozc.xmlのlayout項目を以下のようにusにする。
  <layout>us</layout>