Skip to content

Instantly share code, notes, and snippets.

package com.example.fileprocessing.service;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardCopyOption;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
package com.example.fileprocessing.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.Resource;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
@HeshaniSamarasekara
HeshaniSamarasekara / Publisher.java
Last active March 6, 2022 20:06
Amazon MQ producer and cosumer.
package com.example.amazonmq;
import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.activemq.pool.PooledConnectionFactory;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import javax.jms.Connection;
import javax.jms.DeliveryMode;
import javax.jms.Destination;
@HeshaniSamarasekara
HeshaniSamarasekara / DLQ.java
Last active June 22, 2021 05:15
SQS producer, consumer dependencies and java code
private static final String QUEUE_ARN = "QueueArn";
private static final String REDRIVE_POLICY = "RedrivePolicy";
private static final String MAX_RECEIVE_COUNT = "maxReceiveCount";
private static final String DEAD_LETTER_TARGET_ARN = "deadLetterTargetArn";
public void deadLetterQueueConfiguration(SQSConnection sqsConnection) {
final AmazonSQS client = sqsConnection.getAmazonSQSClient();
String dl_queue_url = client.getQueueUrl(new GetQueueUrlRequest(sqsConfig.getDeadLetterQueueName()))
.getQueueUrl();
@HeshaniSamarasekara
HeshaniSamarasekara / kube-registry.yaml
Created June 4, 2021 11:38
Create kube-registry.yaml in minikube
apiVersion: v1
kind: ReplicationController
metadata:
name: kube-registry-v0
namespace: kube-system
labels:
k8s-app: kube-registry
version: v0
spec:
replicas: 1
@HeshaniSamarasekara
HeshaniSamarasekara / changes.yaml
Last active March 30, 2021 18:36
The changes for values, ingress and service yaml files are given in this.
values.yaml
===========
---
service:
name: server
type: ClusterIP
port: 3434
ingress:
enabled: true
@HeshaniSamarasekara
HeshaniSamarasekara / ingress.yaml
Last active March 31, 2021 05:27
Ingress.yaml file changes for tcp expose
---
kind: ConfigMap
apiVersion: v1
metadata:
name: tcp-services
namespace: my-test-ingress-nginx
labels:
app.kubernetes.io/name: my-test-ingress-nginx
app.kubernetes.io/part-of: my-test-ingress-nginx
data:
FROM openjdk:13-alpine
ARG USER=appuser
ARG GROUP=appgroup
RUN apk --no-cache upgrade \
&& apk add --update sudo \
&& apk add --update curl \
&& apk add --update busybox-extras \
&& apk add --update tcptraceroute \
@HeshaniSamarasekara
HeshaniSamarasekara / performance.jmx
Created March 17, 2021 04:07
Jmeter script for Ubik load test with different bit rates
<?xml version="1.0" encoding="UTF-8"?>
<jmeterTestPlan version="1.2" properties="5.0" jmeter="5.4.1">
<hashTree>
<TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="Test Plan" enabled="true">
<stringProp name="TestPlan.comments"></stringProp>
<boolProp name="TestPlan.functional_mode">false</boolProp>
<boolProp name="TestPlan.tearDown_on_shutdown">true</boolProp>
<boolProp name="TestPlan.serialize_threadgroups">false</boolProp>
<elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
<collectionProp name="Arguments.arguments"/>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />