This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"github.com/dgrijalva/jwt-go" | |
"github.com/labstack/echo" | |
"github.com/labstack/echo/middleware" | |
"net/http" | |
"time" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Enable retries on selected Feign methods. | |
* <p> | |
* <ol> | |
* <li>In the feign config class add: | |
* <pre> | |
* {@code | |
* @Bean | |
* public Retryer feignRetryer() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
doPortForward() { | |
ns=$1 | |
ip=$2 | |
port=$3 | |
listen_port=`awk -F ':' '{print $1}' <<< "$port"` | |
container_port=`awk -F ':' '{print $2}' <<< "$port"` | |
container_port=${container_port:-$listen_port} | |
target_port=$4 || `shuf -i 2000-65000 -n 1` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import lombok.AccessLevel; | |
import lombok.NoArgsConstructor; | |
import lombok.extern.slf4j.Slf4j; | |
import org.springframework.data.redis.core.RedisTemplate; | |
import java.time.Duration; | |
import java.util.function.Supplier; | |
/** | |
* A simple implementation for Distributed Lock based on Redis. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example.demo; | |
import org.springframework.beans.factory.annotation.Autowired; | |
import org.springframework.boot.CommandLineRunner; | |
import org.springframework.boot.SpringApplication; | |
import org.springframework.boot.autoconfigure.SpringBootApplication; | |
import org.springframework.boot.web.client.RestTemplateBuilder; | |
import org.springframework.boot.web.client.RestTemplateCustomizer; | |
import org.springframework.context.annotation.Bean; | |
import org.springframework.retry.policy.SimpleRetryPolicy; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import brave.spring.rabbit.SpringRabbitTracing; | |
import lombok.Data; | |
import lombok.RequiredArgsConstructor; | |
import lombok.extern.slf4j.Slf4j; | |
import org.springframework.amqp.core.Message; | |
import org.springframework.amqp.rabbit.annotation.MultiRabbitListenerAnnotationBeanPostProcessor; | |
import org.springframework.amqp.rabbit.annotation.RabbitListenerAnnotationBeanPostProcessor; | |
import org.springframework.amqp.rabbit.config.SimpleRabbitListenerContainerFactory; | |
import org.springframework.amqp.rabbit.connection.*; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import lombok.RequiredArgsConstructor; | |
import lombok.extern.slf4j.Slf4j; | |
import org.springframework.data.redis.core.RedisKeyValueTemplate; | |
import org.springframework.stereotype.Service; | |
import javax.persistence.Id; | |
import java.time.Duration; | |
import java.time.Instant; | |
import java.util.Optional; | |
import java.util.function.Supplier; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static { | |
disableSslVerification(); | |
} | |
private static void disableSslVerification() { | |
try | |
{ | |
// Create a trust manager that does not validate certificate chains | |
javax.net.ssl.TrustManager[] trustAllCerts = new javax.net.ssl.TrustManager[] {new javax.net.ssl.X509TrustManager() { | |
public java.security.cert.X509Certificate[] getAcceptedIssuers() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
depends on config from https://www.baeldung.com/java-bouncy-castle | |
*/ | |
import org.bouncycastle.cms.* | |
import org.bouncycastle.cms.jcajce.JceCMSContentEncryptorBuilder | |
import org.bouncycastle.cms.jcajce.JceKeyTransEnvelopedRecipient | |
import org.bouncycastle.cms.jcajce.JceKeyTransRecipientInfoGenerator | |
import org.bouncycastle.jce.provider.BouncyCastleProvider | |
import org.bouncycastle.util.encoders.Base64 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
#set -x | |
if [ "$#" -ne 2 ]; | |
then | |
echo "Usage: $0 <user@ip> [rpm url|file]" | |
exit | |
fi |
NewerOlder