Skip to content

Instantly share code, notes, and snippets.

View fmasanori's full-sized avatar

Fernando Masanori fmasanori

View GitHub Profile
@fmasanori
fmasanori / guess_names.py
Created April 8, 2014 21:54
Guess girl names
import random
girls = '''Júlia Sophia Isabella Manuela Giovanna Alice Laura
Luiza Beatriz Mariana Yasmin Gabriela Rafaela Isabelle Lara
Letícia Valentina Nicole Sarah Vitória Isadora Lívia Helena
Lorena Clara Larissa Emanuelly Heloisa Marina Melissa Gabrielly
Eduarda Rebeca Amanda Alícia Bianca Lavínia Fernanda Ester
Carolina Emily Cecília Pietra Milena Marcela Laís Natália
Maria Bruna Camila Luana Catarina Olivia Agatha Mirella
Sophie Stella Stefany Isabel Kamilly Elisa Luna Eloá Joana
Mariane Bárbara Juliana Rayssa Alana Caroline Brenda Evelyn
g = {}
g[1] = [2, 3, 5]
g[2] = [1, 6, 4]
g[3] = [1, 4, 7]
g[4] = [2, 3, 8]
g[5] = [1, 6, 7]
g[6] = [2, 5, 8]
g[7] = [3, 5, 8]
g[8] = [4, 6, 7]
removidos = [True] + 8 * [False]
@fmasanori
fmasanori / Thanking_fb.py
Created January 29, 2014 20:49
Thanking my 500+ friends who wished me on my birthday on Facebook, by by Akshit Khurana
import requests
import json
AFTER = 1353233754
TOKEN = ' <insert token here> '
#by Akshit Khurana
def get_posts():
"""Returns dictionary of id, first names of people who posted on my wall
between start and end time"""
query = ("SELECT post_id, actor_id, message FROM stream WHERE "
@fmasanori
fmasanori / hfmix.pyw
Created November 28, 2013 21:27
Head First DJ Mix
from tkinter import *
from sound_panel import *
import pygame.mixer
import os
app=Tk()
app.title('Head First Mix')
mixer = pygame.mixer
mixer.pre_init(buffer = 300)
mixer.init()
@fmasanori
fmasanori / sound_panel.py
Created November 28, 2013 21:18
sound_panel class for DJ Mix
from tkinter import *
import pygame.mixer
class SoundPanel(Frame):
def track_toggle(self):
if self.track_playing.get() == 1:
self.track.play(loops = -1)
else:
self.track.stop()
def change_volume(self, v):
@fmasanori
fmasanori / pi.py
Created October 28, 2013 23:18
Cálculo de Pi
def pi_digits(n):
k, a, b, a1, b1 = 2, 4, 1, 12, 4
while n > 0:
p, q, k = k*k, 2*k+1, k+1
a, b, a1, b1 = a1, b1, p*a+q*a1, p*b+q*b1
d, d1 = a/b, a1/b1
while d == d1:
yield int(d)
n -= 1
a, a1 = 10*(a%b), 10*(a1%b1)
@fmasanori
fmasanori / metaprogramming42.py
Last active June 2, 2020 21:49
42 metaprogramming
from functools import wraps
def hitchhiker(func):
@wraps(func)
def wrapper(*args, **kwargs):
return 42
return wrapper
@hitchhiker
def fat(n):
if n < 2: return 1
@fmasanori
fmasanori / hacking_bixurras.py
Last active December 23, 2015 12:49
Código Xtreme Go Horse que fiz em 2 minutos para hackear fotos dos calouros da FATEC haha
#conteúdo do texto abaixo original de http://afterfest.com.br/fotos/XV-Edicao
texto = '''
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Fotos BIXURRASCO - XV Edicao - FATEC - 14/09/2013 - Afterfest</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta content="all" name="robots" />
@fmasanori
fmasanori / asteroids.py
Created July 19, 2013 21:02
CodeSkulptor Asteroids
# program template for Spaceship
import simplegui
import math
import random
# globals for user interface
WIDTH = 800
HEIGHT = 600
score = 0
lives = 3
@fmasanori
fmasanori / adivinha.py
Created July 18, 2013 13:05
Jogo simples em Python 3
from random import randint
print ('Bem vindo!')
sorteado = randint(1, 100)
chute = 0
while chute != sorteado:
chute = int(input ('Chute: '))
if chute == sorteado:
print ('Você venceu!')
else:
if chute > sorteado: