Skip to content

Instantly share code, notes, and snippets.

Avatar
🛏️
Need Sleep

Pablo Hernandez PabloHdzVizcarra

🛏️
Need Sleep
View GitHub Profile
View docker-stop-and-remove.ps1
docker stop $(docker ps -aq)
docker rm $(docker ps -aq)
docker rmi $(docker images -q)
docker container prune # Remove all stopped containers
docker volume prune # Remove all unused volumes
docker image prune # Remove unused images
docker system prune # All of the above, in this order: containers, volumes, images
docker system df # Show docker disk usage, including space reclaimable by pruning
@PabloHdzVizcarra
PabloHdzVizcarra / rabbitmq.repo
Created August 31, 2022 21:07
File to add RabbitMQ dependencies to RedHat 8 server
View rabbitmq.repo
# In /etc/yum.repos.d/rabbitmq.repo
##
## Zero dependency Erlang
##
[rabbitmq_erlang]
name=rabbitmq_erlang
baseurl=https://packagecloud.io/rabbitmq/erlang/el/8/$basearch
repo_gpgcheck=1
@PabloHdzVizcarra
PabloHdzVizcarra / EmployeeWebSecurityConfig.java
Created May 14, 2022 14:04
create bean with spring security configuration
View EmployeeWebSecurityConfig.java
package com.baeldung.springreactivebaeldungseries.lesson01;
import org.springframework.context.annotation.Bean;
import org.springframework.http.HttpMethod;
import org.springframework.security.config.annotation.web.reactive.EnableWebFluxSecurity;
import org.springframework.security.config.web.server.ServerHttpSecurity;
import org.springframework.security.web.server.SecurityWebFilterChain;
@EnableWebFluxSecurity
public class EmployeeWebSecurityConfig {
@PabloHdzVizcarra
PabloHdzVizcarra / Dockerfile-kotlin-app
Created May 10, 2022 03:38
Dockerfile to how depoy kotlin application with two phases
View Dockerfile-kotlin-app
FROM openjdk:11.0.15-oracle as build
RUN mkdir -p /app/source
COPY . /app/source
WORKDIR /app/source
RUN ./mvnw clean package -DskipTests
FROM openjdk:11.0.15-oracle as runtime
COPY --from=build /app/source/target/*.jar /app/app.jar
ENTRYPOINT ["java", "-jar", "/app/app.jar"]
@PabloHdzVizcarra
PabloHdzVizcarra / TestSwitchStatement.java
Created April 24, 2022 14:04
diferents ways to execute switch statement in Java
View TestSwitchStatement.java
package jvm.pablohdz.restapidesignpatterns;
public class TestSwitchStatement {
public void classicVersion(int number) {
switch (number) {
case 1:
callMethod("one");
break;
case 2:
@PabloHdzVizcarra
PabloHdzVizcarra / BasicEngineering.java
Created April 23, 2022 12:05
application a hook in a class using a method
View BasicEngineering.java
package jvm.pablohdz.restapidesignpatterns.example.template;
public abstract class BasicEngineering {
public final void completeCourse() {
// the course must be completed in order to pass
// 1. Math
// 2. Soft Skills
// 3. Special Paper
completeMath();
completeSoftSkills();
@PabloHdzVizcarra
PabloHdzVizcarra / Student.java
Created April 1, 2022 19:00
copy constructor object
View Student.java
package jvm.pablohdz.prototypepatternapi;
/**
* implementation of the Student class with copy constructor
* */
public class Student {
int rollNo;
String name;
public Student(int rollNo, String name) {
View return-catalogs-apple.json
{
"httpStatus": 200,
"message": "get all catalogs success",
"messageParams": null,
"data": [
{
"id": "62322a33b5c8261e807088e5",
"providerMessageId": "bce05599-5c47-4ba5-b1c9-3337e19f3819",
"type": "form",
"conversationId": "622f624d760843000861b52b",
@PabloHdzVizcarra
PabloHdzVizcarra / MockitoTestVerifyCalling.java
Last active February 20, 2022 16:00
tests mockito using verification methods
View MockitoTestVerifyCalling.java
package org.example.observer;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
class ConcreteSubjectTest {
@Test
void observersHandleEventsFromSubject() {
// given
@PabloHdzVizcarra
PabloHdzVizcarra / CampaignController.java
Created February 19, 2022 19:31
campaignController
View CampaignController.java
package com.chatbot.bulkmessages.controller;
import java.io.IOException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.bind.annotation.CrossOrigin;