Skip to content

Instantly share code, notes, and snippets.

View marcelcaraciolo's full-sized avatar
💭
Coding !

Marcel Caraciolo marcelcaraciolo

💭
Coding !
View GitHub Profile
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('|')
@marcelcaraciolo
marcelcaraciolo / robot.js
Created December 1, 2012 14:14
Crusher
//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);
@marcelcaraciolo
marcelcaraciolo / cookie.py
Created November 1, 2012 18:52
cookiejar
@marcelcaraciolo
marcelcaraciolo / atepassar_recommender.py
Created October 29, 2012 01:51
Atepassar Simple Algorithm for Friends Recommendation
#-*-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]>'
@marcelcaraciolo
marcelcaraciolo / asciize.py
Created October 18, 2012 05:20
Removedor de Acentos
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',
@marcelcaraciolo
marcelcaraciolo / friends_recommender_exp.py
Created October 11, 2012 18:13
friends recommender with explanations
#-*-coding: utf-8 -*-
'''
This module represents the recommender system for recommending
new friends based on 'mutual friends'.
'''
__author__ = 'Marcel Caraciolo <[email protected]>'
@marcelcaraciolo
marcelcaraciolo / friends_recommender.py
Created October 10, 2012 18:31
Twitter Friends Recommender
#-*-coding: utf-8 -*-
'''
This module represents the recommender system for recommending
new friends based on 'mutual friends'.
'''
__author__ = 'Marcel Caraciolo <[email protected]>'
@marcelcaraciolo
marcelcaraciolo / friends_recommender_exp.py
Created August 29, 2012 04:24
friends recommender with explanations
#-*-coding: utf-8 -*-
'''
This module represents the recommender system for recommending
new friends based on 'mutual friends'.
'''
__author__ = 'Marcel Caraciolo <[email protected]>'
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
@marcelcaraciolo
marcelcaraciolo / count_number_of_friends.py
Created August 26, 2012 22:13
count_number_of_friends
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