Skip to content

Instantly share code, notes, and snippets.

View olibartfast's full-sized avatar

Francesco Oliva olibartfast

View GitHub Profile
@olibartfast
olibartfast / c++_ranges.md
Created February 12, 2026 15:24
C++ Ranges and the Evolution of Modern Algorithms

C++ Ranges and the Evolution of Modern Algorithms

A concise reference on how C++ algorithms evolved from raw loops to composable, lazy pipelines — and why ranges represent the most significant leap in expressive power since the STL itself.


The Timeline: From Loops to Pipelines

Pre-C++11: The Dark Ages

@olibartfast
olibartfast / c++_span.md
Last active January 20, 2026 09:19
std::span in Modern C++

std::span in Modern C++

A comprehensive guide to std::span introduced in C++20.

What is std::span?

std::span is a non-owning view over a contiguous sequence of objects. It provides a safe, lightweight way to reference arrays or array-like data structures without taking ownership.

Key Characteristics

@olibartfast
olibartfast / yolo_model_comparison.sh
Created November 29, 2025 13:26
YOLO Model Comparison - Side-by-Side Video Prediction Tool
#!/bin/bash
# Script to run YOLO predictions with two models and compose results side-by-side
# Check if video input is provided
if [ "$#" -lt 1 ]; then
echo "Usage: $0 <input_video>"
echo "Example: $0 /path/to/video.mp4"
exit 1
fi
@olibartfast
olibartfast / kubectl_cheatsheet.md
Last active November 19, 2025 21:15
kubectl_cheat_sheet

🧰 Generic Useful kubectl Commands (with --kubeconfig & port-forwarding)

A compact set of everyday-use commands for inspecting deployments, pods, logs, services, events, configmaps, and port-forwarding. Replace /path/to/kubeconfig.yaml with your actual kubeconfig file.


📦 Deployments

Get basic info

@olibartfast
olibartfast / ninja.md
Last active August 28, 2025 10:58
Ninja Build System Tutorial for C++ Projects

Ninja Build System Tutorial for C++ Projects

What is Ninja?

Ninja is a small, fast build system designed to have its input files generated by a higher-level build system (like CMake). It's optimized for speed and is particularly useful for large C++ projects.

Basic Setup

1. Generate Ninja files with CMake:

# Create build directory
@olibartfast
olibartfast / extract_clip.sh
Created July 10, 2025 15:05
Extract a segment of a video from a given start time and duration.
#!/bin/bash
###############################################################################
# extract_clip.sh
#
# 🎬 Extract a segment of a video from a given start time and duration.
#
# 📥 Usage:
# ./extract_clip.sh input.mp4 start_time duration output.mp4 [--accurate]
#
@olibartfast
olibartfast / blackout_roi.sh
Last active July 9, 2025 16:26
Blackout a Region of Interest (ROI) in a video for a given time window.
#!/bin/bash
######################################################################
# blackout_roi.sh
#
# 🔳 Blackout a Region of Interest (ROI) in a video for a given time window.
#
# 🎯 Usage:
# ./blackout_roi.sh input.mp4 ROI t1 duration output.mp4 [x y w h]
#
@olibartfast
olibartfast / Parallel Programming Cornerstones for CUDA.md
Last active June 19, 2025 22:50
Parallel Programming Cornerstones for CUDA

Parallel Programming Cornerstones in CUDA

This gist outlines the core parallel programming patterns (cornerstones) used in CUDA to leverage modern NVIDIA GPU architectures. These patterns are fundamental for exploiting CUDA’s Single Instruction, Multiple Thread (SIMT) execution model, memory hierarchy, and advanced thread management features for efficient parallel computation.

A key theme in modern CUDA development is the use of highly optimized libraries. For many common patterns, NVIDIA CUB provides state-of-the-art implementations. While the original standalone CUB repository is now archived, CUB is actively maintained as part of the CUDA C++ Core Libraries (CCCL). CCCL unifies CUB, Thrust, and libcu++ into a cohesive standard library included in every CUDA Toolkit. Using libraries like CUB is the recommended best practice for achieving maximum performance and reliability.

The cornerstones covered include:

  • [Reduction](#1-red
@olibartfast
olibartfast / hstack_videos.sh
Created June 16, 2025 09:03
horizontally stacking two videos using FFmpeg's hstack filter
#!/bin/bash
# Check if at least two inputs are provided
if [ "$#" -lt 2 ]; then
echo "Usage: $0 <video1> <video2> [output_file]"
exit 1
fi
# Assign inputs to variables
video1="$1"
@olibartfast
olibartfast / mount_nas.sh
Created June 4, 2025 09:57
How mount a shared folder from your NAS on your Linux Server
#!/bin/bash
# NAS Share Mounter - Mount CIFS/SMB shares with enhanced features
# Prerequisites: sudo apt-get install cifs-utils
set -euo pipefail # Exit on error, undefined variables, pipe failures
# ======= CONFIGURATION =======
SCRIPT_NAME=$(basename "$0")
CONFIG_FILE="$HOME/.nas_mounter.conf"
LOG_FILE="/tmp/nas_mounter_$(date +%Y%m%d).log"