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
| from jrelogio import Relogio | |
| rel = Relogio() | |
| rel.start() | |
| from java.awt import * | |
| rel.mostrador.foreground = Color.RED | |
| print rel.mostrador.text | |
| from time import sleep |
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
| from collections import Counter | |
| l = Counter([1,2,3,3,3,4]) | |
| co = filter(lambda n: l[n]==1 , l) | |
| ct = [n for n in l if l[n]==1] | |
| assert co == ct |
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
| """ | |
| >>> romanos(1) | |
| 'I' | |
| >>> romanos(2) | |
| 'II' | |
| >>> romanos(3) | |
| 'III' | |
| >>> romanos(4) |
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 | |
| """ | |
| Exemplo de uma classe com propriedades | |
| A classe ItemPedido deve ser instanciada com os dados essenciais que sao: | |
| descricao do item, preco unitario e quantidade. | |
| >>> bolas = ItemPedido('bola de golfe', 2, 10) | |
| >>> bolas.descr |
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 operator import add, sub, mul, div | |
| operadores = {'+': add, '-': sub, '*':mul, '/':div} | |
| x = input('Entre com o operando 1: ') | |
| y = input('Entre com o operando 1: ') | |
| operacao = raw_input('Entre com a operação: ') | |
| operador = operadores.get(operacao) |
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
| package br.com.globalcode.aj4.net; | |
| import java.net.*; | |
| import java.io.*; | |
| public class ClientSocket { | |
| public static void main(String args []) throws Exception { | |
| BufferedReader leitorLinhas; | |
| InputStreamReader leitorCaracteres; | |
| InputStream leitorSocket; |
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
| #!/bin/bash | |
| HIST=~/prj/git/sandbox-hist | |
| find . > $HIST/find.log | |
| pushd $HIST | |
| git add find.log | |
| git commit -am "$1 $2 $3 $4 $5 $6" | |
| popd |
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 | |
| """ | |
| Dado um arquivo onde se espera encontrar todas as palavras do | |
| Alfabeto Fonético da OTAN, este programa indica palavras faltantes. | |
| """ | |
| import sys, re |
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
| /* | |
| SemaforoPot | |
| Controla tres leds com um potenciometro | |
| */ | |
| int led_vermelho = 11; | |
| int led_amarelo = 12; | |
| int led_verde = 13; | |
| int led_aceso = led_amarelo; | |
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 python3 | |
| import tkinter | |
| from time import strftime | |
| def tic(): | |
| rel['text'] = strftime('%H:%M:%S') | |
| def tac(): | |
| tic() | |
| rel.after(1000, tac) |