feat: use hexo
This commit is contained in:
67
source/_posts/2013/install-julius-with-homebrew.md
Normal file
67
source/_posts/2013/install-julius-with-homebrew.md
Normal file
@@ -0,0 +1,67 @@
|
||||
---
|
||||
title: OSXに音声解析エンジンJuliusを入れる with Homebrew
|
||||
date: 2013-07-07 09:00:00 +09:00
|
||||
redirect_from: "/blog/2013/07/07/install-julius-with-homebrew"
|
||||
---
|
||||
|
||||
Homebrew を使って macOS に音声解析エンジン Julius をインストールします。
|
||||
|
||||
# 前提
|
||||
|
||||
OS X 用のパッケージ管理ツール Homebrew がインストールされている必要がある。
|
||||
|
||||
インストール方法
|
||||
は[こちら](http://www.engineyard.co.jp/blog/2012/homebrew-os-xs-missing-package-manager/)を
|
||||
参照。
|
||||
|
||||
# インストール
|
||||
|
||||
デフォルトの Homebrew リポジトリに Julius は含まれていないので
|
||||
、[homebrew-nlp](https://github.com/uetchy/homebrew-nlp) を tap する。
|
||||
|
||||
```bash
|
||||
$ brew tap uetchy/nlp
|
||||
```
|
||||
|
||||
Tap し終わったら、`julius`と`julius-dictation-kit`をインストールする。
|
||||
|
||||
```bash
|
||||
$ brew install julius julius-dictation-kit
|
||||
```
|
||||
|
||||
これで Julius と Julius ディクテーションキットがインストールされた。
|
||||
|
||||
ディクテーションキットの場所は `brew --prefix julius-dictation-kit` コマンドで調
|
||||
べられる。
|
||||
|
||||
後は、上記の `brew --prefix` コマンドでディクテーションキット内の **main.jconf**
|
||||
と **am-gmm.jconf** のパスを調べて `julius` に渡すことで音声認識が出来るようにな
|
||||
る。
|
||||
|
||||
```bash
|
||||
$ julius \
|
||||
-C `brew --prefix julius-dictation-kit`/share/main.jconf \
|
||||
-C `brew --prefix julius-dictation-kit`/share/am-gmm.jconf
|
||||
```
|
||||
|
||||
上記のコマンドで Julius は GMM モードで待機状態になり、喋った内容をリアルタイム
|
||||
で音声認識してくれるようになる。
|
||||
|
||||
Julius をより精密な DNN モードで起動したい場合は以下のように、**am-gmm.jconf**
|
||||
を **am-dnn.jconf** に変更するだけだ。
|
||||
|
||||
```bash
|
||||
$ julius \
|
||||
-C `brew --prefix julius-dictation-kit`/share/main.jconf \
|
||||
-C `brew --prefix julius-dictation-kit`/share/am-dnn.jconf
|
||||
```
|
||||
|
||||
ディクテーションキットに関するドキュメントは下記のコマンドから参照可能だ。
|
||||
|
||||
```bash
|
||||
$ open `brew --prefix julius-dictation-kit`/share/doc
|
||||
```
|
||||
|
||||
### 実行中の様子
|
||||
|
||||

|
95
source/_posts/2013/osx-http-proxy.md
Normal file
95
source/_posts/2013/osx-http-proxy.md
Normal file
@@ -0,0 +1,95 @@
|
||||
---
|
||||
title: OS Xのネットワーク環境に合わせてHTTP_PROXYを切り替えるシェルスクリプト
|
||||
date: 2013-11-05 09:00:00 +09:00
|
||||
redirect_from: "/blog/2013/11/05/osx-http-proxy"
|
||||
---
|
||||
|
||||

|
||||
|
||||
大学のネットワークに接続している時だけプロキシを設定したい時がある。
|
||||
|
||||
Mac のネットワーク環境は`networksetup -getcurrentlocation`コマンドで取得することが出来るので、
|
||||
|
||||
**.zshrc** 辺りに以下のシェルスクリプトを書いておけば Terminal で新しいタブを開いた時に自動でプロキシを設定してくれるはずである。
|
||||
|
||||
```bash
|
||||
proxy=proxy.hogehoge.ac.jp
|
||||
switch_trigger=大学
|
||||
|
||||
if [ "`networksetup -getcurrentlocation`" = "$switch_trigger" ]; then
|
||||
export HTTP_PROXY=$proxy
|
||||
export FTP_PROXY=$proxy
|
||||
...以下省略
|
||||
fi
|
||||
```
|
||||
|
||||
## Git のプロキシ設定も書き換えたい
|
||||
|
||||
Git は http_proxy を見てくれないのでリモートリポジトリに push 出来なくて困ることがあった。そこで http_proxy と一緒に Git のプロキシ設定も書き換えるようにしたい。
|
||||
|
||||
Git のプロキシは以下のコマンドで設定出来る。`--global`の代わりに`--system`を使っても良い。
|
||||
|
||||
```bash
|
||||
git config --global http.proxy $proxy
|
||||
git config --global https.proxy $proxy
|
||||
git config --global url."https://".insteadOf git://
|
||||
```
|
||||
|
||||
逆に `git config` から設定を削除したい場合は`git config --gobal --unset {item}`を使えば良い。
|
||||
|
||||
先ほどのコマンドと組み合わせることで最終的なコードは以下のようになる。
|
||||
|
||||
```bash:switch_proxy.sh
|
||||
proxy=proxy.hogehoge.ac.jp:80
|
||||
switch_trigger=大学
|
||||
|
||||
function set_proxy() {
|
||||
export http_proxy=$proxy
|
||||
export HTTP_PROXY=$proxy
|
||||
export ftp_proxy=$proxy
|
||||
export FTP_PROXY=$proxy
|
||||
export all_proxy=$proxy
|
||||
export ALL_PROXY=$proxy
|
||||
export https_proxy=$proxy
|
||||
export HTTPS_PROXY=$proxy
|
||||
|
||||
git config --global http.proxy $proxy
|
||||
git config --global https.proxy $proxy
|
||||
git config --global url."https://".insteadOf git://
|
||||
}
|
||||
|
||||
function unset_proxy() {
|
||||
unset http_proxy
|
||||
unset HTTP_PROXY
|
||||
unset ftp_proxy
|
||||
unset FTP_PROXY
|
||||
unset all_proxy
|
||||
unset ALL_PROXY
|
||||
unset https_proxy
|
||||
unset HTTPS_PROXY
|
||||
|
||||
git config --global --unset http.proxy
|
||||
git config --global --unset https.proxy
|
||||
git config --global --unset url."https://".insteadOf
|
||||
}
|
||||
|
||||
if [ "`networksetup -getcurrentlocation`" = "$switch_trigger" ]; then
|
||||
echo "Switch to proxy for university network"
|
||||
set_proxy
|
||||
else
|
||||
unset_proxy
|
||||
fi
|
||||
```
|
||||
|
||||
このコードを **.zshrc** に保存して適当なターミナルで新しいセッションを開くと、`switch_trigger`で指定されたネットワーク環境下にいる時だけプロキシを通すことが出来る。
|
||||
|
||||
既に開いているセッションに対してプロキシを適用する方法がわからなかった。
|
||||
|
||||
Workaround として、コードを **~/.switch_proxy** 辺りに置いて、
|
||||
|
||||
```bash:~/.zshrc
|
||||
alias nswitch=~/.switch_proxy
|
||||
|
||||
```
|
||||
と`.zshrc`に書いておくことで、`nswitch`とタイプしてプロキシを切り替えられるようになる。
|
||||
```
|
26
source/_posts/2013/qiita-alfred-workflow.md
Normal file
26
source/_posts/2013/qiita-alfred-workflow.md
Normal file
@@ -0,0 +1,26 @@
|
||||
---
|
||||
title: Qiitaでストックした記事をインクリメンタルサーチするAlfred 2 Workflow
|
||||
date: 2013-12-05 09:00:00 +09:00
|
||||
redirect_from: "/blog/2013/12/05/qiita-alfred-workflow"
|
||||
---
|
||||
|
||||
コードを書いている時に、ストックしておいた Qiita の記事を検索したくなるシーンが最近増えてきた気がする。
|
||||
|
||||
そこで、以前作った[Qiita の記事をインクリメンタルサーチする Alfred 2 Workflow](http://qiita.com/o_ame/items/f23e75bfc11e9e7b3a08)に、ストックした投稿を検索するコマンドを追加した。
|
||||
|
||||

|
||||
|
||||
> [Github リポジトリ](https://github.com/uetchy/alfred-qiita-workflow)から[ダウンロード](https://github.com/uetchy/alfred-qiita-workflow/archive/master.zip)
|
||||
|
||||
## 使い方
|
||||
|
||||
1. `qiita setup <username> <password>`で Qiita のアクセストークンを取得
|
||||
2. `qiita stocks <query>`でストックした記事の検索
|
||||
3. `qiita search <query>`で普通の検索
|
||||
|
||||
## まとめ
|
||||
|
||||
今度は Ruby で書きなおして日本語も受け付けるように修正したので、需要はともかく個人的にかなり使いやすくなった気がする。
|
||||
|
||||
~~なお、この Workflow は Ruby 2.0.x で動作するので必然的に OS X Mavericks が必要になってくる。~~
|
||||
**Ruby 1.9.x でも動作するように書きなおしたので古い OS X でも動くようになった。**
|
Reference in New Issue
Block a user