Skip to content

Instantly share code, notes, and snippets.

View krnbr's full-sized avatar
🏠

Karanbir Singh krnbr

🏠
  • Home
  • India
View GitHub Profile
@krnbr
krnbr / Table.md
Last active December 9, 2024 16:14
A table for scenarios for a blog
@krnbr
krnbr / zitadel-behind-traefik-notes.md
Created January 10, 2023 15:24
Pre-Existing Traefik, and add zitadel to it

Would like to share how to configure zitadel behind traefik that already existed.

Traefik's docker-compose.yml - the traefik related folder might be different from the docker-compose.yml of zitadel

# tfk/docker-compose.yml
version: '3'

services:
  traefik:

Keybase proof

I hereby claim:

  • I am krnbr on github.
  • I am karanbir (https://keybase.io/karanbir) on keybase.
  • I have a public key ASA3-MAZ4afE4Nfn6DwrrZJ0HLY6uMOvxG5rBb-LKjWLbAo

To claim this, I am signing this object:

@krnbr
krnbr / AWSStsAssumeRole.ts
Last active December 5, 2022 00:57
STS goto console - programmatically
import {STSClient, AssumeRoleCommand, AssumeRoleCommandOutput} from "@aws-sdk/client-sts";
import axios from "axios";
// Set the AWS Region.
const REGION = "ap-south-1"; // otherwise copy your region from here - https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-regions-availability-zones.html#concepts-available-regions
const stsClient = new STSClient({ region: REGION, credentials: {
accessKeyId: '<replace with aws access key id>',
secretAccessKey: '<replace with aws secret access key>'
}});
export { stsClient };

sudo apt install chrony -y

sudo systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target

sudo sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config

sudo passwd root

sudo systemctl restart ssh

@CircuitBreaker(name = "mockService", fallbackMethod = "fallback")
public Mono<MockServiceResponse> getMockServiceResponse() {
return mockServiceWebClient.get()
.uri(DOWNSTREAM_PATH)
.retrieve()
.bodyToMono(MockServiceResponse.class)
.doOnError(ex -> {
throw new RuntimeException("the exception message is - "+ex.getMessage());
});
}
@krnbr
krnbr / application.yaml
Created September 1, 2021 19:49
application.yaml for the article
resilience4j:
circuitbreaker:
instances:
mockService:
slidingWindowSize: 3
slidingWindowType: COUNT_BASED
#waitDurationInOpenState: 5
waitInterval: 10000
failureRateThreshold: 50
permittedNumberOfCallsInHalfOpenState: 5
@krnbr
krnbr / TestController.java
Created July 23, 2020 06:11
Custom tags and info open api
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.server.ServerWebExchange;
import reactor.core.publisher.Mono;
import javax.validation.Valid;
@krnbr
krnbr / TestController
Last active July 23, 2020 05:48
TestController And TestDto
import org.springframework.web.bind.annotation.*;
import org.springframework.web.server.ServerWebExchange;
import reactor.core.publisher.Mono;
import javax.validation.Valid;
/**
* @author Karanbir Singh on 07/23/2020
*/
@RestController
@krnbr
krnbr / ApisApplication.java
Last active July 23, 2020 06:43
The Spring boot Main Application
package in.neuw.apis;
import io.swagger.v3.oas.annotations.OpenAPIDefinition;
import io.swagger.v3.oas.annotations.info.Info;
import io.swagger.v3.oas.models.Components;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.security.SecurityRequirement;
import io.swagger.v3.oas.models.security.SecurityScheme;
@SpringBootApplication