Skip to content

Instantly share code, notes, and snippets.

@dfhe2004
dfhe2004 / lda_gibbs.py
Created May 13, 2012 01:58 — forked from mblondel/lda_gibbs.py
Latent Dirichlet Allocation with Gibbs sampler
"""
(C) Mathieu Blondel - 2010
Implementation of the collapsed Gibbs sampler for
Latent Dirichlet Allocation, as described in
Finding scientifc topics (Griffiths and Steyvers)
"""
import numpy as np
@dfhe2004
dfhe2004 / plsa.py
Created May 14, 2012 06:53 — forked from satomacoto/plsa.py
PLSA
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import math
import random
class plsa():
def __init__(self,n,nz=2):
@dfhe2004
dfhe2004 / gist:2818113
Created May 28, 2012 09:21
Spectral clustering
import numpy as np
from scipy.linalg import eig
from scipy.cluster.vq import kmeans2
from scipy.sparse.linalg import eigen
from scipy.spatial.kdtree import KDTree
from pylab import *
# Three multivariate Gaussians with means and cov listed below
@dfhe2004
dfhe2004 / lda_gibbs.py
Created May 30, 2012 06:58 — forked from mblondel/lda_gibbs.py
Latent Dirichlet Allocation with Gibbs sampler
"""
(C) Mathieu Blondel - 2010
Implementation of the collapsed Gibbs sampler for
Latent Dirichlet Allocation, as described in
Finding scientifc topics (Griffiths and Steyvers)
"""
import numpy as np
@dfhe2004
dfhe2004 / tinymq with websocket
Created June 3, 2012 09:39
mq base redis support websocket
from bottle import run, debug, abort, request, ServerAdapter, response, get, post, route
import redis
import json
import gevent
from gevent.queue import Queue
from Queue import Empty
from ec2.redis.core import redis_factory
from geventwebsocket import WebSocketHandler, WebSocketError
from gevent import monkey
@dfhe2004
dfhe2004 / websocket client
Created June 3, 2012 09:41
websocket client
<html>
<head>
<title>WebSocket</title>
<style>
html,body{font:normal 0.9em arial,helvetica;}
#log {width:440px; height:200px; border:1px solid #7F9DB9; overflow:auto;}
#msg {width:330px;}
</style>
@dfhe2004
dfhe2004 / phabricator_readme.md
Created September 15, 2017 10:05 — forked from sparrc/phabricator_readme.md
Phabricator Ubuntu Installation Guide

Phabricator Ubuntu Installation Guide

This is a supplement to the official Phabricator Installation Guide, because their guide will leave you with all kinds of permission and config errors and ~15,000 setup issues on startup.

Install bonus packages:

# apt-get install mercurial subversion python-pygments sendmail imagemagick

Create necessary users and add phd-user to sudoers: