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
""" | |
Test Driven Learning Project. | |
Desenvolva TDD e programação com TDD e programação! | |
Módulo novice. | |
The MIT License (MIT) | |
Copyright (c) 2016 Paulo Henrique Rodrigues Pinheiro <[email protected]> | |
Permission is hereby granted, free of charge, to any person obtaining a copy |
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
import random | |
import signal, os | |
# Xupinskado de https://docs.python.org/2/library/signal.html#signal.setitimer | |
def handler(signum, frame): | |
print('Acabando....', signum) | |
raise NameError("Acaboooooouuuuuuuuu!!!!") | |
# Set the signal handler and a 1-second alarm |
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
--ep4 | |
fatorial x | (x==1) = 1 | |
| otherwise = x * fatorial (x-1) | |
e_x x n | (n==0) = 1 | |
| otherwise = ( (x**n) / fatorial n ) + (e_x x (n-1) ) | |
delta x = delta' x 0 | |
where delta' x n | (exp_x - (e_x x n)) < 0.001 = 0 | |
| otherwise = 1 + delta' x (n+1) |
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
>>> a = "<h1>Titulo</h1>\n<br><p>paragrafo</p>\n<br>\n" | |
>>> print a | |
<h1>Titulo</h1> | |
<br><p>paragrafo</p> | |
<br> | |
>>> b = a.replace('\n','') | |
>>> b.replace('\r','') | |
'<h1>Titulo</h1><br><p>paragrafo</p><br>' | |
>>> print b |
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
import unittest | |
import inspect | |
import importlib | |
import app_config # my config for this application | |
class RequirementsTestCase(unittest.TestCase): | |
def test_requirement_exist(self): |
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
#!/usr/bin/env bash | |
DB="DATABASE_NAME" | |
DB_AUTH="-uroot -ptoor" | |
DB_BACKUP_DIR="/some/location" | |
DB_GLOB_FOR_BACKUP="dump-*.gz" | |
MAX_JOBS=30 | |
cd $DB_BACKUP_DIR || exit |
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
[data]$ perlbrew available | |
perl-5.22.0 | |
perl-5.20.2 | |
perl-5.18.4 | |
perl-5.16.3 | |
perl-5.14.4 | |
perl-5.12.5 | |
perl-5.10.1 | |
perl-5.8.9 | |
perl-5.6.2 |
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
[data]$ echo 'source $OPENSHIFT_DATA_DIR/perlbrew/etc/bashrc' >> .bash_profile | |
[data]$ echo 'alias perlbrew=$PERLBREW_ROOT/bin/perlbrew' >> .bash_profile | |
[data]$ echo 'alias patchperl=$PERLBREW_ROOT/bin/patchperl' >> .bash_profile | |
[data]$ cat .bash_profile | |
# Warning: Be careful with modifications to this file, | |
# Your changes may cause your application to fail. | |
source $OPENSHIFT_DATA_DIR/perlbrew/etc/bashrc | |
alias perlbrew=$PERLBREW_ROOT/bin/perlbrew | |
alias patchperl=$PERLBREW_ROOT/bin/patchperl |
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
phrp@paulaum:~$ rhc ssh diy | |
Connecting to [email protected] ... | |
Enter passphrase for key '/home/phrp/.ssh/id_rsa': | |
********************************************************************* | |
You are accessing a service that is for use only by authorized users. | |
If you do not have authorization, discontinue use at once. | |
Any use of the services is subject to the applicable terms of the | |
agreement which can be found at: |
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
import sys | |
import sortedcontainers | |
words = sortedcontainers.SortedSet() | |
plain_text = list() | |
codded_text= list() | |
# read content | |
plain_text = [l.strip().split() for l in sys.stdin] |