Skip to content

Instantly share code, notes, and snippets.

⚙️
Keeping the commit streak alive

Tommy Ettinger tommyettinger

Block or report user

Report or block tommyettinger

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
@tommyettinger
tommyettinger / warm-mild.frag.glsl
Created Apr 25, 2019
Fragment Shader for YCwCm warm-and-mild color tweaks
View warm-mild.frag.glsl
// this is a libGDX ShaderBatch fragment shader; it may need some tweaks to fit in other frameworks.
// You can use this to desaturate colors by setting `u_mul` to `vec3(1.0, 0.5, 0.5)` or any other small fractions for Cw and Cm. You
// can make colors warmer by setting `u_add` to `vec3(0.0, 0.6, 0.0)`; while warmth is added, randomly setting the added Cm to a
// value between -0.5 and 0.5 can simulate a fiery color effect over the screen. You can make an icy effect by setting `u_add` to
// `vec3(0.3, -0.4, 0.0)`. You can simulate the desaturation and yellowing that happens to old paintings by setting `u_mul` to
// `vec3(0.9, 0.7, 0.75)` and `u_add` to `vec3(0.05, 0.14, 0.16)`. Many other effects are possible by changing warmth and/or mild over
// multiple frames, usually smoothly and usually applying the change to the additive uniform.
varying vec2 v_texCoords;
varying vec4 v_color;
@tommyettinger
tommyettinger / DawnBringer_Aurora.hex
Created Dec 4, 2018
DawnBringer Aurora .hex palette, 256 colors
View DawnBringer_Aurora.hex
000000
111111
222222
333333
444444
555555
666666
777777
888888
999999
View Linnorm.java
public final class Linnorm {
private static long state = 0L;
private static long random()
{
long z = (state = state * 0x41C64E6DL + 1L);
z = (z ^ z >>> 28) * 0xAEF17502108EF2D9L;
return z ^ z >>> 30;
}
public static void main(String[] args) {
long out = 0L;
@tommyettinger
tommyettinger / WFC.txt
Created Mar 29, 2018
MimicWFC output, repeated twice in each direction
View WFC.txt
.........│..│....┌┘│..........└┘..................│....│.......│.........│..│....┌┘│..........└┘..................│....│.......│
.........│..│...┌┘ │.......................│......│....│.......│.........│..│...┌┘ │.......................│......│....│.......│
.........│..│..┌┘ │.......................├─┐...............┌─┤.........│..│..┌┘ │.......................├─┐...............┌─┤
─┐..│.......│..└──┐└───────────────────────┘ └┐...........┌──┘ └─┐..│.......│..└──┐└───────────────────────┘ └┐...........┌──┘ └
│..├─┐...........│┌──────────────────────────┴─.........─┤ │..├─┐...........│┌──────────────────────────┴─.........─┤
└──┘ └┐..........││...............................┌┐.....│ └──┘ └┐..........││...............................┌┐.....│
───────┴──────────┤│..............................┌┘└─┐...└────────────┴──────────┤│..............................┌┘└─┐...└─────
...............,,.│└┐.............................│ └┐.......................,,.│└┐.............................│ └┐.
@tommyettinger
tommyettinger / LightRNG_Tests.txt
Created Feb 16, 2018
Testing parameterless constructor for LightRNG
View LightRNG_Tests.txt
Format: After each two lines of results, a new LightRNG
is produced with the parameterless constructor.
Initial state : first boolean produced
State after that : second boolean produced
7E005BA92C3B2C00 : false
1C37D562AB85A815 : true
378D3F4B434B6C00 : false
@tommyettinger
tommyettinger / LanguageOutput.txt
Created Dec 29, 2017
SquidLib's FakeLanguageGen class produces imitations of various languages, like this.
View LanguageOutput.txt
Imitating language: "Lovecraft":
Zvrun yip ugh, ti.
Eivrachtal aikrairl eng, keila ixek nyomring.
Shupap thax thun seil nyik hmeiha...
Iarlogrek; aalta as nyark akas?
Lu-ul up hmeits; kegg.
Nal glais cthigruk ok tunde?
Kiglokh, aitsirlel yai ias kax.
@tommyettinger
tommyettinger / mulberry32.c
Last active Mar 31, 2019
Mulberry32 PRNG
View mulberry32.c
/* Written in 2017 by Tommy Ettinger (tommy.ettinger@gmail.com)
To the extent possible under law, the author has dedicated all copyright
and related and neighboring rights to this software to the public domain
worldwide. This software is distributed without any warranty.
See <http://creativecommons.org/publicdomain/zero/1.0/>. */
#include <stdint.h>
@tommyettinger
tommyettinger / thrust.c
Last active Nov 1, 2017
Thrust Pseudo-Random Number Generator
View thrust.c
/* Written in 2017 by Tommy Ettinger (tommy.ettinger@gmail.com)
To the extent possible under law, the author has dedicated all copyright
and related and neighboring rights to this software to the public domain
worldwide. This software is distributed without any warranty.
See <http://creativecommons.org/publicdomain/zero/1.0/>. */
#include <stdint.h>
@tommyettinger
tommyettinger / $_$.java
Created Oct 11, 2017
Dollar Eyes Dot Java
View $_$.java
/*
MIT License
Copyright (c) 2017 Tommy Ettinger
Based on lz-string4java, which is:
Copyright (c) 2016 rufushuang
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@tommyettinger
tommyettinger / RandomUtils.java
Created Jul 9, 2017
Tiny Java utilities for generating high-quality random int values from a large state array
View RandomUtils.java
public class RandomUtils
{
/**
* Generates a state array for use with {@link #randomInt(int[])}; this state array will be random using {@code Math.random()}.
* @return a 129-element int array with contents randomized by {@code Math.random()}
*/
public static int[] initialState()
{
final int[] state = new int[129];
for(int i = 0; i < 129; i++)
You can’t perform that action at this time.