Skip to content

Instantly share code, notes, and snippets.

@vo
vo / Makefile
Last active May 24, 2019
Makefile to fix broken mp4 files
View Makefile
# 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 Apr 20, 2019
send and recv udp python
View recv.py
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 Aug 26, 2018
Publish incoming serial Mavlink to ZeroMQ
View mavlinktozmq.cc
#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 Aug 24, 2018
Read two Mavlink streams in same loop
View example.cpp
#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 Aug 20, 2018
Creating Custom Mavlink Message
View README.md

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:

<?xml version="1.0"?>
@vo
vo / forwarder.py
Created Aug 17, 2018
basic replacement for telem_ctrl
View forwarder.py
#!/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 Jul 26, 2018
Protobuf serialize/deserialize test
View request1.proto
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
Raspberry Pi 3 B+ Auvidea B101 Gstreamer Pipeline Example
View display-video.sh
#!/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
View add_var.py
#!/usr/bin/env python
####
#
# Usage:
# ./add_var.py [key] [value]
#
####
import re
@vo
vo / forwarder.py
Last active May 22, 2020
mavlink packet inspector
View forwarder.py
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)