Skip to content

Instantly share code, notes, and snippets.

View hiranp's full-sized avatar
💭
Don't Panic... working on it!

HP hiranp

💭
Don't Panic... working on it!
View GitHub Profile
@hiranp
hiranp / add-dod-certs.sh
Last active September 23, 2025 21:40
Importing DoD root certificates into linux CA store
#!/bin/bash
# Imports DoD root certificates into Linux CA store
# Version 0.6.0
# SPDX-License-Identifier: GPL-3.0-or-later
# For issues or updated versions of this script, browse to the following URL:
# https://gist.github.com/hiranp/be47692d698849ff8622ceab52975cac
# Derived from: https://gist.github.com/AfroThundr3007730/ba99753dda66fc4abaf30fb5c0e5d012
@hiranp
hiranp / copilot-instructions.md
Last active July 2, 2025 16:27
instructions how GitHub Copilot should assist with python project
description
Python coding conventions and guidelines

** GitHub Copilot Instructions**

These instructions define how GitHub Copilot should assist with this project. The goal is to ensure consistent, high-quality, and well-documented code aligned with our modern, high-performance Python stack.

1. Core Context 🧠

@hiranp
hiranp / convert_requirements.py
Last active June 19, 2025 01:08
Convert Conda requirments.txt to uv pyproject.toml
#!/usr/bin/env python3
"""
Script to convert conda environment.yml or requirements.txt to uv-compatible pyproject.toml format
This script reads a conda environment file (environment.yml or requirements.txt with conda format)
and converts all dependencies to a format compatible with uv in pyproject.toml.
Features:
- Extracts conda and pip dependencies from environment files
- Preserves version information from the source file
@hiranp
hiranp / process_monitor.sh
Last active February 13, 2025 18:29
cript to monitor and log space, memory, and CPU usage of a process
#!/bin/bash
# Script to monitor and log space, memory, and CPU usage of a process
# Usage: sudo ./monitor_process.sh <process_name> <log_file>
# Enable error handling after argument check
set -o errexit
set -o nounset
set -o pipefail
@hiranp
hiranp / time_convert.py
Created January 9, 2025 13:15
Simple time converstion
import os
import time
def read_file_int(filepath):
"""Read the content of a file and return it."""
if not filepath:
print("Error: File path is None.")
return 0
@hiranp
hiranp / setup-deps-local.sh
Last active December 30, 2024 20:20
Python Binary Dependency Generator and Installer
#!/usr/bin/env bash
set -euo pipefail
# This script builds a tarball of all the dependencies for the project
# It is meant to be run on a Linux machine without internet access
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
PYTHON_BIN="/usr/bin/python3.9"
REQUIREMENTS_FILE="requirements.txt"
@hiranp
hiranp / add-dod-certs.sh
Last active December 20, 2024 16:22
Install DOD Certs Linux
#!/bin/bash
# Import DoD root certificates into linux CA store
# https://gist.github.com/AfroThundr3007730/ba99753dda66fc4abaf30fb5c0e5d012
# Dependencies: openssl, wget, unzip
set -e
main() {
# Location of bundle from DISA site
@hiranp
hiranp / copy_files_specific_date.sh
Created November 14, 2024 16:52
Copy files in data range and specific extension
#!/bin/bash
# Define source and destination directories
SOURCE_DIR="/path/to/source"
DEST_DIR="/path/to/destination"
START_DATE="2024-10-01" # Change this to the start date of the range
END_DATE="2024-10-15" # Change this to the end date of the range
EXTENSIONS=("*.txt" "*.log" "*.conf") # Add the specific extensions you want to match
# Ensure the destination directory exists
@hiranp
hiranp / para_rsync.sh
Last active July 22, 2024 21:20
Parallel rsync
#!/bin/bash
# Note: Adjust rsync flags as needed for your specific requirements
# Author: Hiran P
# Date: 2024-07-19
# Description: A script to perform parallel rsync operations with optional continuous sync using inotifywait
#### Usage ####
## ./para_rsync.sh --exclude-from /path/to/exclude_me.txt