Skip to content

Instantly share code, notes, and snippets.

View leonardotrp's full-sized avatar

Leonardo Pereira leonardotrp

View GitHub Profile
@leonardotrp
leonardotrp / JCodecPNGtoMP4.java
Created March 19, 2019 02:02
Using NIO e JCodec to convert multiple sequence png images to mp4 video file
/**
* Using NIO e JCodec to convert multiple sequence png images to mp4 video file
* Copyright (C) 2019 Leonardo Pereira (www.leonardopereira.com.br)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
@leonardotrp
leonardotrp / java_keyword_final.java
Created March 14, 2019 01:28
A doubt about the java keyword modifier 'final'
int bestIndex = 0;
IntStream.range(0, population.size()).forEach(idxIndividual -> {
Individual individual = population.get(idxIndividual);
double x = 0, y = 0;
for (int idxId = 0; idxId < individualSize; idxId++) {
x += eigenvectors.getEntry(idxId, 0) * individual.get(idxId);
y += eigenvectors.getEntry(idxId, 1) * individual.get(idxId);
}
projectionsSeries[idxIndividual] = new double[] {x, y};
if (population.getBest() == individual)
@leonardotrp
leonardotrp / mailer.py
Last active March 8, 2019 00:24
Send mail with custom EMAIL_FROM
from mailing import mail
def send():
mail.send_email(recipients=[email_to@domain.com], \
subject='[Test Email] Subject', \
text_content='This is a test', \
from_email=settings.DEFAULT_FROM_EMAIL)