Skip to content

Instantly share code, notes, and snippets.

View davidlu1001's full-sized avatar

David Lu davidlu1001

View GitHub Profile
@davidlu1001
davidlu1001 / Kubernetes YAML Analyzer.md
Last active September 8, 2025 22:32
k8s_yaml_analyzer.py

Kubernetes YAML Analyzer

A powerful Python script to analyze multi-document Kubernetes YAML files and provide guidance for creating kustomization.yaml files with security context patches.

Features

  • Container Analysis: Accurately counts containers and initContainers for all Kubernetes workload types
  • Security Context Checking: Analyzes existing securityContext configurations
  • Kustomization Guidance: Provides detailed recommendations for creating kustomization.yaml patches
  • Flexible Search: Supports custom search rules via configuration files
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- all.yaml
patches:
# ================================
# UNIVERSAL POD-LEVEL SECURITY CONTEXT
# ================================
@davidlu1001
davidlu1001 / aks_vul_report_duckdb.py
Created July 15, 2025 05:50
aks_vul_report_duckdb.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
AKS Vulnerability Reporting Tool
Description:
This script queries Azure KQL for AKS cluster vulnerabilities, performs historical trend
analysis using a local DuckDB database, and sends a formatted HTML email summary
with a full CSV report as an attachment.
# Enterprise Immuta Column Tag Removal Tool
## 📋 Overview
The **Enterprise Immuta Column Tag Removal Tool** (`column_tag_del.py`) is a high-performance, production-ready Python script designed to remove tags from Immuta columns based on CSV input. This tool is the reverse operation of `column_tag_add.py` and features enterprise-grade reliability, comprehensive error handling, and advanced monitoring capabilities.
### 🎯 Key Features
- **🏢 Enterprise-Grade**: Circuit breaker, retry logic, adaptive rate limiting
- **📊 Progress Tracking**: SQLite-based persistence with resume functionality
@davidlu1001
davidlu1001 / column-tag-add.py
Last active May 26, 2025 11:33
column-tag-add.py
#!/usr/bin/env python3
import csv
import json
import logging
import sys
import os
from pathlib import Path
import requests
import argparse
@davidlu1001
davidlu1001 / Combined_Files_Archive.txt
Last active May 25, 2025 10:40
Combined Files Archive for repo file-combiner
# Enhanced Combined Files Archive
# Generated by file-combiner v2.0.1
# Date: 2025-05-25 10:39:59 UTC
# Source: /tmp/file_combiner_github_83t4ttow
# Total files: 15
# Total size: 128.0KB
#
# Format:
# === FILE_SEPARATOR ===
# FILE_METADATA: <json_metadata>
@davidlu1001
davidlu1001 / SOP_Immuta_Operations.md
Created May 21, 2025 04:49
SOP - Immuta Operations

Immuta Operations SOP - BAU / Change Management / Incident Learnings (with Snowflake Integration)


Quick Reference Table

Task API Endpoint Script Example Section
User Staging /api/v2/user/status stage_users.py 3.1
Tag Migration /api/v2/tag migrate_tags.py 2.4
@davidlu1001
davidlu1001 / immuta-create-groups.js
Last active May 14, 2025 22:56
immuta-create-groups.js
// This script automates the creation of Immuta Groups from CSV or Excel files
// To use:
// 1. Navigate to the Immuta Groups page (People > Groups)
// 2. Open browser's developer console (F12 or right-click > Inspect > Console)
// 3. Paste this entire script and press Enter
// 4. Follow the on-screen prompts to select your CSV or Excel file
// Global variables
let isOfflineMode = false;
@davidlu1001
davidlu1001 / convert_immuta_tags.py
Last active May 14, 2025 07:32
convert_immuta_tags.py
#!/usr/bin/env python3
"""
Immuta Tag Converter - Converts Immuta Tag API GET response to POST /tag API format.
This script processes tag data from Immuta's GET /tag API response and converts it into
the format required for POST /tag API requests, handling tag hierarchies and structure
according to Immuta API requirements.
Features:
- Support for tag hierarchies with custom separators
@davidlu1001
davidlu1001 / compare_tags.sh
Created May 13, 2025 10:38
compare_tags.sh
#!/bin/bash
# compare_tags.sh - Compare leaf node tags between two Immuta CSV files
# Usage: ./compare_tags.sh file1.csv file2.csv
if [ $# -ne 2 ]; then
echo "Usage: $0 <file1.csv> <file2.csv>"
exit 1
fi