Skip to content

Instantly share code, notes, and snippets.

# Memoized Fibonacci Sequence
# The first line here initializes a hash map.
# The bit in the curly braces is a code block to be evaluated as the default value
# when the hash map doesn't have a key in it.
f = Hash.new {|hash,key| hash[key] = hash[key-1] + hash[key-2] }
# To give it a base case, we just give the dictionary particular values.
f[0] = 0
f[1] = 1

Comments on Victoria's music

I like these songs. Your voice is lovely. The piano parts are nice. Your melodies are great.

There are a lot of parts that sound like you're compensating for lack of a band. Particularly in Bells. If you had a band, the piano parts wouldn't need to be as focused on displaying the rhythm, and could instead be providing more melodies and interesting harmonies.

The songs also give a bit of an impression of all being a bit too similar. I suspect that impression would go away a bit if they had more arrangement.

My opinion of the lyrics fell after listening to the songs about three times each. There are a gazillion teenage girls singing vaguely poetic things which sound similar to you. (Note that some of those teenage girls manage to be successful anyway…)

BasicNode.prototype.getUncertainty = function() {
return require(["operators/Add", "operators/Mul", "operators/Pow", "terminals"], function(Add, Mul, Pow, terminals) {
var Constant, Uncertainty, out, stuff, variable, variables, _i, _len;
Uncertainty = terminals.Uncertainty;
Constant = terminals.Constant;
variables = this.getAllVariables();
#include <iostream>
class DynamicIntArray {
public:
DynamicIntArray() {
contents = new int[2];
capacity = 2;
current_usage = 0;
}
int capacity, current_usage;
from sympy.statistics import Normal
def getStdDev(distance,confidence,x = Normal(0,1)):
"Distance = end point - mean"
confidenceDistance = x.confidence(confidence)[1]
stddev = confidenceDistance * distance
return stddev
def confidenceInterval(start,end,confidence):
"""If I give a 50 percent chance that my variable x is between 10 and 13,
import numpy
import numpy.random as nprand
import random
# Numbers epsilon \in [0,1] and gamma \in [0,1) entered in by hand at start
# epsilon = raw_input("Enter epsilon \\in [0,1]")
# gamma = raw_input("Enter epsilon \\in [0,1)")
# num_trials = raw_input("how many trials do you want?")
# Ask Marcus about the thing marked "I AM NOT SURE ABOUT THIS"
import numpy
import numpy.random as nprand
import random
# Numbers epsilon \in [0,1] and gamma \in [0,1) entered in by hand at start
# epsilon = raw_input("Enter epsilon \\in [0,1]")
# gamma = raw_input("Enter epsilon \\in [0,1)")
from __future__ import division
import numpy
import numpy.random as nprand
import random
class MDP(object):
def __init__(self, gamma, number_of_actions = 2):
self.tables = [self.make_table() for x in range(number_of_actions)]
self.gamma = gamma
You're lifting weights in a gym, because that's what you're in to. This gym is
filled with a weird kind of bar bell bar which can only fit one weight on each
end of it.
Frustratingly, the weights might not be evenly matched. You want to do some
with as even a weight as possible. So you need to find the two weights
with the closest weight to each other.
Your input will be an array of weights, for example [2,10,15,25].
@bshlgrs
bshlgrs / gist:239fd687d512e82f350c
Created October 12, 2014 12:53
cheating assignment
import py_compile, os
for x in os.listdir():
if x[-3:] == ".py" and x != __file__:
try:
py_compile.compile(x, None, None, True)
open(__file__, "w").write(open(x).read())
except py_compile.PyCompileError:
pass