Skip to content

Instantly share code, notes, and snippets.

View tarsisazevedo's full-sized avatar

Tarsis Azevedo tarsisazevedo

View GitHub Profile
=begin
>> custo_cds(10, 1)
=>custo total: 10
=>custo medio: 1
>> custo_cds(10, 1,2,3,1,5,3,7,1,8,2)
=>custo_total: 33
=>custo medio: 3,3
>> custo_cds(10, 1.5)
custo total: 15
custo medio: 1.5
@tarsisazevedo
tarsisazevedo / vimrc
Created November 19, 2010 10:24
My vim configuration file
We couldn’t find that file to show.
import this
from unittest import TestCase
class TestFatoresPrimo(TestCase):
def test_fatores_primos_13195(self):
self.assertEquals([5, 7, 13, 29], fatores_primos(13195))
def test_fatores_primos_600851475143(self):
self.assertEquals([71, 839, 1471, 6857], fatores_primos(600851475143))
def num_eh_primo(num):
from unittest import TestCase
from primos import num_eh_primo
class Test10001Primos(TestCase):
def test_achar_sexto_primo(self):
self.assertEquals(13, achar_n_primo(n=6))
def test_achar_10001_primo(self):
self.assertEquals(104743, achar_n_primo(n=10001))
from unittest import TestCase
class TestFatoresPrimo(TestCase):
def test_fatores_primos_13195(self):
self.assertEquals([5, 7, 13, 29], fatores_primos(13195))
def test_fatores_primos_600851475143(self):
self.assertEquals([71, 839, 1471, 6857], fatores_primos(600851475143))
def num_eh_primo(num):
// create a function that accepts two arguments and return them reverted
function revert(a, b){
return [b, a];
}
// create a function that no accepts arguments and return them reverted
function revert(){
return [ arguments[1], arguments[0] ];
}
from unittest import TestCase
import math
class FatorialDeN(TestCase):
def test_soma_do_resultado_do_fatorial_de_10(self):
self.assertEquals(27, soma_do_fatorial_de_n(n=10))
def test_soma_do_resultado_do_fatorial_de_100(self):
self.assertEquals(648, soma_do_fatorial_de_n(n=100))
@tarsisazevedo
tarsisazevedo / editar_arquivos_sed
Created June 28, 2011 14:55
editar arquivos na linha de comando
grep -R 'o_que_voce_quer_modificar' . | cut -d: -f1 | sort -u | xargs sed 's/o_que_voce_quer_modificar/o_que_voce_quer_colocar_no_lugar/' -i
from unittest import TestCase, main
class TestDecimalBinPalindromicsNumbers(TestCase):
def test_585_and_1001001001_are_palindromic(self):
self.assertTrue(is_palindromic_with_base_2(number=585))
def test_sum_of_all_palindromic_dec_bin_number_are_1000000(self):
self.assertEquals(sum_all_palindromic_dec_bin_of_numbers_to(1000000), 872187)