Skip to content

Instantly share code, notes, and snippets.

  • After making changes, ALWAYS make sure to start up a new server so I can test it.
  • Always look for existing code to iterate on instead of creating new code.
  • Do not drastically change the patterns before trying to iterate on existing patterns.
  • Always kill all existing related servers that may have been created in previous testing before trying to start a new server.
  • Always prefer simple solutions
  • Avoid duplication of code whenever possible, which means checking for other areas of the codebase that might already have similar code and functionality
  • Write code that takes into account the different environments: dev, test, and prod
  • You are careful to only make changes that are requested or you are confident are well understood and related to the change being requested
  • When fixing an issue or bug, do not introduce a new pattern or technology without first exhausting all options for the existing implementation. And if you finally do this, make sure to remove the old implementation afterwards so we d
@rajvermacas
rajvermacas / python_remote_debugging_launch.json
Created March 26, 2025 20:22
debugpy remote attach python debugger
// def sample_task():
// x = 1
// import debugpy
// debugpy.listen(5678)
// debugpy.wait_for_client()
// debugpy.breakpoint()
// print("This is a sample task executed by the DAG.")
// debugpy.breakpoint()
from abc import ABCMeta, abstractmethod
import inspect
from airflow import DAG
from airflow.decorators import task
from datetime import datetime
# Define the metaclass for DAG creation
class DagMeta(ABCMeta):
def __new__(mcs, name, bases, attrs):
# Create the class using the standard process
@rajvermacas
rajvermacas / adb_connection.py
Last active March 16, 2025 15:06
Azure Databricks
import argparse
from databricks.sdk import WorkspaceClient
from databricks.sdk.core import Config
def main():
# Parse command-line arguments
parser = argparse.ArgumentParser(description="Run an Azure Databricks job using a Service Principal")
parser.add_argument("--client_id", required=True, help="Azure Service Principal client ID")
parser.add_argument("--client_secret", required=True, help="Azure Service Principal client secret")
parser.add_argument("--tenant_id", required=True, help="Azure tenant ID")
‎‎​
@rajvermacas
rajvermacas / cursorKeyboardShortcuts.json
Last active March 27, 2025 15:08
vscode keyboard shortcuts
// Place your key bindings in this file to override the defaults
[
{
"key": "ctrl+k ctrl+s",
"command": "workbench.action.openGlobalKeybindings"
},
{
"key": "ctrl+m ctrl+s",
"command": "-workbench.action.openGlobalKeybindings"
},
@rajvermacas
rajvermacas / ipAddressRange.txt
Created March 7, 2025 11:42
IP Address range
Private IP Addresses:
• 10.0.0.0/8: Used for private networks.
• 172.16.0.0/12: Used for private networks.
• 192.168.0.0/16: Used for private networks.
Loopback Address:
• 127.0.0.0/8: Reserved for loopback (localhost).
Link-local Addresses:
• 169.254.0.0/16: Used for automatic IP addressing when DHCP fails.
@rajvermacas
rajvermacas / rough.txt
Last active March 16, 2025 08:47
Rough
// Define the path to the new folder in ADLS
val adlsFolderPath = "abfss://<container-name>@<storage-account-name>.dfs.core.windows.net/<folder-path>"
// Create the new folder
dbutils.fs.mkdirs(adlsFolderPath)
// Verify if the folder was created
val folderExists = dbutils.fs.ls(adlsFolderPath).nonEmpty
if (folderExists) {
@rajvermacas
rajvermacas / multiprocessing_read.py
Last active January 20, 2025 21:38
ReadBigCsvFile
from multiprocessing import Process, Queue
def writer_process(output_dir):
"""Single process dedicated to writing files"""
while True:
msg = write_queue.get()
if msg == 'STOP':
break
date_str, data = msg
filepath = f"{output_dir}/daily_{date_str}.csv"
@rajvermacas
rajvermacas / varBehaviour.pinescript
Last active January 15, 2025 19:25
Pinescript var behaviour
// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © mrinalrajubereats1
//@version=6
indicator("My script")
log.info("\n########### Day starts ###########")
func1() =>
var a = 0