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
# Sierpinski carpet generator, in Python using Numpy and Pillow. | |
# Written by Nathan Reed, June 2014. | |
# This code is released into the public domain. | |
import numpy as np | |
from PIL import Image | |
numLevels = 6 | |
imageSize = 3**numLevels |
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
I went to see the Hobbit in HFR 3D IMAX OMGWTF today. Movie verdict: 3 hours is too long to sit in | |
the theater. It's not necessarily too long for home viewing where you can get up and move around, | |
or pause the movie and take a break, but it's too long for the theater. That said, it's a well-made | |
film and PJ keeps the story moving along, so you'll be entertained, even if your eyes and butt are | |
sore as hell by the end of it! | |
Stereo 3D verdict: yep, I still hate it. Kill it with fire. Especially the parts where they flick | |
stuff at your face - it's such a stupid, cheap trick. | |
HFR verdict: really interesting experience. The picture is great - very clear and smooth and BRIGHT |
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
if (FAILED(D3D11CreateDevice( | |
NULL, | |
D3D_DRIVER_TYPE_HARDWARE, | |
NULL, | |
#if _DEBUG | |
D3D11_CREATE_DEVICE_DEBUG, | |
#else | |
0, | |
#endif | |
NULL, |
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
float beckmann1(float m : M, float NdotH : NDOTH) : SV_Target0 | |
{ | |
float oneOverMSquared = 1.0 / (m*m); | |
float NdotHSquared = NdotH * NdotH; | |
return exp((NdotHSquared - 1.0) / NdotHSquared * oneOverMSquared) * oneOverMSquared * (1.0 / 3.141592654) / (NdotHSquared * NdotHSquared); | |
} | |
mad r0.x, v0.y, v0.y, l(-1.000000) | |
mul r0.yz, v0.xxyx, v0.xxyx | |
div r0.x, r0.x, r0.z |
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
// ==UserScript== | |
// @name Letter Swapper | |
// @namespace reedbeta.com | |
// @version 1 | |
// @grant none | |
// @include * | |
// @exclude https://*.google.com/* | |
// ==/UserScript== | |
var swaps = |
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
<?php | |
/************************************************************************************* | |
* hlsl.php | |
* ----- | |
* Author: Nick Darnell (NickDarnell@gmail.com) | |
* Copyright: (c) 2010 Nick Darnell (NickDarnell@gmail.com) | |
* Release Version: 1.0 | |
* Date Started: 6/30/2010 | |
* | |
* HLSL language file for GeSHi. |
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
vec3 sRGBToLinear(vec3 rgb) | |
{ | |
// See https://gamedev.stackexchange.com/questions/92015/optimized-linear-to-srgb-glsl | |
return mix(pow((rgb + 0.055) * (1.0 / 1.055), vec3(2.4)), | |
rgb * (1.0/12.92), | |
lessThanEqual(rgb, vec3(0.04045))); | |
} | |
vec3 LinearToSRGB(vec3 rgb) | |
{ |
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
// Auto-releasing wrapper for COM pointers | |
// Feel free to use this for whatever, I don't care | |
template <typename T> | |
struct comptr | |
{ | |
T * p; | |
comptr(): p(nullptr) {} | |
comptr(T * other): p(other) | |
{ if (p) p->AddRef(); } |
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
# Tests for antialiasing a high-frequency image in various ways | |
# Nathan Reed, July 2014 | |
# Written for Python 3.4; requires numpy and Pillow to be installed | |
import concurrent.futures | |
import math | |
import multiprocessing | |
import numpy as np | |
import optparse | |
import random |
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
#pragma once | |
// Intrusive Linked List (or Internal Linked List, etc) | |
// by Nathan Reed, 2020-01-18. Licensed CC0 https://creativecommons.org/publicdomain/zero/1.0/ | |
// | |
// Use it like: | |
// | |
// class MyClass | |
// { | |
// ... |
OlderNewer