Skip to content

Instantly share code, notes, and snippets.

View sicktastic's full-sized avatar
:octocat:
I may be slow to respond.

Anthony Lee sicktastic

:octocat:
I may be slow to respond.
View GitHub Profile
print(__doc__)
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.colors import ListedColormap
from sklearn import neighbors, datasets
n_neighbors = 15
# import some data to play with
@sicktastic
sicktastic / knn_regression.py
Last active September 9, 2016 16:41
kNN(k Nearest Neighbors) Algorithm example from http://goo.gl/cg0ELd
print(__doc__)
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Fabian Pedregosa <fabian.pedregosa@inria.fr>
#
# License: BSD 3 clause (C) INRIA
###############################################################################
# Generate sample data
@sicktastic
sicktastic / scss_structure.scss
Last active August 4, 2016 21:16
Structure this way, so we have a standard.
```scss
// Media Queries, iPhone Portrait, iPhone Landscape, iPad Portrait...
@media (max-width: 480px) {
// Mixins
// CSS Elements
// ID
// Class
}
@sicktastic
sicktastic / heuristic_function.py
Created July 16, 2016 21:30
Heuristic Function for Search, Lecture: https://goo.gl/aQgSgi
# -----------
# User Instructions:
#
# Modify the the search function so that it becomes
# an A* search algorithm as defined in the previous
# lectures.
#
# Your function should return the expanded grid
# which shows, for each element, the count when
# it was expanded or -1 if the element was never expanded.
# ----------
# Background
#
# A robotics company named Trax has created a line of small self-driving robots
# designed to autonomously traverse desert environments in search of undiscovered
# water deposits.
#
# A Traxbot looks like a small tank. Each one is about half a meter long and drives
# on two continuous metal tracks. In order to maneuver itself, a Traxbot can do one
# of two things: it can drive in a straight line or it can turn. So to make a
# In this exercise, you should implement the
# resampler shown in the previous video.
from math import *
import random
landmarks = [[20.0, 20.0], [80.0, 80.0], [20.0, 80.0], [80.0, 20.0]]
world_size = 100.0
class robot:
@sicktastic
sicktastic / 1_maximize_gaussian.py
Last active June 27, 2016 03:39
Comparing Kalman Filter: Maximize Gaussian math
from math import *
def f(mu, sigma2, x):
return 1 / sqrt(2. * pi * sigma2) * exp(-.5 * (x - mu) **2 / sigma2)
print f(10., 4., 10.)
class Tipper
TAX = 0.05
def initializer(amount:, discount_percentage: 0, tip_percentage:)
@amount = amount
@discount_percentage = discount_percentage
@tip_percentage = tip_percentage
end
def total
@sicktastic
sicktastic / registration_step_1.jsx
Last active May 28, 2016 14:35
Multistep wizard form with validation
var RetreatAttendeeRegistrationStart = React.createClass({
render: function() {
return (
<div>
<h1>Retreat Attendee Registration</h1>
<div className="form-group">
<label>First Name</label>
<input type="text"
id="first_name"
ref="first_name"
@sicktastic
sicktastic / localization.py
Last active May 23, 2016 03:08
Localization calculation
def localize(colors,measurements,motions,sensor_right,p_move):
# initializes p to a uniform distribution over a grid of the same dimensions as colors
def sense(p, colors, measurement):
aux = [[ 0.0 for row in range(len(p[0]))] for col in range(len(p))]
s = 0.0
for i in range(len(p)):
for j in range(len(p[i])):