Skip to content

Instantly share code, notes, and snippets.

View randvoorhies's full-sized avatar

Randolph Voorhies randvoorhies

View GitHub Profile
import React, {} from 'react';
import {
IconButton,
InlineField,
InlineFieldRow,
InlineSwitch,
QueryField,
Select,
TypeaheadInput, TypeaheadOutput
} from "@grafana/ui";
@randvoorhies
randvoorhies / latticefun.py
Last active April 15, 2019 03:12
Simple 3D lattice generator
import numpy as np
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import pyplot as plt
np.set_printoptions(precision=3, suppress=True)
alpha, beta, gamma = np.deg2rad([60, 70, 80])
a, b, c = 1, 1, 1
n_x, n_y, n_z = 5, 5, 5
/**
* Bresenham Curve Rasterizing Algorithms
* @author Zingl Alois
* @date 17.12.2014
* @version 1.3
* @url http://members.chello.at/easyfilter/bresenham.html
*/
function assert(a) {
if (!a) console.log("Assertion failed in bresenham.js "+a);
@randvoorhies
randvoorhies / mrpt_osx_glut_patch.diff
Last active August 29, 2015 13:56
OpenGL/GLUT Patch for MRPT on OS X
diff -Naur --exclude='.git*' /Library/Caches/Homebrew/mrpt--git/apps/3DSceneViewer/_DSceneViewerMain.cpp ./apps/3DSceneViewer/_DSceneViewerMain.cpp
--- /Library/Caches/Homebrew/mrpt--git/apps/3DSceneViewer/_DSceneViewerMain.cpp 2014-02-28 16:24:13.000000000 -0800
+++ ./apps/3DSceneViewer/_DSceneViewerMain.cpp 2014-02-28 16:36:55.000000000 -0800
@@ -100,8 +100,13 @@
#include <windows.h>
#endif
-#include <GL/gl.h>
-#include <GL/glu.h>
+#ifdef MRPT_OS_APPLE
rand@Randolphs-MacBook-Pro:~/workspace/sandbox$ make
g++-4.9 -std=c++11 main2.cpp obj1.cpp obj2.cpp -I../cereal/include
duplicate symbol cereal::detail::Versions::mapping in:
/var/folders/z8/8m9443jx2rsdv_c908pn00m00000gn/T//cceemLWz.o
/var/folders/z8/8m9443jx2rsdv_c908pn00m00000gn/T//cckqajum.o
duplicate symbol cereal::detail::Versions::mapping in:
/var/folders/z8/8m9443jx2rsdv_c908pn00m00000gn/T//cceemLWz.o
/var/folders/z8/8m9443jx2rsdv_c908pn00m00000gn/T//ccgHDFrZ.o
ld: 2 duplicate symbols for architecture x86_64
collect2: error: ld returned 1 exit status
@randvoorhies
randvoorhies / deadman.hpp
Created October 10, 2013 18:42
Deadman gist
//! A deadman switch that will execute it's constructor parameter on destruction unless disarm()'d
struct deadman
{
deadman(std::function<void()> boom) : boom_(boom) {}
~deadman() { boom_(); }
void disarm() { boom_ = [](){}; }
std::function<void()> boom_;
};
@randvoorhies
randvoorhies / gist:6887471
Last active December 25, 2015 00:19
Patch for Homebrew OpenCV to fix: Undefined symbols for architecture x86_64: "_faacEncClose", referenced from: _Faac_encode_close in libavcodec.a(libfaac.o) _Faac_encode_init in libavcodec.a(libfaac.o) etc...
--- opencv-2.4.6.1/modules/highgui/CMakeLists.txt.orig 2013-10-08 10:16:00.000000000 -0700
+++ opencv-2.4.6.1/modules/highgui/CMakeLists.txt 2013-10-08 10:14:40.000000000 -0700
@@ -191,7 +191,7 @@
list(APPEND HIGHGUI_LIBRARIES ${BZIP2_LIBRARIES})
endif()
if(APPLE)
- list(APPEND HIGHGUI_LIBRARIES "-framework VideoDecodeAcceleration" bz2)
+ list(APPEND HIGHGUI_LIBRARIES "-framework VideoDecodeAcceleration -lmp3lame -lfaac -liconv -lx264 -lxvidcore" bz2)
endif()
endif(HAVE_FFMPEG)
@randvoorhies
randvoorhies / testMessageSplit.cpp
Created April 26, 2012 06:53
NRT Message Split Test
#include <iostream>
#include <cxxabi.h>
#include <boost/preprocessor/variadic/size.hpp>
#include <boost/preprocessor/seq/for_each.hpp>
#include <boost/preprocessor/variadic/to_seq.hpp>
#include <boost/preprocessor/stringize.hpp>
int indent = 1;
template<class T>
Object searchForBuoy()
{
double originalOrientation = currentPosition.orientation();
// Look for the buoy to the right
ActionToken rotationRight = rotateTo(originalOrientation - pi/2);
while(!rotationRight.complete())
{
ObjectVector objects = detectedObjects();
if(objects.contains("buoy"))
@randvoorhies
randvoorhies / gist:2200185
Created March 25, 2012 21:53
A mapping of Arduino Mega pin functionality onto Atmega 1280 pins
=============== =========== ========================
Atmega 1280 Pin Arduino Pin Arduino Special Function
--------------- ----------- ------------------------
PA0 Digital 22
PA1 Digital 23
PA2 Digital 24
PA3 Digital 25
PA4 Digital 26
PA5 Digital 27
PA6 Digital 28