Skip to content

Instantly share code, notes, and snippets.

@TheBuzzSaw
TheBuzzSaw / VulkanDump.cpp
Created November 14, 2016 00:08
introductory headless Vulkan device data dump
#include <vulkan/vulkan.h>
#include <iostream>
#include <cassert>
using namespace std;
void DumpPhysicalDevice(VkPhysicalDevice physicalDevice)
{
VkPhysicalDeviceProperties properties;
vkGetPhysicalDeviceProperties(physicalDevice, &properties);
@TheBuzzSaw
TheBuzzSaw / Pile.cpp
Last active October 29, 2016 18:37
Full deck of 52 cards in 39 bytes (40 bytes if you include the count)
#include "Pile.hpp"
const char* GetValueName(int value)
{
switch (value)
{
case 2: return "Two";
case 3: return "Three";
case 4: return "Four";
case 5: return "Five";
@TheBuzzSaw
TheBuzzSaw / Morton.cpp
Last active August 24, 2016 22:02
Morton order
#include <iostream>
#include <iomanip>
#include <cstdint>
#include <SDL.h>
using namespace std;
constexpr uint32_t MortonXMask = 0x55555555;
constexpr uint32_t MortonYMask = MortonXMask << 1;
uint32_t OldPacked(uint32_t value)
@TheBuzzSaw
TheBuzzSaw / Money.cpp
Last active May 9, 2017 15:31
MONEYZ
#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include <algorithm>
#include <cstdint>
using namespace std;
struct Money
{

What being British means:

  • Being Bitish is about driving in a german car
  • to an Irish pub
  • for a belgian beer,
  • then on the way home, grab an Indian curry
  • or a Turkish kebab
  • to sit on a swedish sofa
  • to watch USA shows
  • on a Japanese TV.
@TheBuzzSaw
TheBuzzSaw / MatrixRace.cpp
Last active July 9, 2016 22:15
Race the matrix multiplication methods!
#include <ctime>
#include <cstring>
#include <iostream>
#include <vector>
#include <random>
using namespace std;
template<typename T> struct Matrix4x4
{
T v[16];
@TheBuzzSaw
TheBuzzSaw / SDL_Vulkan.cpp
Created February 22, 2016 07:08
WIP -- SDL2 + Vulkan sample program
#include <SDL.h>
#include <SDL_syswm.h>
#define VK_USE_PLATFORM_WIN32_KHR
#include <vulkan/vulkan.h>
#include <iostream>
#include <cassert>
using namespace std;
@TheBuzzSaw
TheBuzzSaw / valgrind.txt
Last active January 20, 2016 18:51
Valgrind run of Qt sample "shadereffects"
==29825== Memcheck, a memory error detector
==29825== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==29825== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright info
==29825== Command: ./shadereffects
==29825==
==29825== Conditional jump or move depends on uninitialised value(s)
==29825== at 0x1552B3AD: ??? (in /usr/lib/libgtk-x11-2.0.so.0.2400.29)
==29825== by 0x83F3243: ??? (in /usr/lib/libgobject-2.0.so.0.4600.2)
==29825== by 0x840DA45: g_signal_emit_valist (in /usr/lib/libgobject-2.0.so.0.4600.2)
==29825== by 0x840E5F4: g_signal_emit_by_name (in /usr/lib/libgobject-2.0.so.0.4600.2)
@TheBuzzSaw
TheBuzzSaw / TypicalTypo.cpp
Created January 15, 2016 21:18
Clang is nice.
#include <iostream>
using namespace std;
int main(int argc, char **argv)
{
int hello = 3;
cout << helo << endl;
return 0;
}
@TheBuzzSaw
TheBuzzSaw / tl2console.txt
Created January 13, 2016 23:23
Torchlight II console commands
CLS = Clears console history.
SETTIME time = Sets the time of day to time
SETTIMESCALE scale = Sets the timescale for time of day
ROOM = returns the room the player currently is in.
FPS = shows the frame rate and other information.
GOD = toggles god mode.
SPEED = Toggles additional speed for the character.
GODSPEED = Toggles both god and speed mode.
DAMAGE SHAPES = toggles damage shapes on and off.
AIFREEZE = toggles monsters AI to turn on and off.