Skip to content

Instantly share code, notes, and snippets.

@gvatsal60
gvatsal60 / ps1_git.sh
Last active January 3, 2026 14:41
PS1 Git Prompt Magic
###################################################################################################
# Terminal Setup
###################################################################################################
# Define colors
COLOR_USR='\[\033[01;32m\]' # User color
COLOR_DIR='\[\033[01;34m\]' # Directory color
COLOR_GIT='\[\033[01;36m\]' # Git branch color
COLOR_DEF='\[\033[00m\]' # Default color
NEWLINE='\n' # Newline character
@gvatsal60
gvatsal60 / env_config.py
Created September 20, 2025 06:47
Environment Configuration with Logging and Validation
'''
Configuration settings for the application.
'''
import os
import logging
from dotenv import load_dotenv
load_dotenv()
@gvatsal60
gvatsal60 / EagerSingleton.cpp
Created June 22, 2025 13:35
This implementation follows the Eager Singleton pattern, ensuring a class has only one instance. The instance is created when the class is loaded. The copy constructor and assignment operator are deleted to prevent copying, and access to the singleton is provided via the getInstance() method.
class EagerSingleton {
public:
// Deleted copy constructor and assignment operator to prevent copying
EagerSingleton(const EagerSingleton &) = delete;
EagerSingleton &operator=(const EagerSingleton &) = delete;
// Static method to access the `singleton` instance
static EagerSingleton &getInstance() {
return instance; // Return the singleton instance
}