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
############################################## | |
# RESOLVENDO EQUAÇÕES DO SEGUNDO GRAU | |
# PROGRAMADOR: YUGI | |
# DATA: 28/12/2011 | |
############################################## | |
=begin | |
EQUAÇOES DO SEGUNDO GRAU SÃO AQUELAS DADAS PELA FÓRMULA: | |
ax2 + bx + c = 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
############################################# | |
# FUNÇÃO PARA VALIDAÇÃO DE DATA | |
# PROGRAMADOR: YUGI | |
# DATA: 28/12/2011 | |
############################################ | |
def valdata(data) | |
ret = FALSE | |
mapa = "0123456789/" |
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
#################################################### | |
# FUNCAO DE VALIDAÇÃO DE MÊS A TÍTULO DE EXERCÍCIO | |
# PROGRAMADOR: YUGI | |
# DATA: 28/12/2011 | |
#################################################### | |
# OBJETIVO: | |
# Não deve aceitar meses consecutivos dentro do mesmo ano | |
# | |
def valid_months(vet) |
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
####################################### | |
# EXERCÍCIO PARA MÁSCARA | |
# PROGRAMADOR: YUGI | |
# DATA: 28/03/2011 | |
####################################### | |
# | |
# Deve completar a máscara de acordo com o número informado | |
# | |
=begin |
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
################################################################# | |
# O ALGORITMO ASSIMÉTRICO RSA COMPLETO | |
# PROGRAMADOR: YUGI | |
# DATA: 27/12/2011 | |
################################################################# | |
# ============================================================================================ | |
# OBSERVAÇÕES: | |
# AQUI NÓS TEMOS A CRIPTOGRAFIA RSA TOTALMENTE ESCRITA EM RUBI | |
# UMA CHAVE DE 1024 BITS PODE SER GERADA EM MENOS DE 2 MINUTOS |
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
# Função que retorna todos os números primos até dado limite | |
def mapaprimo(limite) | |
# se limite = 1_000_000 o processamento deve durar cerca de 20s num intel 2,4GHZ | |
xcont = 5 | |
num = 13 | |
mapaprimo = Array.new | |
mapaprimo[0] = 2 | |
mapaprimo[1] = 3 | |
mapaprimo[2] = 5 |
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
=begin | |
Esta mascara permite incluir um separador em um campo numa determinada | |
posicao e opcionalmente completar o seu tamanho à esquerda ou à direita. | |
Parâmetros: | |
1 - String a ser transformada pela mascara | |
2 - Caracter utilizado como separador | |
3 - posicao do caracter utilizado como separador. Se negativo começa a contagem do final da String para o Princípio | |
4 - Total de caracteres da String Resultante | |
5 - "D" ou "E" - Este parâmetro diz se os caracteres que complem o tamanho da string estão à direita ou à esquerda | |
6 - caracter de preenchimento par ao tamanho total |
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
$mapa = ['01','02','03','04','05','06','07','08','09','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25'] | |
$xmap1 = Array.new | |
$xmap2 = Array.new | |
$xmap3 = Array.new | |
$xmap4 = Array.new | |
# ---------------------------------------------------------------------------- | |
def formata(palavra) | |
if palavra.size != 2 | |
palavra = "0" + palavra |
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
=begin | |
INICIANDO O APLICATIVO E GERENCIANDO A CHAVE... | |
=end | |
require 'ftools' # acrescenta Metodos para mover, copiar, apagar e comparar arquivos | |
# FUNCOES: | |
def form10(palavra) | |
while TRUE |