This file contains 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 float[] Downsample(float[] array, int Length) | |
{ | |
int insert = 0; | |
float[] window = new float[Length]; | |
float[] window_x = new float[Length]; | |
int bucket_size_less_start_and_end = Length - 2; | |
float bucket_size = (float)(array.Length - 2) / bucket_size_less_start_and_end; | |
int a = 0; | |
int next_a = 0; |
This file contains 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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
namespace YOUR_NAMESPACE_HERE_BRO | |
{ | |
static class Ease | |
{ | |
public static float LINEAR(float CurrentStep, float TotalSteps, float StartValue, float ValueChange) |
This file contains 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
window.onerror = function (msg, url, lineno) { | |
alert(url + '(' + lineno + '): ' + msg); | |
} | |
function createShader (str, type) { | |
var shader = gl.createShader(type); | |
gl.shaderSource(shader, str); | |
gl.compileShader(shader); | |
if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) | |
throw gl.getShaderInfoLog(shader); |
This file contains 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> | |
/// Use: | |
/// 1. Create a new instance of the ease class where steps are time, and values are | |
/// the value you want to ease over that time. | |
/// For example moving 100 pixels in 3 seconds: | |
/// | |
/// Ease myEase = new Ease | |
/// ( | |
/// currentStep: 0f, | |
/// totalSteps: 3f, |
This file contains 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
<html> | |
<div align = 'center'> | |
<canvas | |
id = 'c' | |
width = '800' | |
height = '600' | |
style = 'border:1px solid #000000;'> | |
</canvas> | |
<script> |
This file contains 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
const args = process.argv.slice(2); | |
const crypto = require('crypto'); | |
const algorithm = 'aes-256-ctr'; | |
const password = 'seelflix'; | |
const fs = require('fs'); | |
const path = require('path'); | |
function read_dir (dir) { | |
return fs.statSync(dir).isDirectory() ? Array.prototype.concat(...fs.readdirSync(dir).map(f => read_dir(path.join(dir, f)))) : dir; | |
}; |
This file contains 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
sudo apt-get update | |
sudo apt-get install python3.6 | |
sudo apt install python3-pip | |
sudo apt-get -y install cmake | |
sudo apt install zlib1g-dev | |
sudo apt-get install p7zip-full | |
pip3 install numpy | |
pip3 install sklearn | |
pip3 install gym | |
pip3 install gym[Box2D] |
This file contains 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
positive_width = 185; | |
positive_length = 370; | |
positive_thick = 3; | |
lip_height = 3; | |
lip_width = 3; | |
negative_oversize = 3; | |
double_negative_oversize = 3; | |
module positive() |
This file contains 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
// based on http://msdn.microsoft.com/en-us/magazine/hh335067.aspx | |
// usage example at bottom | |
function pso (number_of_dimensions, function_to_optimize, number_of_particles, number_of_iterations, fitness_threshold, inertia_weight, cognitive_weight, social_weight) { | |
var particles = []; | |
var swarm_best_position = []; | |
var swarm_best_fitness = null; | |
for (var p = 0; p < number_of_particles; p++) { | |
particles.push({ | |
particle_position: [], |
This file contains 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
<!DOCTYPE html> | |
<html> | |
<canvas id="c" width="128" height="128"></canvas> | |
<script src="glutil.js"></script> | |
<script id="vshader" type="text/plain"> | |
attribute vec2 vtxpos; | |
varying vec2 texpos; | |
void main() { | |
texpos = (vtxpos / 2.) + vec2(0.5, 0.5); | |
gl_Position = vec4(vtxpos, 0, 1); |
NewerOlder