Skip to content

Instantly share code, notes, and snippets.

@zanders3
zanders3 / allrgb.cpp
Last active May 16, 2020 07:07
A rainbow rendering of the mandelbrot set. This created by sorting every colour by Hue, then randomly shuffling each set of pixels that share the same iteration in the fractal via histogram generation. Posted on http://allrgb.com/rainbow-fractal.
// AllRGB.cpp
// Calculates an image containing every RGB color
// once and once only in a vague mandelbrot kind of shape.
// To use:
// gcc allrgb.cpp
// ./a.out > allrgb.ppm
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
@zanders3
zanders3 / bf.c
Last active August 29, 2015 14:22
A BF interpreter in C with some dumb optimisations
//Compile with: gcc bf.c -o bf -O3 && ./bf mandelbrot.bf
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int opCount(char** pt, char v) {
int opCount = 0;
char* p = *pt;
while (*(*pt) == v) {
opCount++;
@zanders3
zanders3 / MeshProxy.cs
Created April 20, 2016 08:10
Unity Optimisation Tools
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
public class MeshProxy
{
public List<Vector3> Vertices = new List<Vector3>();
public List<Vector3> Normals = new List<Vector3>();
public List<Vector2> UVs = new List<Vector2>();
public List<int> Tris = new List<int>();
@zanders3
zanders3 / poem.js
Created June 9, 2016 21:54
poem.js
//poem.js
var words = [
//concrete nouns 1
["sea","room","king","snake","star","balloon","watchman","mouth","window","square","nightgown","ear","rose","wall","night","moth","mirror","wind","hand","mother","cloud","statue","museum","shadow","echo","orange","creature","whisker",
"paw",
"hoof",
"tail",
"wing",
"antler",
"beak",
<html>
<body>
<textarea id="printContent"></textarea>
<input type="submit" onclick="connectAndPrint()" value="Print"/>
<ul>
<li>Needs <a href="chrome://flags/#enable-experimental-web-platform-features">Experimental Web Platform Features</a></li>
<li>Needs <a href="chrome://flags/#enable-webusb">Web USB</a></li>
</ul>
<script>
var device;
@zanders3
zanders3 / ShipLayout.cs
Created May 11, 2019 21:48
Space Engineers ship layout script
// ShipLayout by zanders3
// This script displays the layout and health status of your ship or station.
// To use run this script and add e.g. 'ShipLayout 0' or 'ShipLayoutHealth' to the CustomData of an LCD.
public Program() {
Runtime.UpdateFrequency = UpdateFrequency.Update100;
}
public delegate Vector3I RotateFunc(Vector3I pos, Vector3I size);
static Vector3I Rot1(Vector3I pos, Vector3I size) { return new Vector3I(size.Y - pos.Y, pos.X, pos.Z); }