Macのapacheでバーチャルホストの設定をする

そういえばいままでバーチャルホストの設定をしたことなかったのでメモ。

まず、/etc/apache2/httpd.confの以下の行のコメント解除する

#Include /private/etc/apache2/extra/httpd-vhosts.conf

次に、/etc/apache2/extra/httpd-vhosts.confの設定をする。
今回の例では
/Users/username/work/testをドキュメントルートとして
local.test.comでアクセスできるようにする。


   DocumentRoot "/Users/username/work/test"
   ServerName local.test.com
   ErrorLog "/private/var/log/apache2/test_errorlog"
   CustomLog "/private/var/log/apache2/test_log" common
   
       Options Indexes FollowSymLinks MultiViews
       AllowOverride All
       Order allow,deny
       Allow from all
   

/etc/hostsにlocal.test.comを以下のように追加

127.0.0.1 local.test.com

最後にapacheを再起動して、local.test.comにブラウザでアクセスする。

$ sudo apachectl restart

tmuxをmacに導入した

screenより、tmuxのほうがいいらしいので移行しました。

Homebrewで一発

$ brew install tmux

インストール完了したら,tmuxって打って起動。

$ tmux

縦分割とコピペのキーバインドemacsライクでいいかも!

追記

いまいるwindowがわかりにくかったので、とりあえずこれだけ設定した。

.tmux.conf

# window-status-current
setw -g window-status-current-fg black
setw -g window-status-current-bg white
setw -g window-status-current-attr bold

skypeのチャットログがあるデータベースにアクセスする

いまバイト先でコミュニケーションツールとしてskypeを使ってるんだけど
とにかくチャットログが見にくいので、ログにアクセスする方法を調べてみた。

skypeのチャットログは、Macだと
~/Library/Application Support/Skype/ユーザー名
以下のmain.dbにある。

main.dbはsqlite3なので、以下のコマンドでデータベースに接続できる。

$ cd ~/Library/Application Support/Skype/ユーザー名
$ sqlite3 main.db

この中の「Messages」テーブルがチャットログがあるテーブルなので
こんな感じで、チャットログの内容が見れる。

sqlite> select timestamp, from_dispname, body_xml from Messages;

これを良い感じで抽出して、見やすいようにrubyかなんかでいろいろしたい(´・ω・`)

bitbucketにdotfilesを移行した

いままでgithub.emacsとか.zshとかのdotfilesを管理してたけど、
個人情報とかもある設定を追加したので
無料でプライベートレポジトリ作れるbitbucketに移行しました。

Create repositoryでprivateのとこチェックするだけで簡単にプライベートレポジトリが作れるよ。
作ると、以下のような感じになるのでhttpssshか選んでcloneする。

Clone this repository (size: 580 bytes): HTTPS / SSH  /  SourceTree  
$ git clone https://xxxx@bitbucket.org/xxxx/test.git

bitbucketはhttps接続もできるんすね!


ちなみにこの本↓のおかけでemacsがだいぶパワーアップしました!☆


結局はてなダイアリーに戻ってきた話

いろんなブログを経て、はてなダイアリーに落ち着いて、はてなブログがでてきてすぐ移行して、結局戻ってきたっていう。

なんかはてなブログのリッチ感より、はてなダイアリーのシンプルでアナログっていうか、ちょっと古いデザインが好きなんだよね。

はてダラを使って書いてるよ

自分の好きなエディタでブログ書きたかったので、導入してみました。
はてダラ

この記事を書くまでの設定あれこれ
$ mkdir hatena
$ cd hatena
$ wget https://raw.github.com/hyuki0000/hatena-diary-writer/master/hw.pl

2012-09-16.txtっとかって日付の名前のファイルを作って、この記事書いてる
タイトルは一行目らしい。

記事ファイルの保存が完了したら、以下のようなコマンド打って、usernameとpasswod入力して更新できる!

$ perl hw.pl
Username: xxxx
Password: xxxx
Login to http://www.hatena.ne.jp/login as xxxx.
Login OK.
Post 2012-09-16.  
Post OK.
Logout from http://d.hatena.ne.jp as xxxx.
Logout OK.

ちなみにconfig.txtにidとかpasswordとかの設定ができるらしいので後で設定する。

簡単にキレイなグラフが描けるjsライブラリFlotr2

こんな感じに描ける(※データは適当です)
円グラフとかいろいろあるよ

使い方
  1. (http://humblesoftware.com/flotr2/)からflotr2.min.jsをとってくる
  2. flotr2.min.jsを読み込む
  3. widthとheightを指定したdivを用意
コード

html

 <!DOCTYPE html>
 <html lang="ja">
  <head>
    <meta charset="utf-8" />
    <title>お天気グラフサンプル</title>
    <style type="text/css">
      #graph {
      width: 600px;
      height: 400px;
      }
    </style>
    <script src="js/jquery-1.8.1.min.js"></script>
    <script src="js/flotr2.min.js"></script>
    <script src="js/weather.js"></script>
    <!--[if IE]>
    <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
  </head>
  <body>
    <div id="graph"></div>
   </body>
  </html>

javascript(jquery)

$(function advanced_titles(container){

	var
	d1 = [],
	d2 = [],
	ticks_X = [],
	rainfall_amount = [30, 0, 0, 1, 0, 80, 10],
	temperature = [34.5, 34.8, 33.2, 34.1, 30.8, 39.4, 36.0],
	week = ["8/30", "8/31", "9/1", "9/2", "9/3", "9/4", "9/5"],
	i, graph, options;

	for (i = 0; i < 7; i++) {
		ticks_X.push([i, week[i]]);
		d1.push([i, rainfall_amount[i]]);
		d2.push([i, temperature[i]]);
	}

    graph =[
		{data: d1, label: "降水量", bars: { show: true, barWidth: 0.8,lineWidth: 0 }},
		{data: d2, label: "気温", yaxis: 2}
	];
	
	options = {
		title: "降水量と気温のグラフ",
		HtmlText: false,
		xaxis: {
			ticks: ticks_X,
			title: "日時"
		},
		yaxis: {
			ticks: [0, 25, 50, 75, [100, "100mm"]],
			min: 0,
			max: 100,
			title: "降水量"
		},
		y2axis: {
			ticks: [0, 10, 20, 30, 40, [50, "50°C"]],
			min: 0,
			max: 50,
			title: "気温"
		},
		legend: {
			position: "nw"
		}			
	};

	Flotr.draw($('#graph').get(0), graph, options);
	
});