Skip to content

Instantly share code, notes, and snippets.

View brunoborges's full-sized avatar
🏠
Working from home, as always

Bruno Borges brunoborges

🏠
Working from home, as always
View GitHub Profile
public class EventProducer {
@Inject Event event;
public void doSomething() {
MyEvent e = new @Async MyEvent();
e.data = "This is a test event";
e.eventTime = new Date();
event.fire(e);
}
package foo;
import java.util.Arrays;
import java.util.Locale;
/**
* @author bruno borges
*/
public class Foo {
# WebLogic Connection
adminUserName='weblogic'
adminPassword='welcome1'
adminURL='t3://localhost:7001'
# DataSource Details
dsName='TestDS'
dsJNDIName='jdbc/test'
dsDriverName='com.mysql.jdbc.Driver'
dsURL='jdbc:mysql://localhost:3306/mysql'
asadmin> get resources.jdbc-connection-pool.mysql_gf2wls_gf2wlsPool.*
resources.jdbc-connection-pool.mysql_gf2wls_gf2wlsPool.property.portNumber=3306
resources.jdbc-connection-pool.mysql_gf2wls_gf2wlsPool.property.serverName=localhost
resources.jdbc-connection-pool.mysql_gf2wls_gf2wlsPool.property.databaseName=gf2wls
resources.jdbc-connection-pool.mysql_gf2wls_gf2wlsPool.property.User=gf2wls
resources.jdbc-connection-pool.mysql_gf2wls_gf2wlsPool.property.URL=jdbc:mysql://localhost:3306/gf2wls?zeroDateTimeBehavior=convertToNull
resources.jdbc-connection-pool.mysql_gf2wls_gf2wlsPool.property.driverClass=com.mysql.jdbc.Driver
resources.jdbc-connection-pool.mysql_gf2wls_gf2wlsPool.property.Password=gf2wls
resources.jdbc-connection-pool.mysql_gf2wls_gf2wlsPool.allow-non-component-callers=false
resources.jdbc-connection-pool.mysql_gf2wls_gf2wlsPool.associate-with-thread=false
public static Date randomShiftOnDate(Date someDate) {
Random random = new Random();
int randomValue = random.nextInt(31) * 60 * 1000; // 30 min.
boolean subtract = random.nextBoolean();
if (subtract) randomValue *= -1;
long time = someDate.getTime();
time += randomValue;
Calendar cal = Calendar.getInstance();
@brunoborges
brunoborges / the_devops_song.md
Last active February 17, 2021 16:23
The DevOps Song, a fork of "Every Breath You Take, The Police"

The DevOps Song

A fork of "Every Breath You Take" from The Police / Sting. Watch on YouTube

Every bug you take
Every pull you make
Every build you break
Every log you erase
I'll be watching you

@brunoborges
brunoborges / create-demoiselle-ds.py
Created January 7, 2014 15:26
Script para criar um Data Source chamado 'jdbc/demoiselle' usando o banco Derby (em memória) para rodar um projeto Demoiselle de exemplo. Para saber mais, veja no http://blogs.oracle.com/brunoborges
connect('weblogic', 'welcome1', 't3://localhost:7001')
edit()
startEdit()
cd('/')
cmo.createJDBCSystemResource('jdbc/demoiselle')
cd('/JDBCSystemResources/jdbc/demoiselle/JDBCResource/jdbc/demoiselle')
cmo.setName('jdbc/demoiselle')
package javafx.bug.rt35177;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
/**
* @author Bruno Borges <bruno.borges at oracle.com>
<?xml version="1.0" encoding="UTF-8"?>
<?language javascript?>
<?import java.lang.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.media.*?>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:p="http://xmlns.jcp.org/jsf/passthrough"
xmlns:jsf="http://xmlns.jcp.org/jsf"
xmlns:f="http://xmlns.jcp.org/jsf/core">