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
import argparse | |
import os | |
import os.path | |
import sys | |
parser = argparse.ArgumentParser() | |
parser.add_argument("-p", "--port", type=int, help="Port to open for HTTP connections", default=80) | |
parser.add_argument("-d", "--dir", help="Root directory to serve", default=".") | |
args = parser.parse_args() |
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 python | |
# Usage: | |
# 1) Install the Python Twitter Tools (PTT) from http://mike.verdone.ca/twitter/ | |
# (or just "easy_install twitter"). | |
# 2) Run "twitter-follow -o blahblahblah" and follow the instructions to set up | |
# OAuth. This gives the twitter-follow script read-only access to your account. | |
# Technically, it doesn't even need to be *your* account that you authorize, | |
# since the script is only querying public follower information. | |
# 3) Modify the value of "my_handle" to the username of the Twitter user whose |
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: |
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
# 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
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
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
// 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
/// 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
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 | |
} |
OlderNewer