Skip to content

Instantly share code, notes, and snippets.

View byBretema's full-sized avatar
🎨
I make computers draw things!

Daniel Brétema byBretema

🎨
I make computers draw things!
View GitHub Profile
@byBretema
byBretema / ootb_timer.hpp
Last active January 20, 2021 10:14
Timer Snippet - OOTB
#include <iostream>
#include <string>
#include <chrono>
using Clock = std::chrono::high_resolution_clock;
class Timer {
public:
Timer(std::string const & msg = "") : m_msg(msg), m_iTime(Clock::now()) {}
@byBretema
byBretema / unity_DebugUVs.shader
Created April 25, 2020 18:24
Quick shader to debug texture coordinates of a given mesh
Shader "Custom/DebugUVs" {
SubShader {
Pass {
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
struct v2f {
float4 pos : SV_POSITION;
@byBretema
byBretema / macOsKBforWindows.ahk
Created May 18, 2020 17:42
Emulate OSX keymap layout on Windows
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
#SingleInstance force ; Allow only one instance of this script.
; --------------------------------------------------------------------------------
;
; === NOTES ===
;
; Emulate OSX keymap layout on Windows
@byBretema
byBretema / custom_ohmyposh_ZashTheme.psm1
Created June 8, 2020 09:52
Custom theme for ohmyposh module based on Zash
#requires -Version 2 -Modules posh-git
function Write-Theme {
param(
[bool]
$lastCommandFailed,
[string]
$with
)
@byBretema
byBretema / Microsoft.PowerShell_profile.ps1
Created August 17, 2020 07:34
Microsoft PowerShell Profile
# Write with <3 by Dac (@cambalamas)
Import-Module posh-git
Import-Module oh-my-posh
Set-Theme Zash
# ENV
$PERSONALPATH = "${env:SystemDrive}\dac"
$DEVPATH = "$PERSONALPATH\dev"
$env:PATH += ";`
<?xml version="1.0" encoding="UTF-8"?>
<style-scheme version="1.0" name="Monokai">
<style name="Text" foreground="#e6e5e2" background="#0b0c0a"/>
<style name="Link" foreground="#66d9ef"/>
<style name="Selection" foreground="#e6e5e2" background="#49483e"/>
<style name="LineNumber" foreground="#a0a19c" background="#272822"/>
<style name="SearchResult" foreground="#ffffff" background="#2572b8"/>
<style name="SearchResultAlt1" foreground="#000033" background="#b6ccff"/>
<style name="SearchResultAlt2" foreground="#330000" background="#ffb6cc"/>
<style name="SearchScope" foreground="#000000" background="#e2efff"/>
@byBretema
byBretema / .clang-format
Last active February 12, 2021 01:49
My preferences on CPP formatting
---
BasedOnStyle: Mozilla
AccessModifierOffset: '0'
AlignAfterOpenBracket: AlwaysBreak
AlignConsecutiveMacros: 'true'
AlignConsecutiveAssignments: 'true'
AlignConsecutiveDeclarations: 'true'
AlignEscapedNewlines: Left
AlignOperands: 'true'
AlignTrailingComments: 'true'
@byBretema
byBretema / compile_assimp.md
Created September 13, 2021 11:24
command line assimp compilation
# For Windows
cmake .. -D ASSIMP_BUILD_FRAMEWORK:BOOL=OFF -D ASSIMP_INSTALL:BOOL=OFF -D ASSIMP_BUILD_TESTS:BOOL=OFF -D ASSIMP_BUILD_ASSIMP_TOOLS:BOOL=OFF -D ASSIMP_NO_EXPORT:BOOL=ON
# For Linux
cmake .. -D CMAKE_CXX_FLAGS_DEBUG="-O0 -g3 -ggdb -Wall -Wpedantic -Wextra -Wweak-vtables -fexceptions" -D CMAKE_CXX_FLAGS_RELEASE="-Ofast" -D ASSIMP_BUILD_FRAMEWORK:BOOL=OFF -D ASSIMP_INSTALL:BOOL=OFF -D ASSIMP_BUILD_TESTS:BOOL=OFF -D ASSIMP_BUILD_ASSIMP_TOOLS:BOOL=OFF -D ASSIMP_NO_EXPORT:BOOL=ON
function(COPY_FROM_TO_DIR src_dir dst_dir)
file(GLOB src_files ${src_dir}/*)
foreach(src_file IN LISTS src_files)
get_filename_component(file_and_ext ${src_file} NAME)
set(dst_file ${dst_dir}/${file_and_ext})
# MESSAGE(STATUS "[[[COPY_FROM_TO_DIR]]] :\n * ${src_file}\n * ${dst_file}")
# add_custom_command(COMMAND ${CMAKE_COMMAND} -E make_directory ${dst_dir} OUTPUT ${dst_dir})
add_custom_command(
TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${src_file} ${dst_file}
#pragma once
#include <chrono>
#include <functional>
#include <string>
#include <iostream>
#include <cstdint>
class DCTimer
{