Skip to content

Instantly share code, notes, and snippets.

View strongant's full-sized avatar

strongant strongant

View GitHub Profile

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
@strongant
strongant / CloneLearningTest.java
Created June 12, 2023 14:55 — forked from rherrmann/CloneLearningTest.java
'Learning Tests' that uses the JGit API to clone existing repositories: http://www.codeaffine.com/2015/11/30/jgit-clone-repository/
package com.codeaffine.jgit.example;
import static java.util.Collections.singleton;
import static org.eclipse.jgit.api.ListBranchCommand.ListMode.ALL;
import static org.eclipse.jgit.transport.RemoteConfig.getAllRemoteConfigs;
import static org.junit.Assert.*;
import java.io.File;
import java.io.IOException;
import java.util.List;
@strongant
strongant / csv.sh
Created May 10, 2023 14:09 — forked from knyar/csv.sh
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
@strongant
strongant / gist:160d7a5a226cb1e0be5c9ec1cb212402
Created November 23, 2022 10:58 — forked from programaker/gist:5867408
Sending post request with params and fetching response content
public static String post(String urlString, String params, int timeout) throws Exception {
String response = null;
HttpURLConnection conn = null;
DataOutputStream dos = null;
InputStream is = null;
try {
URL url = new URL(urlString);
conn = (HttpURLConnection)url.openConnection();
conn.setDoInput(true);

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.

@strongant
strongant / FeignConfiguration.java
Created September 2, 2022 17:33 — forked from mehmetcemyucel/FeignConfiguration.java
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;
@strongant
strongant / README
Created August 31, 2022 13:21 — forked from cedricziel/README
Simple setup for keycloak and docker.
* run gen_keys.sh
* run keycloak_server.sh
Take a look at kcadm on how to import more diverse data points like idp metadata and client configurations.
Also take a look at the simple import / export stuff at https://hub.docker.com/r/jboss/keycloak/
@strongant
strongant / uao.md
Created August 27, 2022 14:13 — forked from sgyyz/uao.md
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
@strongant
strongant / maven.txt
Created June 28, 2022 15:45
Maven 3.5.2 Linux Installation Script
#//INSTRUCTIONS TO INSTALL MAVEN ON LINUX
#//Downloads install file from Maven Distro
wget http://www-us.apache.org/dist/maven/maven-3/3.5.2/binaries/apache-maven-3.5.2-bin.tar.gz
tar xzf apache-maven-3.5.2-bin.tar.gz
#//Enables script to write to directory /usr/local so that it can make the directory /maven
sudo chmod 777 /usr/local
sudo mkdir /usr/local/maven
@strongant
strongant / java8-centos-amazon-linux.md
Created June 27, 2022 08:58 — forked from diegopacheco/java8-centos-amazon-linux.md
How to Install Java 8 in CentOS / Amazon Linux?
# Remove java 7
sudo yum remove -y java

# Install basic packages
sudo yum install -y git

# Download and install java 8
wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.tar.gz"
tar -xzvf jdk-8u131-linux-x64.tar.gz