Skip to content

Instantly share code, notes, and snippets.

View phizaz's full-sized avatar
😀

Konpat phizaz

😀
View GitHub Profile
@phizaz
phizaz / threading.py
Last active June 15, 2016 15:21
EasyThreading: an alternative to Python's ThreadPool, but this version can make use of any kind of functions
from threading import Thread
from Queue import Queue
'''
an alternative to Python's ThreadPool, but this version can make use of any kind of functions
'''
class ThreadPool:
def __init__(self, cnt):
@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
$ babel --version
5.8.29 (babel-core 5.8.29)
# 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
$ node --version
v4.2.1
$ npm --version
3.3.10
$ nvm alias default 4.2.1
# never installed before
$ nvm install v4.2.1
# upgrading
$ nvm install v4.2.1 --reinstall-packages-from=<your_old_version>
$ 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
$ 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
$ brew search nvm
convmv mvnvm nvm