DELAEMON BLOG

Live as if you were to die tomorrow. Learn as if you were to live forever.

gem install sinatra ~ Symbol not found: _SSLv2_client_method ~ @OS X

sinatraをインストールしようとしたら以下のエラー

$ gem install sinatra
ERROR:  Loading command: install (LoadError)
    dlopen(/Users/dela/.rbenv/versions/2.2.2/lib/ruby/2.2.0/x86_64-darwin14/openssl.bundle, 9): Symbol not found: _SSLv2_client_method
  Referenced from: /Users/dela/.rbenv/versions/2.2.2/lib/ruby/2.2.0/x86_64-darwin14/openssl.bundle
  Expected in: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib
 in /Users/dela/.rbenv/versions/2.2.2/lib/ruby/2.2.0/x86_64-darwin14/openssl.bundle - /Users/dela/.rbenv/versions/2.2.2/lib/ruby/2.2.0/x86_64-darwin14/openssl.bundle
ERROR:  While executing gem ... (NoMethodError)
    undefined method `invoke_with_build_args' for nil:NilClass

rubyを再インストールする

$ sudo rbenv install 2.2.2

再度 sinatra install

$ sudo gem install sinatra
Password:
Fetching: rack-protection-1.5.3.gem (100%)
Successfully installed rack-protection-1.5.3
Fetching: tilt-2.0.1.gem (100%)
Successfully installed tilt-2.0.1
Fetching: sinatra-1.4.6.gem (100%)
Successfully installed sinatra-1.4.6
Parsing documentation for rack-protection-1.5.3
Installing ri documentation for rack-protection-1.5.3
Parsing documentation for tilt-2.0.1
Installing ri documentation for tilt-2.0.1
Parsing documentation for sinatra-1.4.6
Installing ri documentation for sinatra-1.4.6
Done installing documentation for rack-protection, tilt, sinatra after 272 seconds
3 gems installed

Apache2.4 build from source@OS X

Apache 2.4がOS Xですんなりビルドできなかった。
発生したエラーと解決方法をメモ。

wget http://apache.mirrors.pair.com/httpd/httpd-2.4.17.tar.gz
tar xvzf httpd-2.4.17.tar.gz
cd httpd-2.4.17
./configure #ここでエラー

XCode -> Open Develop Tool -> More Developer Tools -> Command Line Toolsは最新にしておいた。

エラー 1

checking whether the C compiler works... no
configure: error: C compiler cannot create executables

対処 1

.zshrc で gccのパスを$CC環境変数として指定

export CC="/usr/bin/gcc"

エラー 2

configure: error: in `/Users/dela/Documents/develop/ab/httpd-2.4.17':
configure: error: C preprocessor "/Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.10.xctoolchain/usr/bin/cc -E" fails sanity check

対処 2

シンボリックリンクを貼る

sudo ln -s /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/ /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.10.xctoolchain

これでmakeまで動いて、./supportにabやapachectlができた。

Translate Shell + sayコマンドで喉が痛くても外国人と話せるよ@OS X

10分の立ち話で消費されるカロリーは体重60kgの場合19kcal
消費カロリー早見表|活動量計カロリズム|株式会社タニタ

10分のタイピングで消費されるカロリーは男性の場合9kcal
『執筆,デスクワーク,タイピング』の消費カロリー|運動・生活活動の消費カロリー |エクササイズ | ダイエットナビ | CLUB Panasonic

無駄な会話に自らのカロリー消費を最小限にしたい、風邪などで喉が痛くて話せない
そんなときはsayコマンドですね

$ say "正気ですか?"

translate-shellで外国語にも対応します
Translate Shell

translate-shell インストール

$ brew install gawk
$ wget git.io/trans
$ chmod +x trans

翻訳して音声出力

$ ./trans -b "病気ですよ" | say

どんどん使ってこ

追記:
sayコマンドいらなかった

$ ./trans -p おやすみ

追記2
man say すると便利な使い方がわかった。ファイルを指定できたり、声の種類を変えたり、サーバーに送信できたりする

$ cat message.txt
I Love You.
$ say -v Alex -f message.txt

追記3
Translate API https://developers.google.com/translate/.なのでお金払わないとダメ
"Is there any free quota? No, the Google Translate API is only available as a paid service."
Translate API FAQ - Translate API — Google Cloud Platform

$ trans 'こんにちわ'
[ERROR] Null response.
[ERROR] Oops! Something went wrong and I can't translate it for you :(

追記4
一定時間経って復活した?と思ったけど、IP変わったからブロックされなくなった1回目っていうだけで、2回目以降Null

$ trans -b 'おはよう'
good morning

Go 1.5 gxui install & sample

cd Downloads/glew-1.12.0/
make
sudo make install
go get github.com/google/gxui
go get github.com/golang/freetype/truetype
go get github.com/go-gl-legacy/gl
go get -u github.com/go-gl/glfw/v3.1/glfw
go get -u github.com/goxjs/glfw
go get -u github.com/goxjs/gl
cd src/github.com/google/gxui/samples/polygon/
go run main.go

makeやgo get -u github.com/go-gl/glfw/v3.1/glfwあたりでエラーを吐くけど、コードは落としてこれてて動く
f:id:delaemon:20150913215808p:plain