Skip to content

Instantly share code, notes, and snippets.

View darthsuogles's full-sized avatar

Philip Yang darthsuogles

  • @phissenschaft
  • San Francisco Bay Area
View GitHub Profile
#include <thread>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cassert>
using namespace std;
void foncI(int m) {
@darthsuogles
darthsuogles / grid_histo.R
Last active July 6, 2016 04:48
Multiple histograms in a grid, each with its own y-axis scale
library(ggplot2)
# First get the Iris histogram
histo_list <- lapply(names(iris)[1:4],
function (colname) qplot(iris[[colname]], geom = "histogram", xlab = colname))
# Add two sets of random normal samples
n <- 100
histo_list[[5]] <- qplot(rnorm(n), geom='histogram', xlab='rand-norm-1')
histo_list[[6]] <- qplot(rnorm(n), geom='histogram', xlab='rand-norm-2')
\RequirePackage{amsmath,amsfonts,amsthm,amssymb}
\RequirePackage{mathtools}
\RequirePackage{graphicx}
% http://tex.stackexchange.com/questions/229355/algorithm-algorithmic-algorithmicx-algorithm2e-algpseudocode-confused
%\RequirePackage{algorithmicx, algpseudocode}
\RequirePackage[ruled,vlined]{algorithm2e}
\RequirePackage[T1]{fontenc}
\RequirePackage[utf8]{inputenc}
\RequirePackage{mathpazo} % add possibly `sc` and `osf` options
\RequirePackage{eulervm}
@darthsuogles
darthsuogles / eine_ligne.sh
Created September 19, 2015 19:30
Simple bash one-liners
# Change file names -> change spaces to under-scores
find . -name \*.ipynb -type f -exec bash -c 'mv "$@" $(echo "$@" | tr " " "_")' -- {} \;
import OpenEXR, Imath
import numpy as np
import matplotlib.pyplot as plt
def exr_split_channels(exr_fname):
"""
Load a Mitsuba render generated multi-channel OpenEXR file.
Split the channels according to the information stored.
"""
## Load all images
"""
Find an optimal way to explore the Olympic Park west of Seattle
Ref: http://www.nps.gov/olym/planyourvisit/gettingaround.htm
"""
import z3
# import matplotlib.pyplot as plt
# import seaborn as sns
# sns.set_context("paper") # also: talk, poster, etc.
git ls-files -ci --exclude-standard -z | xargs -0 git rm --cached 2>/dev/null
import json # export data for d3 visualization
import numpy as np
import scipy.cluster.hierarchy as hclust
## Compute histogram based on the Wasserstein distance matrix
def build_json_tree(node, parent):
"""
Build a tree for the json format
"""
# Recursively reload depedencies
# Ref: https://ipython.org/ipython-doc/dev/interactive/reference.html#dreload
from IPython.lib.deepreload import reload as dreload
# %load_ext autoreload
# %autoreload 2
import numpy as np
import scipy.io as sio
import json # export data for d3 visualization
from mlearn_hclust import hierarchical_clustering
<!DOCTYPE html>
<meta charset="utf-8">
<title>Votre Titre</title>
<style>
.node circle {
fill: #fff;
stroke: steelblue;
stroke-width: 1.5px;
}