Skip to content

Instantly share code, notes, and snippets.

View jovemfelix's full-sized avatar

RENATO ALVES FELIX jovemfelix

View GitHub Profile
@jovemfelix
jovemfelix / manageYML.groovy
Created October 23, 2020 19:50
Openshift using jenkins pipeline -create or apply YML
/**
* @param args.FOLDER_YML
* @param args.OCP_KIND < configmap, secret >
* @return
*/
def manageYML(Map args) {
def configMapList = findFiles(glob: "${args.FOLDER_YML}")
echos "[${args.OCP_KIND}][found]: ${configMapList}"
configMapList.each { f ->
@jovemfelix
jovemfelix / rhsso-extrair-standalone-openshift.md
Last active October 27, 2020 12:23
How extract de file standalone-openshift.xml from docker imagem

at terminal #1 run

$ docker run --user root --rm -it --name sso74 -P --entrypoint "/bin/bash" registry.redhat.io/rh-sso-7/sso74-openshift-rhel8:7.4

at terminal #2 - go to a temp folder and copy the image file to current folder

$ mkdir tmp-imagem-file && cd $_
$ docker cp sso74:/opt/eap/standalone/configuration/standalone-openshift.xml .
@jovemfelix
jovemfelix / Scratch.java
Last active October 30, 2020 20:22
Best Practices of Equals Testing in Java
import java.util.Objects;
class Scratch {
public static void main(String[] args) {
String s = null;
try {
if (!s.equals("XXX")) {
System.out.println("[WRONG-TESTING] NOT EXECUTED!");
}
@jovemfelix
jovemfelix / get-pod-time-openshift-all-namespaces.sh
Created December 2, 2020 18:28
Compute DateTime of Pod's in Openshif
v_values=$(oc get pods --all-namespaces --field-selector status.phase==Running -o wide | awk 'FNR > 1 {printf $1;printf ";";printf $2;printf ";";printf $8;printf "\n"}' )
for v_pod_and_node in $(echo $v_values); do
v_namespace=$(echo $v_pod_and_node | awk -F ";" '{print $1}')
v_pod=$(echo $v_pod_and_node | awk -F ";" '{print $2}')
v_node=$(echo $v_pod_and_node | awk -F ";" '{print $3}')
oc -n $v_namespace rsh $v_pod /bin/sh -i -c 'printf "$(date '+%Y%m%d%H%M%S')"'
printf ";$v_pod;$v_namespace;$v_node\n"
done
@jovemfelix
jovemfelix / Dockerfile
Created December 4, 2020 21:54
Alpine + iperf3 + IOZone
FROM alpine:latest
#FROM alpine:3.9
MAINTAINER Renato Felix
ENV IOZONE_VERSION 3.489
ENV IOZONE_URL http://www.iozone.org/src/current/iozone3_490.tar
RUN apk --update upgrade && \
apk add --no-cache --virtual=temporary iperf3 curl gcc make build-base && \
apiVersion: build.openshift.io/v1
kind: BuildConfig
metadata:
labels:
name: my-first-pipeline-maven-version
name: my-first-pipeline-maven-version
spec:
source:
type: None
strategy:
package com.dinuth.keycloakspringbootmicroservice.config;
import org.keycloak.adapters.KeycloakConfigResolver;
import org.keycloak.adapters.springboot.KeycloakSpringBootConfigResolver;
import org.keycloak.adapters.springsecurity.authentication.KeycloakAuthenticationProvider;
import org.keycloak.adapters.springsecurity.config.KeycloakWebSecurityConfigurerAdapter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<offline>false</offline>
<proxies>
<!-- ### configured http proxy ### -->
</proxies>
@jovemfelix
jovemfelix / jwt.io-on-mac.sh
Created March 10, 2021 13:24
Install mac cli to decode JWT token
brew tap mike-engel/jwt-cli
brew install jwt-cli
brew install jq
TOKEN=$(curl <TOKEN-ENDPOINT> | jq -r .token)
jwt decode $TOKEN