Skip to content

Instantly share code, notes, and snippets.

View thepatrickniyo's full-sized avatar
:octocat:
Building & Mentoring

Patrick Niyogitare thepatrickniyo

:octocat:
Building & Mentoring
View GitHub Profile
import numpy as np
from typing import Tuple
def fit_ordinary_least_squares(X: np.ndarray, y: np.ndarray) -> np.ndarray:
"""
Fits an Ordinary Least Squares (OLS) Linear Regression model.
Parameters:
X (np.ndarray): Design matrix of shape (n_samples, n_features).
y (np.ndarray): Target vector of shape (n_samples, 1).
def proc(a, b):
x = a + b
for i in range(10):
x += i
# Missing return statement and missing docstring
import os
def check_container_health():
path = "/var/run/docker.sock"
if os.path.exists(path):
return "docker active"
else:
return "docker offline"
res = check_container_health()
def calculate_dataset_statistics(numbers):
# Calculates mean, variance, and standard deviation
if not numbers:
return 0.0, 0.0, 0.0
mean = sum(numbers) / len(numbers)
variance = sum((x - mean) ** 2 for x in numbers) / len(numbers)
std_dev = variance ** 0.5
return round(mean, 2), round(variance, 2), round(std_dev, 2)
@thepatrickniyo
thepatrickniyo / linear_regression.py
Last active July 30, 2026 04:45
linear_regression.py
import numpy as np
from typing import Tuple
def fit_ordinary_least_squares(X: np.ndarray, y: np.ndarray) -> np.ndarray:
"""
Fits an Ordinary Least Squares (OLS) Linear Regression model.
Parameters:
X (np.ndarray): Design matrix of shape (n_samples, n_features).
y (np.ndarray): Target vector of shape (n_samples, 1).
"""
Backfill loan_expiry_date on immovable mtg_collateral_application rows.
Legacy NOTICE.TERMINATION_DATE uses DD-MON-YY (e.g. 10-DEC-12). Expiry is
maturity + 2 years. Run after core migration if loan_expiry_date was null due
to the wrong date format in mtg_collateral_application.py.
Examples:
python -m modules.mortgage_management.temp_data.patch_expiry_date --dry-run
python -m modules.mortgage_management.temp_data.patch_expiry_date --execute
@thepatrickniyo
thepatrickniyo / code-workflow.md
Last active May 7, 2026 08:58
code-workflow.md

Codebase Walkthrough: Zero-Downtime Deployment and Replication Health System

This document explains every file and directory in this repository and maps each one to the corresponding deliverable from the senior MLOps/Infrastructure Engineer challenge prompt.


Project Overview

The prompt asked for the design and implementation of a Zero-Downtime Deployment and Replication Health System for a healthcare product (eFiche) deployed across Rwanda — a centralized Kigali primary and Raspberry Pi edge nodes at rural clinics. Every deliverable in the prompt has a corresponding artifact in this repo.

import {defineConfig} from 'sanity'
import {structureTool} from 'sanity/structure'
import {schemaTypes} from './src/schemaTypes'
const SANITY_PROJECT_ID = '';
const SANITY_DATASET = '';
export default defineConfig({
basePath: '/admin',
name: 'default',
// Create Instruction
// Method: POST
// Endpoint: localhost:8200/api/v1/e-approval/instruction
{
"subject": "UCI Site Event at Amahoro 2",
"description": "The step-by-step execution of event setup and operations, starting from the arrival of teams and equipment until the event runs smoothly.",
"priority": "HIGH",
"assignedTo": [
"56cd695a-d872-42ec-9523-37bb0c67a6bd"
],
@thepatrickniyo
thepatrickniyo / kernels-and-convolution.ipynb
Created June 30, 2025 09:34
Kernels and Convolution.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.