Skip to content

Instantly share code, notes, and snippets.

View phizaz's full-sized avatar
😀

Konpat phizaz

😀
View GitHub Profile
$ brew install nvm
$ brew search nvm
convmv mvnvm nvm
$ brew info nvm
nvm: stable 0.29.0, HEAD
Manage multiple Node.js versions
https://github.com/creationix/nvm
Not installed
From: https://github.com/Homebrew/homebrew/blob/master/Library/Formula/nvm.rb
==> Caveats
Please note that upstream has asked us to make explicit managing
nvm via Homebrew is unsupported by them and you should check any
$ nvm
Node Version Manager
Usage:
nvm help Show this message
nvm --version Print out the latest released version of nvm
nvm install [-s] <version> Download and install a <version>, [-s] from source. Uses .nvmrc if available
nvm uninstall <version> Uninstall a version
nvm use <version> Modify PATH to use <version>. Uses .nvmrc if available
# never installed before
$ nvm install v4.2.1
# upgrading
$ nvm install v4.2.1 --reinstall-packages-from=<your_old_version>
$ nvm alias default 4.2.1
$ node --version
v4.2.1
$ npm --version
3.3.10
# install with global option because node.js has two kinds of package installs,
# one is 'global' everything in the computer can use the global packages
# another one is 'local' only the designated area can use the local packages
# here we want babel (as a system-wide program) can be used from anywhere
$ npm install --global babel
$ babel --version
5.8.29 (babel-core 5.8.29)
@phizaz
phizaz / l_method.py
Created March 21, 2016 11:42
A Python implementation of Salvador and Chan's L-Method for determining the number of clusters in hierarchical clustering algorithm
from fastcluster import linkage
from collections import deque
from sklearn.metrics import mean_squared_error
import numpy
def f_creator(coef, intercept):
def f(x):
return intercept + coef * x
return f