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
%matplotlib inline | |
import numpy as np | |
import matplotlib.pyplot as plt | |
xs = np.arange(-100, 100, 0.1) | |
ys = np.sin(xs) | |
n = 75 | |
def mcloren(x): |
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
def get_area(matrix, start_row, start_col): | |
max_area = 0 | |
height = 0 | |
prev_line_width = 0 | |
for j in range(start_row, len(matrix)): | |
row = matrix[start_row] | |
height += 1 | |
current_line_width = 0 |
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
Index url score score_delta uid time_delta speed date | |
0 52790 /start_game: 0 0 57519da4fa2950be58e0645c 0.000 0.000000 2016-06-03T15:11:11.049Z | |
1 52258 /update_score: 0 0 57519da4fa2950be58e0645c 125.641 0.000000 2016-06-03T15:11:30.408Z | |
2 52266 /start_game: 0 0 57519da4fa2950be58e0645c 0.000 0.000000 2016-06-03T15:11:53.763Z | |
3 52799 /update_score: 1 1 57519da4fa2950be58e0645c 33.096 0.030215 2016-06-03T15:12:03.504Z | |
4 52801 /update_score: 1 0 57519da4fa2950be58e0645c 1.593 0.000000 2016-06-03T15:12:05.097Z | |
5 52804 /update_score: 2 1 57519da4fa2950be58e0645c 18.421 0.054286 2016-06-03T15:12:23.518Z | |
6 52276 /update_score: 3 1 57519da4fa2950be58e0645c 9.985 0.100150 2016-06-03T15:12:33.503Z |
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
from __future__ import print_function | |
from pyspark import SparkContext, SparkConf | |
from pyspark.mllib.linalg import DenseVector, VectorUDT | |
from pyspark.sql import SQLContext | |
from pyspark.ml.classification import MultilayerPerceptronClassifier | |
from pyspark.ml.evaluation import MulticlassClassificationEvaluator | |
from pyspark.sql.types import StructType, StructField, StringType, DoubleType, ArrayType |
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 random | |
def sample(p): | |
x, y = random.random(), random.random() | |
return 1 if x*x + y*y < 1 else 0 | |
def run(sc, num_samples): | |
count = sc.parallelize(xrange(0, num_samples)).map(sample) \ | |
.reduce(lambda a, b: a + b) | |
print "Pi is roughly %f" % (4.0 * count / num_samples) |
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
#include <exception> | |
#include <stdexcept> | |
#include <string> | |
class NotImplementedException : public std::runtime_error { | |
public: | |
NotImplementedException(const std::string& str) | |
: std::runtime_error(str) { | |
} |
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
package main | |
import ( | |
"fmt" | |
"net" | |
"os" | |
) | |
const ( | |
CONN_HOST = "localhost" |
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
using Generation = std::vector<Genome>; | |
constexpr int buildingSize = 100; | |
Genome createGenome() { | |
Genome genome; | |
int currentFloor = 0; | |
do { |
NewerOlder