Skip to content

Instantly share code, notes, and snippets.

View rpavlik's full-sized avatar

Rylie Pavlik rpavlik

View GitHub Profile
/** @file
@brief Header providing for usage of boost::intrusive_ptr with COM.
Based on the header found at:
<https://github.com/rengeln/nyx/blob/master/src/Prefix.h>
It is essentially the code from the author's blog post,
<http://code-freeze.blogspot.com/2012/02/using-intrusiveptr-with-com.html>
, which describes usage and motivation more. However, it appears to have
some small improvements (mainly in style, and C++11 usage), and usefully,
@rpavlik
rpavlik / mtclasses.lua
Created December 7, 2011 19:08
Quickie example for object-style programming Lua
--See http://www.lua.org/pil/16.html and http://www.lua.org/pil/16.1.html for more information
--Table for all "methods" shared between "objects"
local objMTindex = {}
--method called "greet"
function objMTindex:greet()
print("Hello from ", self, "aka", self.aka)
self.greeted = true
end
@rpavlik
rpavlik / portbranch.sh
Created January 11, 2012 20:25
Script for moving branches from one git-svn mirror to a new one
#!/bin/bash
# Call like ./portbranch official-upstream/3.0 my-3.0-fixes
# Original Author:
# 2012 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
# http://academic.cleardefinition.com
# Iowa State University HCI Graduate Program/VRAC
#
# Copyright Iowa State University 2012.
# Distributed under the Boost Software License, Version 1.0.
@rpavlik
rpavlik / dfu-unor3-patch.diff
Created July 31, 2012 15:43
dfu-programmer diff to add alternate product ID for arduino usbserial chip.
Index: src/arguments.c
===================================================================
--- src/arguments.c (revision 105)
+++ src/arguments.c (working copy)
@@ -72,6 +72,7 @@
{ "at90usb647", tar_at90usb647, adc_AVR, 0x2FF9, 0x03eb, 0x10000, 0x2000, true, 128, true, false, 128, 0x0800 },
{ "at90usb646", tar_at90usb646, adc_AVR, 0x2FF9, 0x03eb, 0x10000, 0x2000, true, 128, true, false, 128, 0x0800 },
{ "at90usb162", tar_at90usb162, adc_AVR, 0x2FFA, 0x03eb, 0x04000, 0x1000, true, 128, true, false, 128, 0x0200 },
+ { "at90usb162unor3",tar_at90usb162, adc_AVR, 0x2FEF, 0x03eb, 0x04000, 0x1000, true, 128, true, false, 128, 0x0200 },
{ "at90usb82", tar_at90usb82, adc_AVR, 0x2FF7, 0x03eb, 0x02000, 0x1000, true, 128, true, false, 128, 0x0200 },
@rpavlik
rpavlik / findjava.js
Created August 21, 2012 22:31
Finding java once and for all - no batch file nonsense
getJRE = function(ver, wantJDK) {
var wshShell = new ActiveXObject("WScript.Shell");
var key = "HKLM\\SOFTWARE\\JavaSoft\\" +
(wantJDK ? "Java Development Kit\\" : "Java Runtime Environment\\") +
ver +
"\\JavaHome";
//WScript.Echo(key);
try {
@rpavlik
rpavlik / .gitignore
Created November 15, 2012 22:38
Updater/package manager scripts for Cygwin
/setup.exe
/Cygwin.bat
/Cygwin.ico
/Cygwin-Terminal.ico
/packages/
/bin/
/cygdrive/
/dev/
/etc/
/home/
@rpavlik
rpavlik / README.md
Last active October 23, 2015 18:34
Data structures in meta and typepack

(Based in part on https://ericniebler.github.io/meta/index.html, designed to be a printable quick reference.)

Quick reference examples

Using the C++14 standard library.

  • Trait: std::add_pointer
    • is a "template" (has template parameters) - not a type unless evaluated.
    • Evaluate: typename std::add_pointer<int>::type (aka typepack::t_<std::add_pointer<int>>) is int *
  • Alias (alias template): std::add_pointer_t
    • is a "template" (has template parameters) - not a type unless evaluated.
  • application: std::add_pointer_t is int *
@rpavlik
rpavlik / Eigen Metaprogramming.md
Last active October 23, 2015 18:35
Eigen metaprogramming notes

Eigen Metaprogramming Notes

Ryan Pavlik

Useful static constant members/enums:

  • ::IsRowMajor
  • ::IsVectorAtCompileTime
  • ::RowsAtCompileTime - note that in the case of dynamic sizes, this is weird (-1, iirc - specifically, Eigen::Dynamic)
  • ::ColsAtCompileTime - same as above
  • ::SizeAtCompileTime - works like picking the right one of the above for either arrangement of vectors, or full size (I assume?) for matrices.
local getRoomToWorld = function()
return RelativeTo.World:getInverseMatrix()
end
--- This is a HIDEOUS HACK @todo
local matrixMult = function(a, b)
local val = osg.Matrixd(a)
val:preMult(b)
return val
@rpavlik
rpavlik / .gitignore
Last active February 23, 2016 19:01
run-clang-tidy wrapper for Jenkins
/run-clang-tidy.py
/hudson*