Skip to content

Instantly share code, notes, and snippets.

View mistergamarra's full-sized avatar

mister.gamarra mistergamarra

View GitHub Profile
@mistergamarra
mistergamarra / FileController.java
Last active October 1, 2020 05:54
This requieres FileCreator.java in order to do something
@Controller
public class ArchivoApiController {
@Autowired
private FileCreator fileCreator;
@GetMapping("/report")
public ResponseEntity<byte[]> generateReport(String filename) {
HttpHeaders header = new HttpHeaders();
header.setContentType("application/octet-stream");
@mistergamarra
mistergamarra / FileCreator.java
Created October 1, 2020 05:41
Useful to create and transform WorkBooks in to byte
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.stereotype.Component;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
node {
def mvnHome
stage('Preparation') {
// Get some code from a Gitlab repository
git 'https://gitlab.com/joedayz/ContinuousIntegrationAndContinuousDeliveryApp.git'
mvnHome = tool 'M2'
}
FROM java:latest
EXPOSE 8090
ADD app.jar myApp.jar
ENTRYPOINT ["java","-jar","myApp.jar"]
#!/bin/bash -ex
echo "Deploying app.jar to docker folder"
packageName=`ls target/continuousintegrationandcontinuousdeliveryapp*.jar`
versionid=`echo $packageName | awk -F "-" '{ print $2}'`
versionname=`echo $packageName | awk -F "-" '{ print $3}' | awk -F "." '{ print $1}'`
version=`echo $versionid-$versionname`
echo "version: $version"
cp -r $packageName deployment/app.jar
dockerImageName=onedaywillcome/myapp
dockerpid=`docker ps -a | grep $dockerImageName | grep "Up" | awk -F " " '{ print $1 }'`
allprojects {
group = "pe.com.mycompany.psi"
ext.providerName = "arnoldgamarram"
ext.providerId = "ws.arnoldgamarram"
ext.commonsIoVersion = "2.4"
ext.commonsLangVersion = "3.4"
ext.javaVersion = "1.8"
ext.janinoVersion = "2.7.8"
ext.jeeApiVersion = "6.0"
ext.jtopenVersion = "8.6"
@mistergamarra
mistergamarra / AuthorizationServerOAuth2Config.java
Created April 9, 2018 00:14
AuthorizationServer for Oauth2 in Memory
package com.xploit.config.oauth2;
import javax.sql.DataSource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;