This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// An array-based ring buffer. The internal array can be accessed directly if needed. | |
/// </summary> | |
public class ArrayRingBuffer<T> : IEnumerable<T> { | |
public readonly T[] array; | |
private int startingIndex = 0; | |
private int count; | |
public ArrayRingBuffer(int size, T defaultValue) { | |
array = new T[size]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://sites.google.com/site/indy256/algo_cpp/bigint |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pkg load linear-algebra | |
# Initial Conditions | |
pc = [2,3]; #target pos | |
pb = [12,-2]; #bullet pos | |
vc = [7,3].*(1/3); #target vel | |
sb = 2.8480; #bullet speed | |
tolerance = 0.1; #search tolerance | |
# Routines |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace Common | |
{ | |
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Reflection; | |
using UnityEngine; | |
public static class ServiceLocator | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static int[] KMeansCluster(int clusterCount, float3[] data, int maxIterations = 1000) | |
{ | |
if (clusterCount <= 0) | |
{ | |
return new int[0]; | |
} | |
int[] countWithinClusters = new int[clusterCount]; | |
countWithinClusters.Fill(0); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
#include <assert.h> | |
namespace oats { | |
template <class T> | |
struct dynamic_array { | |
T * arr; | |
dynamic_array(); | |
dynamic_array(const int initial_capacity); | |
~dynamic_array(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)' | |
Shader "Vertex Colors Only" { | |
Properties{ | |
} | |
SubShader{ | |
Tags { "RenderType" = "Opaque" } | |
LOD 200 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <fstream> | |
#include <string> | |
// convert 2D coordinates to 1D array index | |
int flat_idx(const int row, const int col, const int row_length) | |
{ | |
return (row * row_length) + col; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/usr/bin/setxkbmap -option "caps:swapescape" |