Skip to content

Instantly share code, notes, and snippets.

View aaronsnoswell's full-sized avatar

Aaron Snoswell aaronsnoswell

  • Australia
View GitHub Profile
Message Type ROS to UE4 UE4 to ROS
sdf
sdf sfdsf
@aaronsnoswell
aaronsnoswell / cv_pick_points.py
Created December 27, 2017 08:42
Prompt a user to interactively pick N points using OpenCV and Python
"""
Prompts the user to pick num_points from the figure displayed in window_name
Promts the user to pick points from a displayed image. Users can cancel the
point selection by pressing Escape.
Args:
window_name: The name of the window the user should pick from
num_points: Number of points the user should pick (defaults to 4)
mouse_event: The event to use for picking points (defaults to left
@aaronsnoswell
aaronsnoswell / svg2png.sh
Created November 28, 2013 11:10
Convert SVGs to PNGs recursively
#!/bin/sh
# Convert .svg files to .png - works on a single file or
# recursively on the given directory.
# Requries ImageMagick's `convert` function
# Author: Aaaron Snoswell
density=${2-72}
function convertsvg () {
@aaronsnoswell
aaronsnoswell / particle_filter.c
Created November 28, 2013 05:20
Simple example of a particle filter
/**
* particle_filter.c - A simple demonstration of a particle filter
*
* Example adapted from
* http://web.mit.edu/16.412j/www/html/Advanced%20lectures/Slides/Hsaio_plinval_miller_ParticleFiltersPrint.pdf
*
* Suppose you're trying to tell if it is rainy or sunny outside (a system
* with two possible states), but you can't see out any windows. The only
* information you have is observations you make as your boss periodically
* walks by your room; he will either be carrying an umbrella, or not carrying
@aaronsnoswell
aaronsnoswell / gist:3921992
Created October 20, 2012 04:17
Fast Unit Vector Normalisation for Discrete Spaces
// Really (really) fast unit vector normalisation
var c = 0.7071067812;
if(v[X] != 0 && v[Y] != 0) {
v[X] *= c, v[Y] *= c;
}
/* Formats a human-, or machine-friendly string to be suitable for use as a
* CSS class name.
*/
var classify = function(text) {
text = (text != undefined) ? text : "";
return text.toLowerCase().replace(/\s/g, "_").replace(/[^a-zA-Z0-9_]/g, "");
}
@aaronsnoswell
aaronsnoswell / gist:3786176
Created September 26, 2012 05:00
Android Webkit <input type="number" /> shim.
// jQuery version
$("input[type='number']").each(function(i, el) {
el.type = "text";
el.onfocus = function(){this.type="number";};
el.onblur = function(){this.type="text";};
});
// Stand-alone version
(function(){ var elms = document.querySelectorAll("input"), i=elms.length;
@aaronsnoswell
aaronsnoswell / screen_record.sh
Created July 9, 2012 07:19
Easy Linux Screen Capture
#!/bin/bash
while :
do
import -window root "png:/home/aaron/Pictures/screen_capture/`date +%Y_%m_%d-%H:%M:%S`.png"
echo "Saved `date +%Y_%m_%d-%H:%M:%S`.png";
sleep 30
done
@aaronsnoswell
aaronsnoswell / gist:1876320
Created February 21, 2012 12:42
Better Canvas Perlin Noise
// l33t codes go here
var canvas = document.querySelector("#canvas"),
ctx = canvas.getContext("2d");
/**
* The general idea with perlin noise is to generate
* noise at several resolutions and overlay them
* with varying amplitudes and opacities.
*
@aaronsnoswell
aaronsnoswell / gist:1873849
Created February 21, 2012 04:58
Canvas Perlin Noise Generator
// l33t codes go here
var canvas = document.querySelector("#canvas"),
ctx = canvas.getContext("2d");
var randcache = [];
function noise(x, y) {
/*
var n = (x) + (y*57);