Skip to content

Instantly share code, notes, and snippets.

@vo
vo / Makefile
Last active May 24, 2019 14:29
Makefile to fix broken mp4 files
# This makefile finds all .mp4 files and attempts to repair their indexes without re-encoding.
# It's a makefile so you can use "make -jN" to take advantage of N cores on your computer finish many quickly
MP4:=$(wildcard *.mp4)
OUTDIR:=out
FAST:=$(patsubst %.mp4,${OUTDIR}/%.fast.mp4,${MP4})
REKEYED:=$(patsubst %.mp4,${OUTDIR}/%.rekeyed.mp4,${MP4})
all:
@echo "Use 'make fast' to do a fast file index rebuild"
@vo
vo / recv.py
Last active April 20, 2019 05:00
send and recv udp python
import socket
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.bind(('0.0.0.0', 5005))
while True:
data, addr = sock.recvfrom(65536)
print("received: %d" % len(data))
@vo
vo / mavlinktozmq.cc
Created August 26, 2018 22:20
Publish incoming serial Mavlink to ZeroMQ
#include <iostream>
#include <csignal>
#include <cstring>
#include <fcntl.h>
#include <unistd.h>
#include <termios.h>
#include <zmq.h>
#include "mavlink/ardupilotmega/mavlink.h"
inline bool set_baud(termios *cfg, speed_t baud)
@vo
vo / example.cpp
Created August 24, 2018 03:31
Read two Mavlink streams in same loop
#include <iostream>
#include <cstring>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <thread>
#include "ardupilotmega/mavlink.h"
int open_socket(uint16_t port)
@vo
vo / README.md
Last active July 14, 2024 09:39
Creating Custom Mavlink Message

Creating a Custom Mavlink Message

Download the Mavlink Toolchain

git clone https://github.com/mavlink/mavlink.git

Create a message defintion

Create a file named custom.xml with these contents:

@vo
vo / forwarder.py
Created August 17, 2018 15:31
basic replacement for telem_ctrl
#!/usr/bin/python
import socket
import sys
TELEM_DEST_HOST = '0.0.0.0'
TELEM_DEST_PORT = 14550
STM32_HOST = '127.0.0.1'
STM32_PORT = 5015
@vo
vo / request1.proto
Last active July 26, 2018 16:08
Protobuf serialize/deserialize test
syntax = "proto3";
package request1;
message Request {
Type type = 1;
AmazingCommand amazingCommand = 2;
BeautifulCommand beautifulCommand = 3;
CharmingCommand charmingCommand = 4;
DashingCommand dashingCommand = 5;
@vo
vo / display-video.sh
Last active May 22, 2020 09:47
Raspberry Pi 3 B+ Auvidea B101 Gstreamer Pipeline Example
#!/bin/bash
gst-launch-1.0 udpsrc port=5801 ! 'application/x-rtp,payload=96,encoding-name=H264,clock-rate=(int)90000' ! rtph264depay ! h264parse ! avdec_h264 ! videoconvert ! autovideosink sync=false
#!/usr/bin/env python
####
#
# Usage:
# ./add_var.py [key] [value]
#
####
import re
@vo
vo / forwarder.py
Last active May 22, 2020 09:47
mavlink packet inspector
from pymavlink import mavutil
import threading
connection = mavutil.mavlink_connection("udp:0.0.0.0:14592")
local = mavutil.mavlink_connection("udpout:127.0.0.1:14593")
def on_msg_from_uas(msg):
buf = msg.get_msgbuf()
local.write(buf)