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
class AESCipher: | |
def __init__( self, key ): | |
self.key = key | |
def encrypt( self, raw ): | |
raw = pad(raw) | |
iv = Random.new().read( AES.block_size ) | |
cipher = AES.new( self.key, AES.MODE_CBC, iv ) | |
return base64.b64encode( iv + cipher.encrypt( raw ) ) |
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 logging | |
import argparse | |
import datetime | |
import sys | |
FORMAT = '%(asctime)-15s [%(levelname)s] %(message)s' | |
LOGLEVEL = logging.INFO | |
parser = argparse.ArgumentParser(description='Program descriptiom.') | |
parser.add_argument('-sf', '--someflag', const=True, action='store_const', help='Option description') |
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
CREATE OR REPLACE FUNCTION log_transacao_srph() RETURNS TRIGGER AS $$ | |
BEGIN | |
IF TG_OP = 'UPDATE' THEN | |
INSERT INTO sla_mudancastatus (datahora, numero_os, anterior, novo, abertura, orcamento, aprovacao, emissao, cancelamento, reabertura, operador) | |
VALUES(NOW(), NEW.numero_os, OLD.status_viagem, NEW.status_viagem, NEW.abertura, NEW.orcamento, NEW.aprovacao, NEW.emissao, NEW.cancelamento, NEW.reabertura, NEW.operador); | |
RETURN NEW; | |
END IF; | |
IF TG_OP = 'INSERT' THEN | |
INSERT INTO sla_mudancastatus (datahora, numero_os, anterior, novo, abertura, orcamento, aprovacao, emissao, cancelamento, reabertura, operador) | |
VALUES(NOW(), '', 'ABE', NEW.status_viagem, NEW.abertura, NEW.orcamento, NEW.aprovacao, NEW.emissao, NEW.cancelamento, NEW.reabertura, NEW.operador); |
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
/* | |
O algoritmo para validação do CPF e CNPJ é | |
bem conhecido, portanto a preocupação de tornar | |
o código legível foi sacrificada em prol de tornar | |
o código compacto. | |
Ambas as funções recebem uma string e retornam | |
TRUE ou FALSE dependendo do dígito de verificação | |
bater ou não. |
NewerOlder