Skip to content

Instantly share code, notes, and snippets.

@vo
vo / index.html
Created February 24, 2017 15:02
simple streaming of video from gstreamer to WebM / VP8 / HTML5 in chrome
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>gstreamer video example</title>
</head>
<body>
<video width=640 height=480 autoplay>
<source src="http://localhost:8080">
</video>
@vo
vo / xrandr_setup_triplemonitor.sh
Created February 16, 2017 18:43
Triple monitor xrandr setup with 1 HiDPI and 2 LoDPI monitors
#!/bin/sh
xrandr --output HDMI-0 --mode 1920x1080 --scale 1.5x1.5 --panning 2880x1620+0+0 --output DP-4 --mode 3840x2160 --panning 3840x2160+2880+0 --scale 1x1 --output DVI-I-1 --mode 1920x1080 --scale 1.5x1.5 --panning 2880x1620+6720+0
@vo
vo / p13105.cpp
Last active January 16, 2017 15:43
Programming Practice: Alliances in Hogwarts
#include <iostream>
#include <vector>
class DisjointSet {
private:
std::vector<int> parent, rank;
public:
DisjointSet(int n) : parent(2 * n, -1), rank(2 * n, -1) {
@vo
vo / p10792.cpp
Created December 24, 2016 02:31
Programming Practice: The Laurel-Hardy Story
#include <iostream>
#include <cmath>
#include <iomanip>
double compute_h2(double r, double d, double h1) {
double t = -2.0 * std::acos((r - d) / r);
double x = std::sqrt(r * r - (r - h1) * (r - h1));
return ((h1 - r) * std::cos(t)) + (x * std::sin(t)) + r;
}
@vo
vo / solo-services.md
Last active February 19, 2017 23:34
Solo Network Services / Ports

3DR Solo Network Services / Ports

  • 5005 - Radio control joystick data - pixrc process on the Solo listens to this for rc joystick messages
  • 5010 - Config Stick Axes Msg
  • 5011 - Param Stored Values Msg
  • 5012 - sysDestPort?
  • 5013 - pairReqPort - stm32 process on Artoo listens to pair requests from the pair_server process
  • 5014 - pairReqDestPort - stm32 process on Artoo sends to this port on the pair_server process
  • 5015 - mavDestPort - stm32 process receives telemetry from the telem_ctrl process here
  • 5016 - buttonEventPort (TCP) - Subscribe to button events on the Artoo (pause, home, A, B, etc) by connecting to this port on the Artoo.
@vo
vo / trim-and-reencode.sh
Created September 30, 2016 18:41
examples of trimming and re-encoding video using ffmpeg on the command line
# examples for trimming without re-encoding
ffmpeg -ss 01:48:12 -i in.ogv -t 00:02:37 -c copy out.ogv
# examples for trimming a video
ffmpeg -ss 00:12:30 -i in.ogv -t 00:12:55 -filter:v "crop=1774:999:16:42" -c:v libx264 -preset slow out1.mp4
ffmpeg -ss 01:48:12 -i in.ogv -t 00:02:37 -filter:v "crop=1763:999:0:51" -c:v libx264 -preset slow out2.mp4
@vo
vo / quad_video_wall.sh
Last active July 5, 2020 09:37
basic gstreamer quad video wall.
#!/bin/bash
# Basic gstreamer quad video wall application.
# Displays 4 videos.
# They have to be synced to eachother and playing for this to work.
PARAMS_NEEDED=4
if [ $# -ne $PARAMS_NEEDED ]
then
@vo
vo / supermajority.c
Created August 17, 2016 19:42
Programming Practice: Finding supermajority character in a string
#include <iostream>
char findSuperMajority(const std::string &str)
{
const size_t len(str.length());
int count(0);
char val(str[0]);
for (char c : str) {
if (count == 0) {
@vo
vo / 70-persistent-net.rules
Last active August 8, 2016 14:57
setup network namespaces for multiple solo mavlink
# Example UDEV rules to make the wlan devices look nicer
SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="00:c0:ca:5a:5a:cb", NAME="wlan0"
SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="00:c0:ca:84:a1:f7", NAME="wlan1"
/*------------------------------------------------------------------------------
* Open a serial port to the MAV with the given port name and baud rate.
* returns: the file descriptor, or < 0 if error.
*/
static int mav_serial_open(const char *port_name, uint32_t const baud_rate)
{
// attempt to open the port.
int fd = open(port_name, O_RDWR | O_NOCTTY | O_NDELAY);
if (fd < 0) {
fprintf(stderr, "ERROR: Could not open() serial port %s.\n", port_name);