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 / defer.cpp
Last active October 25, 2023 20:43
C++ : Cloning Go Defer keyword functionality
// Check playground in: https://www.mycompiler.io/view/7pXriajivQt
#include <iostream>
#include <memory>
#include <functional>
//--- CONCAT ----------------------------------------------
#define detail_CONCAT(a, b) a##b
#define CONCAT(a, b) detail_CONCAT(a, b)
#--- NOT ADMIN
# . SCOOP
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
Invoke-Expression (new-object net.webclient).downloadstring('https://get.scoop.sh')
scoop install git gcc cmake make ninja openssh python sudo gow xming
#--- ADMIN
#pragma once
#include <chrono>
#include <functional>
#include <string>
#include <iostream>
#include <cstdint>
class DCTimer
{
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}
@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
@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'
<?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 / 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 += ";`
@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 / 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