Skip to content

Instantly share code, notes, and snippets.

View AndreUltrasi's full-sized avatar

André Augusto Nunes Vieira AndreUltrasi

  • Guarulhos-SP, Brasil
View GitHub Profile
@AndreUltrasi
AndreUltrasi / memory.c
Created July 22, 2017 22:07
First fit memory allocation in C
memory = [0,1,0,0,1,0,0,1,0,0,0,1,0,0,0,0,0,0,0]
"""Mapas de bits, a memória é
dividida em unidades de alocação.
Cada bit do mapa representa uma
unidade de alocação, sendo que se
o bit for 0, a unidade está livre;
caso contrário, a unidade está
@AndreUltrasi
AndreUltrasi / passwordCracker.py
Last active August 18, 2024 04:48
Password Cracker in Python
references = {}
dictionary = []
def randomized(x, y):
from random import randint
return randint(x, y)
def cracker_per_digit(x):
@AndreUltrasi
AndreUltrasi / votacao.c
Created November 27, 2016 01:46
programa votacao em C
#include <stdio.h>
#include <stdlib.h>
#include <locale.h>
void menuPrincipal() {
printf("1 - Apurar votos\n");
printf("2 - Computar votos\n");
printf("3 - Sair\n");
}
void menuCandidatos() {
printf("1 - Candidato 1\n");
@AndreUltrasi
AndreUltrasi / 1÷k**4=pi**2÷6.py
Created November 27, 2016 01:45
série sum k1=1 1/k**4=pi**2/6 em python
#Real
#1.6449340668482264
#by python when m = 10**6
#1.6449330668487701
pi=3.14159265358979323846264338327950288419716939937510582097494459230781
k = 1
#m = infinity
#1/k**4=pi**2/6
m=1000
tmp=1/k**2
@AndreUltrasi
AndreUltrasi / (m*(m+1))÷2.py
Created November 27, 2016 01:44
Série 1+2+3+4...=(m*(m+1))/2 em python
print("k1 = 1")
print("k1+ k2 +...+ m = (m*(m+1))/2")
k = 1
m=int(input("m = "))
tmp = k
print("k = ",k)
print("sum = ", tmp)
while k < m:
k+=1
tmp+=k
@AndreUltrasi
AndreUltrasi / euler.py
Created November 27, 2016 01:42
Gerando número de euler em python
#1/0!+1/1!+1/2!+1/3!+1/4!+1/5!+1/6!...
#Real Euler's number
#e=2.718281828459045235360287471352662497757247093699959574966967627724076630353547594571382178...
#by Python
#e=2.7182818284590455
def factorial(z):
elist=[]
product=1
while z>0:
elist.append(z)
@AndreUltrasi
AndreUltrasi / games.py
Created November 27, 2016 01:42
Conjunto de 3 jogos em python
global moedas
global personagem
global list
def aleatorio(x,y):
from random import randint
return randint(x,y)
def begin():
global moedas
@AndreUltrasi
AndreUltrasi / 0.3°.py
Created November 27, 2016 01:41
série 1/4+1/4**2...=1/3
#1/4+1/4*2....=1/3
x=0.25
n=2
while n!=30:
print(x,n)
x=x + 1/4**n
n+=1
@AndreUltrasi
AndreUltrasi / 1=1÷2+1÷4.py
Created November 27, 2016 01:40
série 1=1÷2+1÷4.... em python
#1=1/2+1/4+1/8....
x=0
y=1
while y!=56:
x+=1/(2**y)
print ("y =",y)
print(x)
y+=1
@AndreUltrasi
AndreUltrasi / 11-2=3**2.py
Created November 27, 2016 01:39
Serie (11)*n-(2)*n=((3)*n)**2 em python
"""11-2=3**2
1111-22=33**2
111111-222=333**2"""
n = 1
while n != 18 :
tmp = n
x = 0
y = 0
while tmp > 0:
x += 10**(tmp-1)*(10**(tmp-1) + 10**(tmp))