Skip to content

Instantly share code, notes, and snippets.

View rpavlik's full-sized avatar

Rylie Pavlik rpavlik

View GitHub Profile
@rpavlik
rpavlik / iteration.h
Created September 10, 2019 23:31
some c++ iteration utilities
//-----------------------------------------------------------------------------
// Helpers for iteration.
//-----------------------------------------------------------------------------
#ifndef SOLVESPACE_ITERATION_H
#define SOLVESPACE_ITERATION_H
#include "solvespace.h"
namespace SolveSpace {
@rpavlik
rpavlik / 1-README.md
Last active July 31, 2019 14:00
Spec and registry diffs between OpenXR 0.90 and 1.0

These are not exactly the released versions: I pre-processed them slightly to reduce diff noise, then ran the spec sources through https://github.com/asciidoctor/asciidoctor-extensions-lab/blob/master/scripts/asciidoc-coalescer.rb to produce a single adoc file for each spec version. I then used git diff --patience on the combined adoc file and the XML registry.

As an obligatory note, these diffs aren't an official product of the working group, and they are not normative.

As diffs of the spec components, they carry the same license as those spec components.

@rpavlik
rpavlik / VM-XServer-Instructions.md
Last active May 18, 2019 21:34
Cygwin X for a virtual machine

Using Cygwin X as a display for a Linux VM without SSH overhead

This is primarily for my own record and knowledge. If it helps you, great! If it breaks something, don't say I didn't warn you - this is just documentation of what I did to get this to work at the time I wrote this on one particular machine.

Environment

  • I have a 64-bit cygwin install in c:\cygwin64 (possible in 32-bit too, I just messed up that install and it no longer works, so these were tested on my machine in a 64-bit install). I use my Cygwin setup scripts to simplify this part.
  • I'm using VirtualBox on Windows 8.1.
    • Importantly (at least for VirtualBox), I added a "host-only networking" adapter for communication between the guest (VM) and host machine - this seems to be required.
  • Totally optional but useful part of my setup: I'm using VBoxHeadlessTray to be able to easily have my virtual machine running without taking
@rpavlik
rpavlik / CMakeLists.txt
Created September 12, 2017 17:48
Requesting C++14 and C11
cmake_minimum_required(VERSION 3.1.0)
project(my-project)
set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD_REQUIRED ON)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
@rpavlik
rpavlik / 99-sensics-usb.rules
Created November 23, 2015 19:42
Sensics Linux UDEV rules
# udev file for USB interfaces on Sensics-based HMDs and emulated devices
###
# Section to permit access to HID streaming
###
# OSVR HDK (via HIDAPI/libusb)
SUBSYSTEM=="usb", ATTRS{idVendor}=="1532", ATTRS{idProduct}=="0b00", MODE="0660", GROUP="plugdev"
@rpavlik
rpavlik / OSVR-Data-Flow.md
Created March 30, 2015 16:38
OSVR Data flow doc

Data Flow in the OSVR Core

Ryan A. Pavlik, PhD (Sensics, Inc) - 29 March 2015

Introduction

The OSVR Core, and in particular the server, has among its primary concerns the management of device and analysis plugins, the maintenance of configuration and the semantic path tree, and the routing of input and output data. It conceptually uses a client-server model, though there is almost always a local (same machine) server, and the design does not require process separation. However, for simplicity, the following is written with separate client/server processes.

In important ways, analysis and hardware device plugins are similar, in that both can produce data that a client or an analysis plugin may request. Thus, both types are considered "logical devices", and "device" refers to this general characterization unless indicated otherwise.

@rpavlik
rpavlik / iwyu-on-json.py
Created November 20, 2012 21:12
Run iwyu on compile_commands.json file created by CMake with CMAKE_EXPORT_COMPILE_COMMANDS
#!/usr/bin/env python
import json
import subprocess
import sys
def run(cmd):
# print(cmd)
stringCmd = u" ".join(cmd)
subprocess.call(stringCmd, shell=True)
@rpavlik
rpavlik / shell.sh
Created February 24, 2018 21:59
Find some installed packages and get just their names, suffixed by a forced version.
#!/bin/sh
# for instance, for fixing/removing a botched locally-build kernel.
dpkg -l|grep "bpo9+1.1" | sed -r 's/ii\s+(\S+).*/\1=4.14.13-1~bpo9+1/' | xargs echo
@rpavlik
rpavlik / generate.sh
Created September 6, 2017 14:20
STM32F103xB scripts/generate.sh script for xpack/micro-os-plus usage
#!/bin/bash
set -euo pipefail
IFS=$'\n\t'
# Sample scripts/generate.sh file for use of xPacks on an STM32F103xB,
# such as that found on the Nucleo F103RB (only minor changes required for other F1 chips),
# using my "unofficial" xPacks of the HAL and CMSIS device code.
# Based on a combination of these files:
# https://github.com/micro-os-plus/eclipse-demo-projects/blob/master/f4discovery-blinky-micro-os-plus/scripts/generate.sh
@rpavlik
rpavlik / nunchuck
Created April 7, 2012 02:51
Arduino 1.0-compatible nunchuck example based on http://www.windmeadow.com/node/42
#include <Wire.h>
#include <string.h>
#undef int
#include <stdio.h>
uint8_t outbuf[6]; // array to store arduino output
int cnt = 0;
int ledPin = 13;