Skip to content

Instantly share code, notes, and snippets.

View tarsisazevedo's full-sized avatar

Tarsis Azevedo tarsisazevedo

View GitHub Profile
from unittest import TestCase, main
class TestGerarSequencia(TestCase):
def test_sequencia_de_13_deve_ser_13_40_20_10_5_16_8_4_2_1(self):
self.assertEquals([13, 40, 20, 10, 5, 16, 8, 4, 2, 1], gerar_sequencia(13))
def test_qual_numero_com_maior_sequencia_entre_1_e_1000000(self):
self.assertEquals(maior_numero_com_maior_sequencia_ate(1000000), 837799)
def maior_numero_com_maior_sequencia_ate(numero):
from unittest import TestCase, main
class TestFibonacci(TestCase):
def test_primeiro_termo_fibonacci_com_numero_de_3_digitos(self):
self.assertEquals(primeiro_fibonacci_com(digitos=3), 12)
def test_primeiro_termo_fibonacci_com_numero_de_4_digitos(self):
self.assertEquals(primeiro_fibonacci_com(digitos=1000), 4782)
def primeiro_fibonacci_com(digitos=1):
from unittest import TestCase, main
import math
class TestNumerosTriangulares(TestCase):
def test_numero_28_deve_ter_5_divisores(self):
"""docstring for test_numero_28_deve_ter_5_divisores"""
self.assertEquals(primeiro_numero_triangular_com(divisores=5), 28)
def test_numero_x_deve_ter_500_divisores(self):
"""docstring for test_numero_x_deve_ter_500_divisores"""
big_number = "7316717653133062491922511967442657474235534919493496983520312774506326239578318016984801869478851843858615607891129494954595017379583319528532088055111254069874715852386305071569329096329522744304355766896648950445244523161731856403098711121722383113622298934233803081353362766142828064444866452387493035890729629049156044077239071381051585930796086670172427121883998797908792274921901699720888093776657273330010533678812202354218097512545405947522435258490771167055601360483958644670632441572215539753697817977846174064955149290862569321978468622482839722413756570560574902614079729686524145351004748216637048440319989000889524345065854122758866688116427171479924442928230863465674813919123162824586178664583591245665294765456828489128831426076900422421902267105562632111110937054421750694165896040807198403850962455444362981230987879927244284909188845801561660979191338754992005240636899125607176060588611646710940507754100225698315520005593572972571636269561882670428252483600823257530420752963450"
import
By Klaus Wuestefeld
1) Torne-se excelente.
Seja realmente bom em alguma coisa. Não fique só choramingando ou
querendo progredir às custas dos outros. Não pense q pq vc sentou 4
anos numa faculdade ouvindo um professor falar sobre software q vc
sabe alguma coisa. Jogador de futebol não aprende a jogar bola tendo
aula. Ele pratica. Instrumentistas geniais nao aprendem a tocar tendo
aula. Eles praticam. Pratique. Chegue em casa depois do trabalho e da
@tarsisazevedo
tarsisazevedo / vagrant.vim
Created August 15, 2011 05:28
set vagrant syntax highlight like ruby
au BufRead,BufNewFile Vagrantfile set filetype=ruby
@tarsisazevedo
tarsisazevedo / gist:1252153
Created September 29, 2011 22:46
ressurect file deleted in git
git log --diff-filter=D --summary
git checkout $commit~1 filename
@tarsisazevedo
tarsisazevedo / removetrailling.sh
Created October 4, 2011 14:43 — forked from bernardobarreto/removetrailling.sh
Remove trailling caracters from all files in the folder
for f in $(find -name \*.py | xargs egrep -r -l '\s+$') ; do
sed -r -i 's/\s+$//' $f ;
done
@tarsisazevedo
tarsisazevedo / compile_vim_on_mac.sh
Created October 11, 2011 17:28
compile vim on mac with python and ruby support
./configure --enable-rubyinterp --enable-multibyte --with-features=huge --enable-pythoninterp
make
sudo make install
@tarsisazevedo
tarsisazevedo / sum_month_with_python.py
Created October 12, 2011 15:46
sum month with python
from datetime import datetime
from dateutil.relativedelta import relativedelta
one_month = datetime.date(datetime.now()) + relativedelta(months=1)