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 random | |
import string | |
LINES, WORDS, CHARS = [int(sys.argv[x]) for x in (range(1,1+3))] | |
randomize = random.Random() | |
random_number = randomize.randint | |
choice_one = randomize.choice | |
possible_letters = string.ascii_letters |
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 | |
def distrincha(): | |
words = set() | |
plain_text = list() | |
codded_text= list() | |
# need for speed | |
_words_add = words.add | |
_codded_text_append = codded_text.append |
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
$ python3 -m cProfile distrincha.py < test.txt | |
Total of words: 42740 | |
120568 function calls in 229.015 seconds | |
Ordered by: standard name | |
ncalls tottime percall cumtime percall filename:lineno(function) | |
102 0.002 0.000 0.004 0.000 codecs.py:297(decode) | |
1 0.181 0.181 229.015 229.015 distrincha.py:1() | |
5000 0.184 0.000 0.325 0.000 distrincha.py:12() |
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] |
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 55e5156a7628e1d752000132@diy-sysincloudit.rhcloud.com ... | |
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
[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
[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
#!/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
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
>>> 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 |