Skip to content

Instantly share code, notes, and snippets.

View sanju2's full-sized avatar
Working from home

Lasantha Sanjeewa Silva sanju2

Working from home
View GitHub Profile
sanju2 /
Created March 31, 2024 19:26
# Java Install
add-apt-repository ppa:openjdk-r/ppa
sudo apt update
sudo apt install openjdk-17-jre-headless -y
# Jenkins Install
sudo wget -O /usr/share/keyrings/jenkins-keyring.asc \
sanju2 /
Created March 31, 2024 19:15
sudo apt-get install wget apt-transport-https gnupg lsb-release -y
wget -qO - | sudo apt-key add -
echo deb $(lsb_release -sc) main | sudo tee -a /etc/apt/sources.list.d/trivy.list
sudo apt-get update
sudo apt-get install trivy -y
#trivy --version
sanju2 /
Created March 31, 2024 19:05
# Docker Install
sudo apt install -y
sudo chmod 666 /var/run/docker.sock
# SonarQube Install
docker run -d -p 9000:9000 sonarqube:lts-community
sanju2 /
Created August 30, 2023 19:15
Create Rest API using Lambda & ApiGateway - AWS Sinhalen Website
import json
def lambda_handler(event, context):
response = event["servicename"]
match event["servicename"]:
case "ec2":
response = "Amazon Elastic Compute Cloud (Amazon EC2) is a web service that provides secure, resizable compute capacity in the cloud. It is designed to make web-scale cloud computing easier for developers. Amazon EC2's simple web service interface allows you to obtain and configure capacity with minimal friction."
case "s3":
response = "Amazon Simple Storage Service (Amazon S3) is an object storage service offering industry-leading scalability, data availability, security, and performance."
sanju2 / job.json
Created July 26, 2023 17:29
AWS Elemental MediaConvert Service - Article
"Queue": "arn:aws:mediaconvert:region:account_id:queues/Default",
"UserMetadata": {},
"Role": "arn:aws:iam::account_id:role/MediaConvert_Default_Role",
"Settings": {
"TimecodeConfig": {
"Source": "ZEROBASED"
"OutputGroups": [
# Use this for your user data (script from top to bottom)
# install httpd (Linux 2 version)
yum update -y
yum install -y httpd
systemctl start httpd
systemctl enable httpd
echo "<h1>Hello World from $(hostname -f)</h1>" > /var/www/html/index.html
sanju2 /
Last active August 12, 2022 09:51
Automate Building AWS S3 Bucket on AWS with CDK for Terraform Article Resource
#!/usr/bin/env python
from constructs import Construct
from cdktf import App, NamedRemoteWorkspace, TerraformStack, TerraformOutput, RemoteBackend
from cdktf_cdktf_provider_aws import AwsProvider, s3
class MyStack(TerraformStack):
def __init__(self, scope: Construct, ns: str):
super().__init__(scope, ns)
sanju2 / aws_vpc.txt
Created July 15, 2022 14:19
AWS VPC Creation Resources
VPC = (demo-vpc)
Public Subnet = (demo-public-subnet)
Private Subnet = (demo-private-subnet)
Internet Gateway = (demo-igw)
Public Subnet Route Table = (demo-public-rt)
Enabled public subnet auto assign IPv4 address
Create 2 ec2 instance using ubuntu 20.04
- Public (demo-public-ec2)
- Private (demo-private-ec2)
NAT Gateway = (demo-nat)
sanju2 / index.php
Created July 1, 2022 19:34
PHP file for Test Composer Package
require_once __DIR__ . '/vendor/autoload.php';
use Sanje\HelloComposer\Index;
$greeting = new Index();
echo $greeting->greet("Hello Composer");
import urllib3
import json
http = urllib3.PoolManager()
def lambda_handler(event, context):
url = ""
msg = {
"channel": "",
"username": "WEBHOOK_USERNAME",
"text": event['Records'][0]['Sns']['Message'],
"icon_emoji" : ""