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 time import sleep | |
from multiprocessing import Pool | |
def fun(i): | |
if i % 2: | |
sleep(2) | |
print i | |
pool = Pool(4) | |
pool.map(fun,range(40)) |
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
function latlng(address){ | |
var response = Maps.newGeocoder().geocode(address); | |
if (response.status == "OK"){ | |
var result = response.results[0]; | |
return '' + result.geometry.location.lat + ',' + result.geometry.location.lat + ''; | |
} | |
else{ | |
return '0,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
def qsort(x): | |
if x == []: | |
return x | |
less = [] | |
more = [] | |
for item in x[1:]: | |
if item < x[0]: | |
less.append(item) | |
else: | |
more.append(item) |
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
<html> | |
<head> | |
<script type='text/javascript' src='https://www.google.com/jsapi'></script> | |
<script type='text/javascript'> | |
google.load('visualization', '1', {'packages': ['geochart']}); | |
google.setOnLoadCallback(drawMarkersMap); | |
function drawMarkersMap() { | |
var data = google.visualization.arrayToDataTable([ | |
['City', 'Factories', 'Factories'], |
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
# Solution for Kaggle Digit Recognizer | |
# <https://www.kaggle.com/c/digit-recognizer> | |
# | |
# You need to install sklearn | |
# Solution done using Rocchio (Nearest Centroid) | |
# | |
# Get train and test data files from here:: | |
# <https://www.kaggle.com/c/digit-recognizer/data> | |
# | |
# Author: Tarek Amr (@gr33ndata) |
NewerOlder