Skip to content

Instantly share code, notes, and snippets.

View Robadob's full-sized avatar

Robert Chisholm Robadob

View GitHub Profile
@Robadob
Robadob / randomcam.py
Last active October 14, 2023 16:45
This script allows webcam images to be captured at random intervals to create a timelapse video
import cv2 # opencv-python
from datetime import datetime, timedelta
import time
import random
import re
import argparse
class CamContext:
def __init__(self):
self.cam = cv2.VideoCapture(0)
@Robadob
Robadob / uniform_float_histogram.cu
Created February 10, 2023 18:55
Generate all 2^32 random uniform floats and place them on a histogram.
#include <algorithm>
#include "cuda_runtime.h"
#include "device_launch_parameters.h"
#include <cstdio>
#include <cstdint>
#include <fstream>
#include <limits>
@Robadob
Robadob / GenericArray.cuh
Last active July 29, 2020 12:42
Simple CUDA version of std::array
#include <cassert>
template<typename T, size_t N>
class GenericArray {
T buffer[N];
public:
__host__ __device__ GenericArray() {
memset(buffer, 0, N * sizeof(N));
}
@Robadob
Robadob / device_snprintf.cu
Last active July 24, 2020 11:48
Test of how we can return formatted string from device code.
#include <cstdint>
#include <cstring>
#include "cuda_runtime.h"
#include "device_launch_parameters.h"
#include <stdio.h>
struct FormatBuff {
%preamble
\usepackage{listings}
\usepackage{algorithm}
\usepackage{xcolor}
\lstdefinestyle{xml} {
language=XML,
extendedchars=true,
breaklines=true,
breakatwhitespace=true,
emph={},
@Robadob
Robadob / easing.hpp
Last active May 6, 2018 09:07
glm gtx_easing proposal
/// @ref gtx_easing
/// @file glm/gtx/easing.hpp
///
/// @see core (dependence)
///
/// @defgroup gtx_easing GLM_GTX_easing
/// @ingroup gtx
///
/// Include <glm/gtx/easing.hpp> to use the features of this extension.
///
import java.awt.Point;
import java.lang.Math;
import java.util.Scanner;
import java.io.File;
class Robot
{
enum Direction
{
N('N', 0,1),
E('E', 1,0),
@Robadob
Robadob / 3DGeometry.h
Last active May 11, 2023 06:43
3D Geometry Functions
#ifndef __3DGeometry_h__
#define __3DGeometry_h__
#include <glm/glm.hpp>
/**
* Returns the closest point on a given infinite line to a given point
**/
glm:vec3 closestPointOnLine(const glm::vec3 &line1, const glm::vec3 &line2, const glm::vec3 &point)
{//https://forum.unity3d.com/threads/how-do-i-find-the-closest-point-on-a-line.340058/#post-2198950
@Robadob
Robadob / lsfm.js
Last active September 21, 2017 14:33
Last FM Scrobble Purge - Deletes all scrobbles from a page of https://www.last.fm/user/<username>/library?page=1
/*! jQuery v1.11.1 | (c) 2005, 2014 jQuery Foundation, Inc. | jquery.org/license */
!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=c.slice,e=c.concat,f=c.push,g=c.indexOf,h={},i=h.toString,j=h.hasOwnProperty,k={},l="1.11.1",m=function(a,b){return new m.fn.init(a,b)},n=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,o=/^-ms-/,p=/-([\da-z])/gi,q=function(a,b){return b.toUpperCase()};m.fn=m.prototype={jquery:l,constructor:m,selector:"",length:0,toArray:function(){return d.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:d.call(this)},pushStack:function(a){var b=m.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return m.each(this,a,b)},map:function(a){return this.pushStack(m.map(this,function(b,c){return a.call(b,c,b)}))},sl
#include <cuda.h>
#include <cuda_runtime.h>
#include <device_launch_parameters.h>
//#include <cuda_gl_interop.h>
#include "FLAMEGPU.h"
#include <cstdio>
#include "header.h"
//#include "visualisation/GlobalsController.h"
#include "navigationhost.h"