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" | |
"math/rand" | |
"os" | |
"os/signal" | |
"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
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.*; | |
import org.springframework.amqp.rabbit.core.RabbitAdmin; | |
import org.springframework.amqp.rabbit.core.RabbitTemplate; |
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
public class SecurityConfig { | |
// ...... | |
// userIds claim mapper should be added to keycloak that gets its value from user's attribute with the same name | |
@Bean | |
public JwtDecoder customDecoder(OAuth2ResourceServerProperties properties, HttpServletRequest httpServletRequest) { | |
NimbusJwtDecoder jwtDecoder = NimbusJwtDecoder.withJwkSetUri( | |
properties.getJwt().getJwkSetUri()).build(); |
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 liquibase.changelog.IncludeAllFilter; | |
import liquibase.integration.spring.SpringLiquibase; | |
import liquibase.integration.spring.SpringResourceAccessor; | |
import lombok.extern.slf4j.Slf4j; | |
import org.springframework.boot.autoconfigure.liquibase.LiquibaseProperties; | |
import org.springframework.boot.context.properties.EnableConfigurationProperties; | |
import org.springframework.context.annotation.Bean; | |
import org.springframework.context.annotation.Configuration; | |
import org.springframework.core.io.ResourceLoader; |
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 android.os.Handler; | |
import android.os.Looper; | |
import com.google.gson.Gson; | |
import java.lang.annotation.Annotation; | |
import java.lang.reflect.ParameterizedType; | |
import java.lang.reflect.Type; | |
import java.util.concurrent.Executor; |
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
let lastName = "ibrahim"; | |
let birthDate = "1981-01-03"; | |
let q = {}; | |
if (lastName) { | |
q.lastName = lastName; | |
} | |
if (birthDate) { |
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
#!/usr/bin/env bash | |
ips=$(kubectl get ep myapp -o jsonpath='{range @}{.subsets[*].addresses[*].ip}{end}') | |
arr=($ips) | |
curls="" | |
for ip in "${arr[@]}"; do | |
curls="${curls}curl ${ip}:8080/actuator/refresh -d {} -H 'Content-Type: application/json' && " | |
done |
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
wget -O openjdk-15.tar.gz $(curl -s https://jdk.java.net/15/ | gawk 'match($0, "http.*openjdk-15.*linux-x64_bin.tar.gz", ary) {print ary[0]}' | uniq) | |
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
# report jobs is running for more than 60 minutes | |
sudo kubectl get pods -l job-name -o jsonpath='{range .items[*]}{.metadata.name}{" "}{.status.phase}{" "}{.status.startTime}{"\n"}{end}' | while read line; do | |
name=$(echo $line | awk '{print $1}') | |
phase=$(echo $line | awk '{print $2}') | |
startTime=$(echo $line | awk '{print $3}') | |
now=$(date +%s) | |
start=$(date -d $startTime +"%s") | |
diff=$(( ($now - $start)/60 )) |