Skip to content

Instantly share code, notes, and snippets.

@mdengler
mdengler / install-tmux
Last active October 19, 2015 22:46 — forked from rothgar/install-tmux
Install tmux 2.1 on rhel/centos 6
# Install tmux on Centos release 6.5
# install deps
yum install gcc kernel-devel make ncurses-devel
# DOWNLOAD SOURCES FOR LIBEVENT AND MAKE AND INSTALL
curl -OL https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz
tar -xvzf libevent-2.0.21-stable.tar.gz
cd libevent-2.0.21-stable
./configure --prefix=$HOME &&
@mdengler
mdengler / README.md
Last active August 29, 2015 14:02 — forked from mbostock/.block
Wilson's algorithm by mbostock, with quicker-completion starting conditions

Wilson’s algorithm uses loop-erased random walks to generate a uniform spanning tree — an unbiased sample of all possible spanning trees. Most other maze generation algorithms, such as Prim’s, random traversal and randomized depth-first traversal, do not have this beautiful property.

The algorithm initializes the maze with eight arbitrary starting cells. Then, a new cell is added to the maze, initiating a random walk (shown in magenta). The random walk continues until it reconnects with the existing maze (shown in white). However, if the random walk intersects itself, the resulting loop is erased before the random walk continues.

The global structure of the maze can be more easily seen by flooding it with color.

To play with this yourself, [instructions from Uehreka on http://news.yco

import numpy as np
from sklearn.datasets import fetch_20newsgroups
from sklearn.feature_extraction.text import CountVectorizer
def get_vectors(vocab_size=5000):
newsgroups_train = fetch_20newsgroups(subset='train')
vectorizer = CountVectorizer(max_df=.9, max_features=vocab_size)
vecs = vectorizer.fit_transform(newsgroups_train.data)
vocabulary = vectorizer.vocabulary
terms = np.array(vocabulary.keys())
ּ_בּ
בּ_בּ
טּ_טּ
כּ‗כּ
לּ_לּ
מּ_מּ
סּ_סּ
תּ_תּ
٩(×̯×)۶
٩(̾●̮̮̃̾•̃̾)۶
@mdengler
mdengler / gist:3944990
Created October 24, 2012 09:06 — forked from booyaa/gist:3944974
fixperms.sh
#!/bin/sh
set -e
set -x
for dir in /home/*; do
username=`basename "$dir"`
users_group=`id --group $username`
chown -R $username:$users_group $username
done