Skip to content

Instantly share code, notes, and snippets.

Jack Mott jackmott

Block or report user

Report or block jackmott

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jackmott
jackmott / main.rs
Last active Sep 9, 2019
chunk noise example
View main.rs
use minifb::{Key, Window, WindowOptions};
use simdnoise::NoiseBuilder;
use std::{thread, time};
const WIDTH: usize = 640;
const HEIGHT: usize = 640;
fn main() {
let mut buffer: Vec<u32> = vec![0; WIDTH * HEIGHT];
@jackmott
jackmott / ShaderManager.cs
Created Mar 13, 2017
Hot Swappable Shaders for MonoGame
View ShaderManager.cs
/*
HotSwap shader sytem for MonoGame
HotSwap code only exists for debug builds
Edit paths to match your project
Construct in your Initialize method
Add shaders in LoadContent (or whenever)
Call CheckForChanges in Update() or periodically however you like
mgcb.exe usually located in C:\Program Files (x86)\MSBuild\MonoGame\v3.0\Tools
*/
@jackmott
jackmott / SIMDStarterKit.h
Last active Aug 14, 2019
A header file to make SIMD intrinsics a bit easier to work with
View SIMDStarterKit.h
// A header file to get you set going with Intel SIMD instrinsic programming.
// All necessary header files are inlucded for SSE2, SSE41, and AVX2
// Macros make the intrinsics easier to read and generic so you can compile to
// SSE2 or AVX2 with the flip of a #define
#define SSE2 //indicates we want SSE2
#define SSE41 //indicates we want SSE4.1 instructions (floor and blend is available)
#define AVX2 //indicates we want AVX2 instructions (double speed!)
@jackmott
jackmott / sdl2.go
Created Jan 15, 2018
Games With Go EP06 OSX fix
View sdl2.go
package main
// Experiment! draw some crazy stuff!
// Gist it next week and I'll show it off on stream
import (
"fmt"
"github.com/veandco/go-sdl2/sdl"
)
@jackmott
jackmott / simplex.go
Created Jan 21, 2018
simplex noise in go
View simplex.go
/* This code ported to Go from Stefan Gustavson's C implementation, his comments follow:
* https://github.com/stegu/perlin-noise/blob/master/src/simplexnoise1234.c
* SimplexNoise1234, Simplex noise with true analytic
* derivative in 1D to 4D.
*
* Author: Stefan Gustavson, 2003-2005
* Contact: stefan.gustavson@liu.se
*
*
* This code was GPL licensed until February 2011.
@jackmott
jackmott / duconverter
Created Mar 7, 2019
newtonsoft json DU converter
View duconverter
namespace AlphaFront
module JsonCustomConverters =
open Newtonsoft.Json
open Microsoft.FSharp.Reflection
open System
open System.IO
type DuConverter() =
inherit JsonConverter()
@jackmott
jackmott / pqueue.cs
Created Feb 3, 2019
priority queue in c#
View pqueue.cs
using System.Collections.Generic;
using System.Linq;
namespace FB
{
public class PQueue<T>
{
private SortedDictionary<float, Stack<T>> sdict;
View keybase.md

Keybase proof

I hereby claim:

  • I am jackmott on github.
  • I am jackmott (https://keybase.io/jackmott) on keybase.
  • I have a public key whose fingerprint is DE51 EA3B 8EFA E93E 229C C013 2C5A AAC6 CAD9 92F8

To claim this, I am signing this object:

@jackmott
jackmott / thread.cs
Created Jan 10, 2019
What could be thread unsafe about this?
View thread.cs
// When this function runs in my program on multiple threads, memory corruption eventually happens
// When it doesn't run, or runs on only 1 thread, no problems
// I can't see what could be thread unsafe about it, am I missing something?
public static float SingleCellular2EdgeSimple(float x, float y, float jitter, int seed)
{
int xr = (x >= 0) ? (int)(x + 0.5f) : (int)(x - 0.5f);
int yr = (y >= 0) ? (int)(y + 0.5f) : (int)(y - 0.5f);
float[] distance = { 999999f, 999999f, 999999f, 999999f };
@jackmott
jackmott / ast.fs
Created Dec 17, 2018
AST Cleaned Up
View ast.fs
open System
type ASTNode =
| Add of (ASTNode * ASTNode)
| Sub of (ASTNode * ASTNode)
| X
| Constant of int
let rec Evaluate node x =
match node with
You can’t perform that action at this time.