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
#!/usr/bin/env python3 | |
"""Commands: | |
help Print this message | |
print Print chaos bag contents and relevant odds | |
add [<token> ...] Add the listed token(s) to the chaos bag | |
remove [<token> ...] Remove the listed token(s) from the chaos bag | |
set <token> <modifier> Sets the modifier value for the provided token | |
reset Reset the bag to its default state (empty) | |
load Load the bag state from a backup file (WIP) | |
exit Quits |
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 __name__ == "__main__": | |
for a in range(1,10): | |
for b in range(1,10): | |
if b in [a]: | |
continue | |
for c in range(1,10): | |
if c in [a,b]: | |
continue | |
for d in range(1,10): | |
if d in [a,b,c]: |
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
Shader "ProcHexGridSurfShader" | |
{ | |
Properties | |
{ | |
_Color ("Color", Color) = (1,1,1,1) | |
_AlbedoMaps("Albedo (RGB)", 2DArray) = "white" {} | |
_Glossiness("Smoothness", Range(0,1)) = 0.5 | |
_Metallic("Metallic", Range(0,1)) = 0.0 | |
_HexScale("Hex Scale", Range(0,1)) = 1.0 | |
} |
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
/// The goal here is to have some processing in one set of entities (the parents) whose results need to | |
/// be consumed by a different set of entities (the children), where it's not possible to iterate over both | |
/// sets simultaneously. | |
/// In this specific example, each parent entity has two unique child entities. | |
/// Different approaches would be necessary for one-to-many relationships, many-to-many relationships, etc. | |
/// | |
/// NB I've never actually compiled this code; there may be minor errors due to typos or API changes. | |
struct ParentData : IComponentData | |
{ | |
Entity child1; |
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
// g++ -std=c++11 -o permute permute.cpp | |
#include <assert.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <time.h> | |
const int kElemCount = 1024*1024; | |
const int kOutElemCount = kElemCount; | |
static_assert(kOutElemCount <= kElemCount, "can't output more than input"); |
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
REM Variables: Release/Debug, VS version, VS arch, path to python? | |
IF NOT EXIST Vulkan-Headers ( | |
git clone https://github.com/KhronosGroup/Vulkan-Headers.git | |
) | |
IF NOT EXIST glslang ( | |
git clone https://github.com/KhronosGroup/glslang.git | |
) | |
REM Update Vulkan-Headers & dependencies to known-good revisions and build |
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
struct CpuGpuTimestampInfo { | |
VkDevice device; | |
VkQueue queue; | |
uint32_t queue_family_index; | |
float timestamp_period; // Copy from VkPhysicalDeviceLimits::timestampPeriod | |
uint32_t timestamp_valid_bits; // Copy from VkQueueFamilyProperties::timestampValidBits | |
}; | |
VkResult GetCpuGpuTimestamp(const CpuGpuTimestampInfo *info, | |
std::chrono::high_resolution_clock::time_point *out_cpu_time, uint64_t *out_gpu_time) { | |
if (info->timestamp_valid_bits == 0) { |
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
# These blocks go in .config/QtProject/QtCreator.ini. | |
# Not storing the file here due to potentially sensitive contents in file/search history. | |
[KeyboardShortcuts] | |
Coreplugin.OutputPane.nextitem=F4 | |
CppEditor.FindUsages=Alt+Shift+F | |
CppEditor.RenameSymbolUnderCursor=Alt+Shift+R | |
CppTools.SwitchHeaderSource=Alt+O | |
Debugger.AttachToRemoteServer=Ctrl+F5 | |
Find.Dialog=Alt+Shift+S |
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
; How to render a cube using a single 14-index triangle strip | |
; (Reposted from http://www.asmcommunity.net/forums/topic/?id=6284#post-45209) | |
; Drawbacks: no support for per-vertex normals, UVs, etc. | |
; | |
; 1-------3-------4-------2 Cube = 8 vertices | |
; | E __/|\__ A | H __/| ================= | |
; | __/ | \__ | __/ | Single Strip: 4 3 7 8 5 3 1 4 2 7 6 5 2 1 | |
; |/ D | B \|/ I | 12 triangles: A B C D E F G H I J K L | |
; 5-------8-------7-------6 | |
; | C __/| |
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
/** | |
* Handy meta-macro to simplify repetitive error checking for APIs where every function returns | |
* an error code (e.g. CUDA, C11 threads, most of the Windows API, etc.) | |
* | |
* Example usage: | |
* #define CUDA_CHECK(expr) RETVAL_CHECK(cudaSuccess, expr) | |
* ... | |
* CUDA_CHECK( cudaMemcpy(dst, src, size, cudaMemcpyHostToDevice) ); | |
* | |
* To disable the checks in release builds, just redefine the macro: |
NewerOlder