Skip to content

Instantly share code, notes, and snippets.

@sandipchitale
sandipchitale / README.md
Last active July 10, 2023 04:06
Run groovysh in Gradle build context #gradle #groovysh

Usage

Use the following command to execute groovysh task in the context of the project. The project, settings and gradle bindings are set.

> .\gradlew -q --no-daemon --console=plain --init-script groovysh-task.gradle groovysh
...
...
groovy:000> :inspect project
groovy:000> :inspect settings
groovy:000> :inspect gradle
@sandipchitale
sandipchitale / update-kind.bat
Created August 10, 2022 04:48
Update kind #kind
curl.exe -Lo kind-windows-amd64.exe https://kind.sigs.k8s.io/dl/v0.14.0/kind-windows-amd64
Move-Item .\kind-windows-amd64.exe C:\tools\kind\kind.exe
@sandipchitale
sandipchitale / list-images.bat
Last active January 15, 2023 00:46
List images of all pods #kubectl
kubectl get pod -A -o="custom-columns=NAME:.metadata.name,INIT-CONTAINERS:.spec.initContainers[*].name,IMAGE:.spec.initContainers[*].image,CONTAINERS:.spec.containers[*].name,IMAGE:.spec.containers[*].image"
kubectl get pod -o="custom-columns=NAME:.metadata.name,CONTAINERS:.spec.containers[*].name,IMAGE:.spec.containers[*].image"
kubectl get pod -o="custom-columns=NAME:.metadata.name,INIT-CONTAINERS:.spec.initContainers[*].name,IMAGE:.spec.initContainers[*].image,CONTAINERS:.spec.containers[*].name,IMAGE:.spec.containers[*].image"
kubectl run -i --tty --rm debug --image=gcr.io/otl-eng-cs-ia/busybox:latest --restart=Never -- sh
kubectl get ingress ingress-infoarchive --no-headers=true -o="custom-columns=HOSTS:.spec.rules[*].host"
@sandipchitale
sandipchitale / closure.groovy
Created August 14, 2022 19:55
Groover closue delegate example #groovy #closure
def append(String s) {
println "Appending: ${s}"
}
def closure = {
println owner
println delegate
append 'Hello'
append 'World'
}
@sandipchitale
sandipchitale / ROPG.md
Last active November 15, 2022 08:43
Spring Security Authorization Server Filter Chain #authorization-server

filters and filter chains

Filter Name: dumpFilters FilterClass: pk.training.basit.SpringAuthorizationServerApplication$DumpFilters
Filter Name: characterEncodingFilter FilterClass: org.springframework.boot.web.servlet.filter.OrderedCharacterEncodingFilter
Filter Name: webMvcMetricsFilter FilterClass: org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter
Filter Name: formContentFilter FilterClass: org.springframework.boot.web.servlet.filter.OrderedFormContentFilter
Filter Name: requestContextFilter FilterClass: org.springframework.boot.web.servlet.filter.OrderedRequestContextFilter
Filter Name: springSecurityFilterChain FilterClass: org.springframework.boot.web.servlet.DelegatingFilterProxyRegistrationBean$1
        Ant [pattern='/webjars/**']
@sandipchitale
sandipchitale / location
Last active November 16, 2022 02:10
New Spring Oauth2 autoconfig #autoconfigure #oauth2
org.springframework.boot
spring-boot-autoconfigure
2.7.3
spring-boot-autoconfigure-2.7.3.jar
org\springframework\boot\autoconfigure\security\oauth2\
Client:
org.springframework.boot.autoconfigure.security.oauth2.client.servlet.OAuth2ClientAutoConfiguration
@sandipchitale
sandipchitale / listglobalmpmpackages
Last active November 16, 2022 19:40
List global NPM packages #npm #global
npm list -g --depth 0
@sandipchitale
sandipchitale / noRedirectReturn401.java
Last active November 20, 2022 07:31
SPA Return 401 instead of redirect to login #spring-security
@Bean
public SecurityFilterChain defaultSecurityFilterChain(HttpSecurity http) throws Exception {
LOGGER.debug("in configure HttpSecurity");
// Return HttpStatus.UNAUTHORIZED (401) to SPAs.
http.exceptionHandling(eh ->
eh.authenticationEntryPoint(new HttpStatusEntryPoint(HttpStatus.UNAUTHORIZED)));
// ...
http.formLogin(fl ->
fl
.successHandler((req, res, auth) -> res.setStatus(HttpStatus.OK.value()))
@sandipchitale
sandipchitale / Authorization Server Beans.json
Last active January 20, 2023 04:18
Authorization Server Beans #springboot #oauth2
{
"contexts": {
"application": {
"beans": {
"spring.jpa-org.springframework.boot.autoconfigure.orm.jpa.JpaProperties": {
"aliases": [],
"scope": "singleton",
"type": "org.springframework.boot.autoconfigure.orm.jpa.JpaProperties",
"resource": null,
"dependencies": []
@sandipchitale
sandipchitale / application.properties
Last active December 12, 2022 05:07
Log bean creation #springframework
logging.level.org.springframework.beans.factory.support.DefaultListableBeanFactory = DEBUG