This file contains hidden or 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 python | |
| # -*- coding: utf-8 -*- | |
| MIN = 0 | |
| MAX = 255 | |
| MAX_ERROS = 3 | |
| QTD = 4 | |
| def pedir_inteiro(min, max, max_erros): | |
| erros = 0 |
This file contains hidden or 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
| # include <stdio.h> | |
| int main(int argc, char* argv[]){ | |
| char a = 1 << 7; | |
| unsigned char b = 2 * (a - 1) + 1; | |
| short int c = 1 << 15; | |
| unsigned short int d = 2 * (c - 1) + 1; | |
| long int e = 1L << 31; |
This file contains hidden or 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 python | |
| # -*- coding: utf-8 -*- | |
| def crc32(string): | |
| crctab = [] | |
| for table in range(256): | |
| crc = table << 24 |
This file contains hidden or 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 python | |
| # -*- coding: utf-8 -*- | |
| import threading | |
| import time | |
| # Máximo de conexões/threads simultâneas | |
| MAX_CONEXOES = 30 | |
| # Função para imprimir uma linha por vez via lock |
This file contains hidden or 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 python | |
| # -*- coding: utf-8 -*- | |
| import threading | |
| import time | |
| import sys,os | |
| import subprocess | |
| # Máximo de conexões/threads simultâneas | |
| MAX_CONEXOES = 30 |
This file contains hidden or 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 python | |
| # -*- coding: utf-8 -*- | |
| with open("/tmp/nomes.txt", "r+") as arquivo: | |
| c = arquivo.read(1) | |
| while c: | |
| while c and c not in ("\r", "\n"): | |
| c = arquivo.read(1) | |
| if c: | |
| arquivo.seek(-1, 1) # volta uma posição |
This file contains hidden or 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 python | |
| # -*- coding: utf-8 -*- | |
| import time | |
| import signal | |
| continuar = True | |
| sinais = dict((signal.__dict__[sinal], sinal) for sinal in dir(signal) | |
| if sinal.startswith("SIG")) |
This file contains hidden or 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
| # -*- coding: utf-8 -*- | |
| from __future__ import print_function | |
| ciclos = int(input("Digite o número de ciclos: ")) | |
| import time | |
| t0 = time.time() | |
| base = [1, 5, 11, 13, 17, 19, 23, 25, 29, 31, 37, 41] |
This file contains hidden or 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 python | |
| # -*- coding: utf-8 -*- | |
| def perguntar(texto, tipo, igual_a=None, maior_que=None, menor_que=None): | |
| texto += ' ' if texto[-1] in [':', '?'] else ': ' | |
| while True: | |
| try: | |
| digitado = tipo(raw_input(texto)) | |
| valido = (igual_a is None |
This file contains hidden or 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 python | |
| # -*- coding: utf-8 -*- | |
| import re | |
| OPERADORES = (u'√^', '*/', '+-') | |
| RE_OPS = '([\\' + '\\'.join(''.join(OPERADORES)) + '])' | |
| def separar_operandos_e_operadores(expressao): |
OlderNewer