Skip to content

Instantly share code, notes, and snippets.

@robbymeals
robbymeals / node-and-npm-in-30-seconds.sh
Created October 21, 2015 16:04 — forked from isaacs/node-and-npm-in-30-seconds.sh
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.com/install.sh | sh
@robbymeals
robbymeals / likelihood.R
Created October 31, 2012 15:52
Binomial Proportion Post Gists 2
### Function: Likelihood Plot Values
likelihood <- function(N,Y){
a <- Y + 1
b <- N - Y + 1
dom <- seq(0,1,0.005)
val <- dbeta(dom,a,b)
return(data.frame('x'=dom, 'y'=val))
}
@robbymeals
robbymeals / Y_samp.R
Created October 31, 2012 06:42
Binomial Proportion Post Gists
Y_samp <- sum(Zsamp)
@robbymeals
robbymeals / SimLDACorpus.R
Created October 31, 2012 06:37
Code that simulates an LDA corpus.
## Perform Inference on Simulated LDA Corpus
library(MCMCpack)
library(ggplot2)
library(tm)
library(topicmodels)
library(plyr)
setwd('/home/rmealey/Dropbox/LaPlacianAmbitions/10-TopicModels')
##################################
@robbymeals
robbymeals / MontyMonteAll.R
Created October 31, 2012 05:45
Monty Hall Monte Carlo Code
#### Monty Hall Monte Carlo
#### Rob Mealey
library(ggplot2)
library(RColorBrewer)
library(reshape2)
### Function: Run simulation n times and plot results in stacked bar histograms
montyMonte <- function(n,titleSize=7,legendTitle=5,ytextSize=5,xtextSize=5){
Picks <- c()
Opens <- c()