Skip to content

Instantly share code, notes, and snippets.

View munzz11's full-sized avatar
🌎

Avery Muñoz munzz11

🌎
View GitHub Profile
@munzz11
munzz11 / bag2video.py
Last active October 14, 2025 07:45
Simple ROS .bag to .mp4 conversion
import rosbag
import cv2
from cv_bridge import CvBridge
import argparse
import glob
def create_video(bag_file, image_topic, output_video):
bridge = CvBridge()
bag = rosbag.Bag(bag_file, 'r')
@munzz11
munzz11 / reindex.sh
Last active May 30, 2023 20:22
Reindex all .active bag files in a dir and delete the .orig.
#!/bin/bash
DIRECTORY="$1"
# Iterate over files in the directory and avoid ._ files. This is an edgecase from having ext4 files on an HFS system
find "$DIRECTORY" -type f -name "*.bag.active" \! -name "._*" | while IFS= read -r file; do
# Index the file
rosbag reindex "$file"
@munzz11
munzz11 / mdt_msg_to_navsatfix.ts
Last active September 20, 2022 21:03
Convert mdt_msgs/Gps to sensor_msgs/NavSatFix inside the node playground, now called User Scripts in Foxglove studio
import { Input, Message } from "./types";
type Output = Message<"sensor_msgs/NavSatFix">;
export const inputs = ["/mothership_gps"];
export const output = "/test_output";
export default function script(event: Input<"/mothership_gps">): Output {
return {header:{
seq: event.message.header.seq,
@munzz11
munzz11 / pic_to_vid.py
Created August 4, 2022 19:52
Turn daily screenshot log into video
import cv2
import numpy as np
import glob
import os
path = '2022-07-30/' # path to file containing days images
output_file = 'output_video.mp4' # output file name
width = 3846 # width of the input images
height = 2160 # height ofthe input images
@munzz11
munzz11 / recursive_for_loop.bash
Last active August 1, 2022 23:31
Recursive command execution through a directory
function recursive_for_loop {
for f in *; do
if [ -d $f -a ! -h $f ];
then
cd -- "$f";
echo "Executing in:`pwd`/$f";
#COMMAND GO HERE
# use recursion to navigate the entire tree
recursive_for_loop;
cd ..;