Skip to content

Instantly share code, notes, and snippets.

View strongant's full-sized avatar

strongant strongant

View GitHub Profile
@ThaddeusJiang
ThaddeusJiang / my-tech-interview-flow.md
Last active March 28, 2023 01:10
My tech interview flow

My tech interview flow

背景

  1. 为什么应聘我们公司?

有明确判断标准

  1. bugfix of your own code
  2. add feature of your own code
@raphw
raphw / run.sh
Last active February 18, 2024 08:48
Runs Mockito on Graal VM
#!/bin/bash
set -x
set -e
if [[ -z $1 ]]; then
echo "Specify location of Graal VM as first argument"
exit 1
fi
$1/bin/gu install native-image
rm -rf META-INF sample sample.build_artifacts.txt Sample.* *.jar
echo "public class Sample {
@thomasdarimont
thomasdarimont / Dockerfile
Created April 8, 2022 10:58
Keycloak.X JGroups JDBC Ping
FROM quay.io/keycloak/keycloak:17.0.1 as builder
ENV KC_METRICS_ENABLED=true
ENV KC_FEATURES=preview
ENV KC_DB=postgres
ENV KC_HTTP_RELATIVE_PATH=/auth
# specify the custom cache config file here
ENV KC_CACHE_CONFIG_FILE=cache-ispn-jdbc-ping.xml
# copy the custom cache config file into the keycloak conf dir
@xgp
xgp / Dockerfile
Last active April 23, 2024 13:01
Keycloak 17 example using JGroups JDBC_PING discovery protocol for Infinispan
FROM quay.io/keycloak/keycloak:17.0.0 as builder
ENV KC_METRICS_ENABLED=true
ENV KC_FEATURES=preview
ENV KC_DB=postgres
ENV KC_HTTP_RELATIVE_PATH=/auth
# specify the custom cache config file here
ENV KC_CACHE_CONFIG_FILE=cache-ispn-jdbc-ping.xml
# copy the custom cache config file into the keycloak conf dir
@dasniko
dasniko / _keycloak-cluster-config.md
Last active April 16, 2024 17:29
How to configure a keycloak cluster properly (legacy Wildfly edition)

Keycloak Cluster Configuration (How to) - Legacy Wildfly Distribution!!!

This is a short and simple example on how to build a proper Keycloak cluster, using JDBC_PING as discovery protocol and an NGINX server as reverse proxy.

As this is for legacy Keycloak version (Wildfly based, up until version 17), you can find an example for more current and uptodate versions at this gist here: https://gist.github.com/dasniko/3a57913047af3ca1b6b0a83b294dc1a1


Please see also my video about Keycloak Clustering: http://www.youtube.com/watch?v=P96VQkBBNxU

This gist describes the configuration required for Spring reactive WebClient to make a call to an OAuth2 protected resource through OAuth2.0 Client Credentials Grant Type Flow.

Assumption is that the Authorization Server supports OpenId Connect 1.0 specifications.

@mehmetcemyucel
mehmetcemyucel / FeignConfiguration.java
Created May 25, 2020 15:37
keycloak-feign-resttemplate
package com.cem.oauth2.configuration.feign;
import com.cem.oauth2.configuration.AuthProperties;
import feign.RequestInterceptor;
import org.keycloak.OAuth2Constants;
import org.springframework.cloud.security.oauth2.client.feign.OAuth2FeignRequestInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.oauth2.client.DefaultOAuth2ClientContext;
import org.springframework.security.oauth2.client.resource.OAuth2ProtectedResourceDetails;
@knyar
knyar / csv.sh
Last active May 10, 2023 14:09 — forked from dolik-rce/nginx.conf
Nginx-lua-prometheus benchmark #3
#!/bin/bash
set -e -u -o pipefail
commits="1e13e22c 0.20200420 avoid-get_keys"
modes="parallel serial none"
output=results.csv
echo -n 'num_metrics' > $output
for mode in $modes; do
for commit in $commits; do
@sgyyz
sgyyz / uao.md
Last active May 3, 2024 14:15
uao command - unzip your project and import to intellij automatically
  1. import project into idea command
$ curl -L "https://gist.githubusercontent.com/chrisdarroch/7018927/raw/9a6d663fd7a52aa76a943fe8a9bc6091ad06b18d/idea" -o /usr/local/bin/idea
$ chmod +x /usr/local/bin/idea
  1. unzip and open project command
$ curl -L "https://gist.githubusercontent.com/sgyyz/adfa4f05af3d81cf0e17e19cf7044c85/raw/b6b9e871d5a4f5435a09d00b0a52e3db0b90699a/uao.sh" -o /usr/local/bin/uao.sh
$ chmod +x /usr/local/bin/uao.sh
$ ln -sf /usr/local/bin/uao.sh /usr/local/bin/uao
@karthik101
karthik101 / Readonly user for Kubernetes Dashboard.md
Last active June 12, 2023 16:32
Read only user for Kubernetes Dashboard

The view ClusterRole doesn’t actually have permissions for the Cluster level objects like Nodes and Persistent Volume Claims. So we’ll have to create a new RBAC config.

First, we’ll create a new dashboard-viewonly ClusterRole:

---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: dashboard-viewonly