This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$puppetmaster_ip = '8.8.8.8' | |
augeas { "puppetmaster_in_hosts_append": | |
context => "/files/etc/hosts", | |
changes => [ | |
"set 01/ipaddr '${puppetmaster_ip}'", | |
"set 01/canonical puppet", | |
], | |
onlyif => "match *[ipaddr = '${puppetmaster_ip}'] size == 0" | |
} -> augeas { "puppetmaster_in_hosts_update": |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import numpy.random as rand | |
import matplotlib.pyplot as plt | |
def dnorm(x, m, s): | |
return np.exp(-((x - m) ** 2) / (2 * s)) / np.sqrt(2 * np.pi * s) | |
def EM(data, init, iter): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import numpy.random as rand | |
import matplotlib.pyplot as plt | |
def mixture_gaussian(i): | |
pi_0 = 0.3 | |
if rand.random() < pi_0: | |
return rand.normal(-5, 1) | |
else: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Three ways of computing the Hellinger distance between two discrete | |
probability distributions using NumPy and SciPy. | |
""" | |
import numpy as np | |
from scipy.linalg import norm | |
from scipy.spatial.distance import euclidean | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Just copy and paste the lines below (all at once, it won't work line by line!) | |
# MAKE SURE YOU ARE HAPPY WITH WHAT IT DOES FIRST! THERE IS NO WARRANTY! | |
function abort { | |
echo "$1" | |
exit 1 | |
} | |
set -e |