Skip to content

Instantly share code, notes, and snippets.

View SergioDiniz's full-sized avatar
🎮
Playing something 😋

Sergio SergioDiniz

🎮
Playing something 😋
  • João Pessoa, PB, Brazil
View GitHub Profile
@SergioDiniz
SergioDiniz / epics-io-download.kt
Created October 9, 2022 23:52
download sequential photos from epics.io
import org.apache.commons.io.FileUtils
import java.io.File
import java.net.URL
// download sequential photos from epics.io
fun main(args: Array<String>) {
val baseUrl = "https://images.epics.website/d1d3d313d131d3d13d974e905c985/IMG-IMAGE_CODE.jpg?token=d1d13d13d11d3d12121s32edasd23fwefwsdd&size=767&wm=2&wmlabel=Fotografias"
val photoDestinationPath = "${System.getProperty("user.dir")}/photos"
val imageCodeRange = 5777..6038
@SergioDiniz
SergioDiniz / docker-compose-pgadmin.yml
Last active September 6, 2023 09:47
Docker Compose config to postgres and dpage/pgadmin4
version: '3.5'
services:
postgres:
container_name: postgres_container
image: postgres
environment:
POSTGRES_USER: ${POSTGRES_USER:-postgres}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-postgres}
POSTGRES_DB: ${POSTGRES_DB:-app_db}
@SergioDiniz
SergioDiniz / Validador CPF.js
Last active November 9, 2019 12:18
Validador CPF
function validadorCPF(query = ""){
var primeiroDigitoValidador;
var segundoDigitoValidador;
var auxSoma = 0;
if( query === "00000000000"
|| query === "11111111111"
|| query === "22222222222"
|| query === "33333333333"
rm $HOME/.RubyMine2016.2/config/eval/RubyMine162.evaluation.key
@SergioDiniz
SergioDiniz / staticServer.js
Created July 21, 2017 17:06
servidor estático nodejs
const PORT = 8080
const http = require('http');
const finalhandler = require('finalhandler');
const serveStatic = require('serve-static');
const serve = serveStatic("./app/");
const server = http.createServer((req, res) => {
const done = finalhandler(req, res);
# precisa configura o connection pool e o resource manualmento no eclipse
# propriedades obrigatorias: DriverClass (org.postgresql.Driver), URL(jdbc:postgresql://localhost:5432/usuario), User, DatabaseName, ServerName, PortNumber, Password
<persistence xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd"
version="2.1">
<persistence-unit name="jdbc/Usuario" transaction-type="JTA">
<jta-data-source>jdbc/Usuario</jta-data-source>
<properties>
<property name="javax.persistence.schema-generation.database.action" value="create" />
private JasperPrint jasperPrint;
public void init() throws JRException{
JRBeanCollectionDataSource data = new JRBeanCollectionDataSource(listOfUser);
String reportPath = FacesContext.getCurrentInstance().getExternalContext().getRealPath(“report.jasper”);
jasperPrint = JasperFillManager.fillReport(reportPath, new HashMap<>(), data);
}
public void PDF() throws JRException, IOException{
init();
@SergioDiniz
SergioDiniz / iReport config para JDK 7
Last active November 19, 2016 11:31
configuração necessária para iReport em maquinas com JAVA 8
#
# conf path: Applications/iReport/Contents/Resources/ireportpro/etc/ireportpro.conf
#
# ${HOME} will be replaced by user home directory according to platform
default_userdir="${HOME}/.${APPNAME}/5.6.0"
default_mac_userdir="${HOME}/Library/Application Support/${APPNAME}/5.6.0"
# options used by the launcher by default, can be overridden by explicit
# command line switches
default_options="-J-Xms256m -J-Xmx512m -J-Dorg.netbeans.ProxyClassLoader.level=1000 -J-XX:MaxPermSize=512m -J-Dapple.laf.useScreenMenuBar=true -J-Dapple.awt.graphics.UseQuartz=true -J-Dnetbeans.exception.report.min.level=99999 "
<persistence xmlns="http://xmlns.jcp.org/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence
http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd"
version="2.1">
<persistence-unit name="persistenceUnitName" transaction-type="RESOURCE_LOCAL">
<properties>
<property name="javax.persistence.jdbc.driver" value="org.postgresql.Driver" /> <!-- DB Driver -->
package dao;
import java.util.List;
import javax.persistence.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;