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 requests | |
from BeautifulSoup import BeautifulSoup | |
def megasena_api(): | |
URL_ULTIMOS_RESULTADOS = 'http://www1.caixa.gov.br/loterias/loterias/megasena/megasena_pesquisa_new.asp' | |
page = requests.get(URL_ULTIMOS_RESULTADOS) | |
bs = BeautifulSoup(page.content) | |
numeros_sena = [ n.contents[0] for n in bs.findAll('li')[:6]] | |
results = page.content.split('|') |
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
//FightCode can only understand your robot | |
//if its class is called Robot | |
var Robot = function(robot) { | |
}; | |
Robot.prototype.onIdle = function(ev) { | |
var robot = ev.robot; | |
robot.turn(360); |
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
#-*-coding: utf-8 -*- | |
''' | |
This module represents the FriendsRecommender system for recommending | |
new friends based on friendship similarity and state similarity. | |
''' | |
__author__ = 'Marcel Caraciolo <[email protected]>' |
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
d = {192: u'A', 193: u'A', 194: u'A', 195: u'A', 196: u'A', 197: u'A', | |
199: u'C', 200: u'E', 201: u'E', 202: u'E', 203: u'E', 204: u'I', | |
205: u'I', 206: u'I', 207: u'I', 209: u'N', 210: u'O', 211: u'O', | |
212: u'O', 213: u'O', 214: u'O', 216: u'O', 217: u'U', 218: u'U', | |
219: u'U', 220: u'U', 221: u'Y', 224: u'a', 225: u'a', 226: u'a', | |
227: u'a', 228: u'a', 229: u'a', 231: u'c', 232: u'e', 233: u'e', | |
234: u'e', 235: u'e', 236: u'i', 237: u'i', 238: u'i', 239: u'i', | |
241: u'n', 242: u'o', 243: u'o', 244: u'o', 245: u'o', 246: u'o', | |
248: u'o', 249: u'u', 250: u'u', 251: u'u', 252: u'u', 253: u'y', |
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
#-*-coding: utf-8 -*- | |
''' | |
This module represents the recommender system for recommending | |
new friends based on 'mutual friends'. | |
''' | |
__author__ = 'Marcel Caraciolo <[email protected]>' |
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
#-*-coding: utf-8 -*- | |
''' | |
This module represents the recommender system for recommending | |
new friends based on 'mutual friends'. | |
''' | |
__author__ = 'Marcel Caraciolo <[email protected]>' |
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
#-*-coding: utf-8 -*- | |
''' | |
This module represents the recommender system for recommending | |
new friends based on 'mutual friends'. | |
''' | |
__author__ = 'Marcel Caraciolo <[email protected]>' |
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 count_max_of_mutual_friends(self, key, values): | |
''' | |
Prepare the dataset to yield the source and | |
get the top suggestions. | |
Input ({[friend1, friend2], numberOfMutualFriends}): | |
["fabio", "marcel"] 1 | |
["fabiola", "marcel"] 1 |
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 count_number_of_friends(self, key, values): | |
''' | |
Count the number of mutual friends. | |
Input ({[friend1, friend2], [-1, -1]}; | |
{[friend1, friend2],[1, 1]};): | |
["jonas", "marcel"] -1 | |
["marcel", "maria"] -1 | |
["jose", "marcel"] -1 |