Skip to content

Instantly share code, notes, and snippets.

View nantaaditya's full-sized avatar
🥸
No Need to Know.

pramuditya ananta nur nantaaditya

🥸
No Need to Know.
View GitHub Profile
@nantaaditya
nantaaditya / SignatureGenerator.java
Created April 29, 2025 07:06
Gateway Signature
import java.security.KeyFactory;
import java.security.NoSuchAlgorithmException;
import java.security.PrivateKey;
import java.security.PublicKey;
import java.security.Signature;
import java.security.spec.InvalidKeySpecException;
import java.security.spec.PKCS8EncodedKeySpec;
import java.security.spec.X509EncodedKeySpec;
import java.util.Base64;
import org.springframework.util.StringUtils;
@nantaaditya
nantaaditya / Dockerfile
Last active February 9, 2025 00:44
Native Image
# First stage: Build UPX for ARM64
FROM amd64/alpine:latest AS build
# Install dependencies to build UPX
RUN apk add --no-cache build-base git cmake
# Clone UPX repository and build it
RUN git clone https://github.com/upx/upx.git /upx \
&& cd /upx \
&& git submodule update --init \
import java.util.Base64;
import java.security.spec.X509EncodedKeySpec;
import java.security.KeyFactory;
import java.security.PublicKey;
import javax.crypto.Cipher;
import javax.crypto.spec.OAEPParameterSpec;
import javax.crypto.spec.PSource;
import java.security.spec.MGF1ParameterSpec;
package com.cms.alto.cmsapi.dto.exception;
public class CardEncryptorException extends Exception {
public CardEncryptorException(Throwable e) {
super(e);
}
public CardEncryptorException(String message) {
super(message);
}
}
@Slf4j
@ExtendWith(MockitoExtension.class)
public class CallablePublisherTest {
private String data() {
log.info("is it executed?");
return "data";
}
@Test
No Triggering Event Services Success Event Failed Event
1 - Order Microservices Create order -
2 Create order Inventory Microservices Decrease stock Decrease stock failed
2a Decrease stock failed Order Microservices - -
3 Decrease stock Payment Microservices Debit balance Credit balance
3a Credit balance Inventory Microservices - -
4 Debit balance Order Microservices - -
@Component
public class JaversAuditorProvider implements AuthorProvider {
@Autowired
private Tracer tracer;
private static final String X_AUDITOR_HEADER = "x-auditor";
@Override
public String provide() {
@nantaaditya
nantaaditya / JavaExample.java
Created December 2, 2021 06:59
VavrFunction
public class JavaExample {
public static Integer calculate(Integer value) throws Exception {
return value / value;
}
}
public class CollectionTest {
@Test
public void immutability() {
List<String> wordList = Arrays.asList("first", "second", "third");
List<String> immutableList = Collections.unmodifiableList(wordList);
immutableList.add("error?");
}
@Test
@nantaaditya
nantaaditya / MonadEither.java
Last active December 5, 2021 03:35
VavrMonad
public class MonadEither {
private Either<String, Integer> computeWithEither(int score) {
if (score > 80) {
return Either.right(score);
}
return Either.left("Failed");
}
@Test
public void eitherExample() {