Skip to content

Instantly share code, notes, and snippets.

View vgoklani's full-sized avatar

Vishal Goklani vgoklani

View GitHub Profile
@vgoklani
vgoklani / dpgmm_sampler.py
Created December 1, 2012 06:29 — forked from amueller/dpgmm_sampler.py
Nonparametric Gaussian mixture model data sampling
import numpy as np
import scipy.stats
class ChineseRestaurantProcess(object):
def __init__(self, alpha):
self.alpha = alpha
self.customers = []
def sample(self, n_samples=1):
samples = []
@vgoklani
vgoklani / gist:4199200
Created December 3, 2012 23:56 — forked from lxneng/gist:1031014
Exception: `curl-config' not found -- please install the libcurl development files
(env)~/env pip install pycurl
Downloading/unpacking pycurl
Downloading pycurl-7.19.0.tar.gz (71Kb): 71Kb downloaded
Running setup.py egg_info for package pycurl
sh: curl-config: not found
Traceback (most recent call last):
File "<string>", line 14, in <module>
File "/home/eric/env/build/pycurl/setup.py", line 90, in <module>
raise Exception, ("`%s' not found -- please install the libcurl development files" % CURL_CONFIG)
Exception: `curl-config' not found -- please install the libcurl development files
@vgoklani
vgoklani / bench.cpp
Created December 13, 2012 19:13 — forked from pavanky/bench.cpp
#include <stdio.h>
#include <arrayfire.h>
using namespace af;
array in;
void bench_blas()
{
array out = matmul(in, in);
}

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

'''
Gibbs sampler for function:
f(x,y) = x x^2 \exp(-xy^2 - y^2 + 2y - 4x)
using conditional distributions:
x|y \sim Gamma(3, y^2 +4)
y|x \sim Normal(\frac{1}{1+x}, \frac{1}{2(1+x)})
'''
from __future__ import division
from pylab import *
# Sampling rate
fs = 128 # Hz
# Time is from 0 to 1 seconds, but leave off the endpoint, so that 1.0 seconds is the first sample of the *next* chunk
length = 1 # second
N = fs * length
t = linspace(0, length, num = N, endpoint = False)
'''
@author Michael J Bommarito II
@contact [email protected]
@date Feb 21, 2011
@license Simplified BSD, (C) 2011.
Plot the network of the first 1000 #cn220 tweets with igraph and cairo.
'''
import cairo
def _start_notebook(self, master, user, profile_dir, profile_name='default', notebook_port=8888):
master.ssh.execute('ipython profile create %s' % profile_name)
log.info("Setting up IPython web notebook for user: %s" % user)
user_cert = posixpath.join(profile_dir, '%s.pem' % user)
ssl_cert = posixpath.join(profile_dir, '%s.pem' % user)
if not master.ssh.isfile(user_cert):
log.info("Creating SSL certificate for user %s" % user)
ssl_subj = "/C=US/ST=SC/L=STAR/O=Dis/CN=%s" % master.dns_name
master.ssh.execute(
"openssl req -new -newkey rsa:4096 -days 365 "

The INSTALL instructions that come with Vowpal Wabbit appear not to work on Mac OS X Lion. Here's what I did to get it to compile. You will need the developer tools that come with the XCode installation.

The only dependency VW has is the boost C++ library. So first, download and install Boost

To install Boost, do the following:

$ cp ~/Downloads/boost_1_48_0.tar.bz2 ./