This file contains hidden or 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
/** | |
* A simple timer library, with a thread-safe sample accumulator. | |
* | |
* Basic usage: | |
* using TinyTimer::Timer; | |
* Timer timer; | |
* // .. do something | |
* cout << "Something took " << timer.elapsed() << " seconds" << endl; | |
* | |
* One can also consolidate several timings to measure standard deviation: |
This file contains hidden or 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 bpy | |
class IconPanel(bpy.types.Panel): | |
"""Creates a Panel width all possible icons""" | |
bl_label = "Icons" | |
bl_idname = "icons_panel" | |
bl_space_type = 'PROPERTIES' | |
bl_region_type = 'WINDOW' | |
bl_context = "object" |
This file contains hidden or 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
// Javascript view builder to interpret raw ArrayBuffer data as structured data. | |
// Copyright 2024 (c) Élie Michel - MIT Licensed | |
// NB: This is loosly inspired by https://github.com/kainino0x/structured-accessor | |
const kTypedArrayConstructors = { | |
i8: Int8Array, | |
u8: Uint8Array, | |
i16: Int16Array, | |
u16: Uint16Array, | |
i32: Int32Array, |
This file contains hidden or 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 struct | |
import os | |
# Parameter | |
archive = "vivfox.mview" | |
def readCString(f): | |
"""This is the most naive implementation possible, don't use in prod""" | |
str = "" | |
c = f.read(1) |
This file contains hidden or 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
# This is an automation of https://stackoverflow.com/questions/71783590/git-merge-strategy-option-theirs-for-individual-files | |
# Example: | |
# git_resolve.py --theirs path/to/some/file | |
import os | |
import argparse | |
from shutil import copyfile | |
import subprocess | |
parser = argparse.ArgumentParser(description='Resolve conflicted areas of a file during a git merge') |
This file contains hidden or 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
/* | |
(Built: Mon, Sep 24, 2018 4:38:25 PM) | |
Marmoset Viewer Code and Tools | |
Copyright (c) 2018 Marmoset LLC. | |
All rights reserved. | |
Redistribution and use of this software are permitted provided | |
that the software remains whole and unmodified and this copyright | |
notice remains attached. Use or inclusion of any portion of this |
This file contains hidden or 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
""" | |
An efficient numpy implementation of GLSL packHalf2x16 and unpackHalf2x16. | |
Author: Elie Michel <elie.michel@exppad.com> | |
License: MIT - 2023 | |
""" | |
def packHalf2x16(x, y): | |
""" | |
Pack two floats into a single uint32, like GLSL's packHalf2x16 function | |
(but vectorized for numpy arrays). |
This file contains hidden or 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 struct | |
def readCString(f): | |
"""This is the most naive implementation possible, don't use in prod""" | |
str = "" | |
c = f.read(1) | |
while c != '\0': | |
str += c | |
c = f.read(1) | |
return str |
This file contains hidden or 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
#include "stb_image_write.h" | |
#include <webgpu/webgpu.hpp> | |
#include <filesystem> | |
#include <string> | |
bool saveTexture(const std::filesystem::path path, wgpu::Device device, wgpu::Texture texture, int mipLevel) { | |
using namespace wgpu; | |
This file contains hidden or 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
// Using https://github.com/eliemichel/WebGPU-Cpp | |
#include <webgpu/webgpu.hpp> | |
namespace raii { | |
class Buffer { | |
public: | |
// Whenever a RAII instance is created, we create an underlying resource | |
Buffer(wgpu::Device device, const wgpu::BufferDescriptor& bufferDesc) | |
: m_raw(device.createBuffer(bufferDesc)) | |
{} |
NewerOlder