Skip to content

Instantly share code, notes, and snippets.

View nicebyte's full-sized avatar
🐴
horsin around

nicebyte nicebyte

🐴
horsin around
View GitHub Profile
/* Trying to achieve better cache locality for 2d
* arrays using Morton order.
*
* compile with:
* gcc morton.c -O3 -lrt -mbmi2
*/
#define _POSIX_C_SOURCE 199309L
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
@nicebyte
nicebyte / dyn_arr.h
Last active January 23, 2024 00:10
dyn_arr
#pragma once
#define DYN_ARR_OF(type) struct { \
type *data; \
type *endptr; \
uint32_t capacity; \
}
#if !defined(__cplusplus)
#define decltype(x) void*
@nicebyte
nicebyte / shadertoy_lib.glsl
Last active June 26, 2019 12:51
frequently used routines for shadertoy
vec2 aspectCorrectedCoords(in vec2 fragCoord) {
vec2 uv = fragCoord/iResolution.xy;
vec2 xy = uv * 2.0 - 1.0;
xy.x *= iResolution.x / iResolution.y;
return xy;
}
float nearPlaneDist(in float verticalFovDegrees) {
return 1.0 / tan(radians(verticalFovDegrees/2.0));
}
@nicebyte
nicebyte / udl.ahk
Created April 14, 2021 03:36
Authohotkey script to download audio from the youtube video in the current tab.
; Extracts audio from the youtube video in the current tab.
; Requires youtube-dl and ffmpeg.
; Download location.
DownloadDir := "d:\\music\\dump"
; Hotkey that triggers the script (Win+Z).
#Z::
@nicebyte
nicebyte / gist:8de116f4eb0bc6dc71a4f89ac440ae28
Last active September 25, 2021 17:48
Make tinyobj::index_t from tinyobjloader hashable
#include <unordered_map>
#define TINYOBJLOADER_IMPLEMENTATION
#include "tiny_obj_loader.h"
namespace tinyobj {
bool operator==(const index_t& lhs, const index_t& rhs) {
return
lhs.vertex_index == rhs.vertex_index &&
@nicebyte
nicebyte / less-ugly-doxygen
Created February 21, 2022 01:00
CSS to make Doxygen output look less retro
body { max-width: 120ch; margin-left:auto; margin-right: auto;}
.memtitle { background-image: none }
.fieldtable th {background-image: none }
.sm-dox { background-image: none; background: #f9fafc }
h1.groupheader{ border-bottom: none; }
h2.groupheader{ border-bottom: none; }
h3.groupheader{ border-bottom: none; }
div.header { background-image: none; background: inherit; border-bottom: none; }
#titlearea { padding-bottom: 18pt }
div.header { margin-top: 8pt }
syntax on
colorscheme peachpuff
colorscheme whisper
set tabstop=2
set shiftwidth=2
set expandtab
set smartindent
set nu
set guioptions -=m
set guioptions -=T
" Name: quiet
" Description: A mostly monochrome colorscheme, with a few niceties.
" Author: Maxence Weynans <neutaaaaan@gmail.com>
" Maintainer: Maxence Weynans <neutaaaaan@gmail.com>
" Website: https://github.com/vim/colorschemes
" License: Vim License (see `:help license`)`
" Last Updated: Wed 15 Mar 2023 06:45:06 PM CET
" Generated by Colortemplate v2.2.0