NodeJS で Postgres を使う

とりあえずインストール

brew install postgresql
ln -sfv /usr/local/opt/postgresql/*.plist ~/Library/LaunchAgents

zshrcに、

alias pg-start="brew services start postgresql"
alias pg-stop="brew services stop postgresql"
alias pg-restart="brew services restart postgresql"

brew services 便利)

その上で、

source ~/.zshrc
pg-start
createdb `dbname`
psql -l // list all databases
psql -d dbname

で接続される。

接続後は普通にDBのコマンドを打つ。

参考:
Installing Postgres via Brew (OSX) · GitHub
http://www.postgresonline.com/downloads/special_feature/postgresql83_psql_cheatsheet.pdf
Heroku Postgres | Heroku Dev Center

oh-my-zsh を zplug に置き換えた話

oh-my-zsh 使ってたけれど、初期読み込みが重くなってきたので、zplug で必要最低限モニタする方向に移行した。

cp -r ~/.zshrc ~/.zshrc.old
brew install zplug

インストール後、.zshrc に以下の記述を追加:

  export ZPLUG_HOME=/usr/local/opt/zplug
  source $ZPLUG_HOME/init.zsh

そしてほしいプラグインを追加。。。

# zplug
zplug 'zplug/zplug', hook-build:'zplug --self-manage'

# theme (https://github.com/sindresorhus/pure#zplug)
zplug "mafredri/zsh-async"
zplug "sindresorhus/pure"

# Syntax highlighting (https://github.com/zsh-users/zsh-syntax-highlighting)
zplug "zsh-users/zsh-syntax-highlighting", nice:10

# history
zplug "zsh-users/zsh-history-substring-search"

# autocomplete
zplug "zsh-users/zsh-autosuggestions"
zplug "zsh-users/zsh-completions"
zplug "chrissicool/zsh-256color"
zstyle ':completion:*' menu select

# Install plugins if there are plugins that have not been installed
if ! zplug check --verbose; then
  printf "Install? [y/N]: "
  if read -q; then
    echo; zplug install
  fi
fi

# Then, source plugins and add commands to $PATH
zplug load --verbose

参考文献

zplugの導入 oh-my-zshのような設定にするまで。 - Qiita
もっと便利になれる zsh プラグインによる CLI ライフ - Qiita

blobscannerをインストールする

ジェスチャー認識をしたかったので、blobscannerをインストールした。

GitHub - robdanet/blobscanner: Blobscanner, a Processing's library for blob detection and analysis .

からソースファイルをインストール。

cd blobscanner
mkdir library
mkdir src/blobscanner
mv src/Detector.java src/blobscanner/
jar -cf library/blobscanner.jar src/blobscanner 

そのあと、このblobscannerのフォルダごと自分が使っているProcessing/libraryのディレクトリに移動する。