さくらVPSでgitをつかってみよう
まずインストール
$ sudo yum -y install git
すんなり入った
ここで~/hogeにレポジトリを作ると仮定する
$ mkdir ~/hoge && cd ~/hoge $ git init Initialized empty Git repository in /home/sakuragaoka/hoge/.git/
レポジトリが出来た。
.git/以下にいろいろ入るらしい。
何が作られたんだろ?
$ find .git .git .git/objects .git/objects/pack .git/objects/info .git/refs .git/refs/heads .git/refs/tags .git/HEAD .git/info .git/info/exclude .git/branches .git/description .git/config .git/hooks .git/hooks/applypatch-msg.sample .git/hooks/prepare-commit-msg.sample .git/hooks/pre-commit.sample .git/hooks/pre-applypatch.sample .git/hooks/post-receive.sample .git/hooks/post-update.sample .git/hooks/commit-msg.sample .git/hooks/post-commit.sample .git/hooks/pre-rebase.sample .git/hooks/update.sample
ほう。
よくわかんないけど。
つかってみよう。
$ mkdir ~/work && cd ~/work $ git clone ~/hoge Initialized empty Git repository in /home/sakuragaoka/work/hoge/.git/ warning: You appear to have cloned an empty repository. $ cd hoge
おお。
おっと。ユーザー名とか入れておこう。
$ git config --global user.name "sakuragaoka" $ git config --global user.email sakuragaoka@example.jp
あとふつうに使うだけ。
win-sshfsがべんりすぎる
sshで接続出来るホストのディレクトリをWindowsのドライブとしてマウントできちゃいます。
安定してるし速い。
もうSambaいらねえええ!
win-sshfs
http://code.google.com/p/win-sshfs/
日本語フリーフォントの紹介ページ
ここいろいろ使えるの載ってる。
http://www.fontfontfont.com/sckata.html
たぬき油性マジックとかすごくいい感じ。
バーチャルホストを設定する
現在example.jpで見えてるサーバーの別のディレクトリをhoge.example.jpで見せたい場合。
DNSのAレコードでhoge.example.jpを借りてるサーバーに向けたのち、下記のように設定する。
$ cat /etc/httpd/conf.d/virtualhost.conf NameVirtualHost *:80 <VirtualHost *:80> DocumentRoot /var/www/html ServerName example.jp # rewrite rules for mediawiki RewriteEngine On RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-d RewriteRule ^/?wiki/(.*)$ /wiki/index.php?title=$1 [PT,L,QSA] </VirtualHost> <VirtualHost *:80> DocumentRoot /var/www/hoge/htdocs ServerName hoge.example.jp </VirtualHost>
さくらVPSに入れたMediawikiで短いURLを使う
■ ご参考
http://www.mediawiki.org/wiki/Manual:Short_URL/wiki/Page_title_--_Apache_rewrite--root_access/ja
■ 作業
$ cd /var/www/wiki
$ echo '$wgArticlePath = "/wiki/$1";' >> LocalSettings.php
$ cat | sudo tee /etc/httpd/conf.d/rewrite.conf
RewriteEngine On
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-d
RewriteRule ^/?wiki/(.*)$ /wiki/index.php?title=$1 [PT,L,QSA]
$ sudo service httpd restart
Stopping httpd: [ OK ]
Starting httpd: [ OK ]
できた
linuxとbsdでsedの-iオプションの必要な引数が違う
↓参考:linuxの場合
linux$ grep hoge *
hoge0.txt:hoge fuga piyo
hoge1.txt:hoge fuga piyo
linux$ sed -i s/piyo/boeee/g * && grep hoge *
hoge0.txt:hoge fuga boeee
hoge1.txt:hoge fuga boeee
↓BSDだとこうなる
bsd$ grep hoge *
hoge0.txt:hoge fuga piyo
hoge1.txt:hoge fuga piyo
bsd$ sed -i s/piyo/boeee/g * && grep hoge *
sed: 1: "hoge0.txt": extra characters at the end of h command
ええーーー?!
となってman sed読んだ
bsd$ sed -i .foo s/piyo/boeee/g * && grep hoge *
hoge0.txt:hoge fuga boeee
hoge0.txt.foo:hoge fuga piyo
hoge1.txt:hoge fuga boeee
hoge1.txt.foo:hoge fuga piyo