Skip to content

Instantly share code, notes, and snippets.

@vprasadreddy
vprasadreddy / install-kubectl-on-macos.txt
Created June 1, 2025 05:34
install-kubectl-on-macos
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/darwin/arm64/kubectl"
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/darwin/arm64/kubectl.sha256"
If valid, the output is:
kubectl: OK
chmod +x ./kubectl
@vprasadreddy
vprasadreddy / terraform-try-with-data-blocks.txt
Created January 22, 2025 07:06
Terraform try() with data blocks
In Terraform, the data block is used to fetch existing resources, but if the resource doesn’t exist, it can result in an error. To handle such cases gracefully, you can use workarounds or implement conditional logic to prevent the error from causing a failure in your Terraform run.
Options for Error Handling
1. Use the try() Function
The try() function can catch errors and provide a default value if a data source lookup fails. This approach works if the data block supports an attribute that might return null or is optional.
data "aws_vpc" "example" {
filter {
@vprasadreddy
vprasadreddy / sonarqube-with-postgresql-docker-compose.yml
Created January 18, 2025 08:28
SonarQube with PostgreSQL Docker Compose
version: "3"
services:
sonarqube:
image: sonarqube:community
restart: unless-stopped
container_name: sonarqube
hostname: sonarqube
read_only: true
depends_on:
@vprasadreddy
vprasadreddy / remove-postgresql-from-ubuntu.txt
Created January 16, 2025 16:49
remove-postgresql-from-ubuntu
# Uninstall the PostgreSQL application
sudo apt-get --purge remove postgresql postgresql-doc postgresql-common
# Remove PostgreSQL packages
dpkg -l | grep postgres
sudo apt-get --purge remove <package_name>
#Remove PostgreSQL directories
sudo rm -rf /var/lib/postgresql/
sudo rm -rf /var/log/postgresql/
@vprasadreddy
vprasadreddy / install-docker-on-linux-ubuntu.txt
Created January 1, 2025 08:34
install-docker-on-linux-ubuntu
# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
# Add the repository to Apt sources:
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
@vprasadreddy
vprasadreddy / jenkins-installation-and-plugnis-to-install.txt
Last active January 1, 2025 08:22
Jenkins Installation and Plugins to install
//Install Jenkins on Mac OS
https://www.macminivault.com/installing-jenkins-on-macos/
//Steps to install Jenkins on Ubuntu
sudo wget -O /usr/share/keyrings/jenkins-keyring.asc \
https://pkg.jenkins.io/debian-stable/jenkins.io-2023.key
echo "deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc]" \
https://pkg.jenkins.io/debian-stable binary/ | sudo tee \
/etc/apt/sources.list.d/jenkins.list > /dev/null
sudo apt-get update
@vprasadreddy
vprasadreddy / sync-changes-from-parent-repo-to-forked-repo.txt
Created December 10, 2024 11:52
sync changes from the parent repository into your forked repository
To sync changes from the parent repository into your forked repository, you can follow these steps:
1. Configure the parent repository as a remote
First, you need to ensure that the original (parent) repository is added as a remote in your local repository. This is typically named upstream.
# Navigate to your forked repository's directory
cd path/to/your/repo
# Add the parent repository as 'upstream' remote
@vprasadreddy
vprasadreddy / git-commands.txt
Created October 11, 2024 16:22
git commands
## To configure git for a project in VS Code
1. git remote add origin repo_url
2. git push origin [branch name]
git remote -v to see current origin remote url
//to change existing origin url
git remote set-url origin new.git.url/here
@vprasadreddy
vprasadreddy / basic-linux-commands.txt
Created October 9, 2024 15:00
basic linux commands
//to generate public & private keys
ssh-keygen -t rsa -b 4096
//Login to Linux VM
ssh -i C:\Users\Varaprasad.Reddy\Downloads\vm-loadbalancer1-dev_key.pem azureuser@ip_address
//to get current machine ip address
curl ifconfig.me
//to change user to root user
@vprasadreddy
vprasadreddy / terraform-list-to-map-example.txt
Created October 8, 2024 06:46
terraform list to map example
variable "resources_list_of_objects2" {
type = map(object({
deployment_id = string
model_name = string
model_format = string
}))
default = {
"deployment_1" = {
deployment_id = "gpt-3"
model_name = "gpt-3"