Skip to content

Instantly share code, notes, and snippets.

View alifarazz's full-sized avatar
🐉

Ali Farazdaghi alifarazz

🐉
View GitHub Profile
@rokups
rokups / CMakeLists.txt
Last active May 11, 2024 07:29
Dear ImGui CMake build script.
#
# CMake build system for Dear ImGui
# =================================
#
# Build instructions:
# 1. Install latest CMake
# * Windows: https://cmake.org/download/ (Tick checkbox to place cmake in system PATH)
# * Linux: from your favorite package manager
# * MacOS: brew install cmake
# 2. Open command prompt in directory containing "imgui" and "imgui_dev" folders
@spiermar
spiermar / nginx.conf
Created September 12, 2018 06:42
Nginx RMTP to HLS and DASH
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
pid /var/run/nginx.pid;
events {
@sebbbi
sebbbi / ConeTraceAnalytic.txt
Created August 27, 2018 07:02
Cone trace analytic solution
Spherical cap cone analytic solution is a 1d problem, since the cone cap sphere slides along the ray. The intersection point to empty space sphere is always on the ray.
S : radius of cone cap sphere at t=1
r(d) : cone cap sphere radius at distance d
r(d) = d*S
p = distance of current SDF sample
SDF(p) = sdf function result at location p
x = distance after conservative step
@dinamycam
dinamycam / Makefile
Created April 21, 2018 15:02
Makefile for django deployment
PROJECT_NAME = ProjectName
MAKE := make
PWD := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
# you can either have a single settings.py
# or multiple settings in projectpath/settings/{local, production,...}
# The later is assumed to be the case
SETTING_FILE = local
SETTINGS_MODULE = $(PROJECT_NAME).settings.$(SETTING_FILE)
@nemanjan00
nemanjan00 / HOWTO.md
Last active May 1, 2021 12:36
Fixing ./Stremio+4.0.10.appimage: symbol lookup error: /usr/lib/libfontconfig.so.1: undefined symbol: FT_Done_MM_Var

You will thank me later.

./Stremio+4.0.10.appimage --appimage-extract
cd squashfs-root
mv ./lib/libfreetype.so.6 ./lib/libfreetype.so.6.bak
./stremio
@shafik
shafik / WhatIsStrictAliasingAndWhyDoWeCare.md
Last active July 17, 2024 07:40
What is Strict Aliasing and Why do we Care?

What is the Strict Aliasing Rule and Why do we care?

(OR Type Punning, Undefined Behavior and Alignment, Oh My!)

What is strict aliasing? First we will describe what is aliasing and then we can learn what being strict about it means.

In C and C++ aliasing has to do with what expression types we are allowed to access stored values through. In both C and C++ the standard specifies which expression types are allowed to alias which types. The compiler and optimizer are allowed to assume we follow the aliasing rules strictly, hence the term strict aliasing rule. If we attempt to access a value using a type not allowed it is classified as undefined behavior(UB). Once we have undefined behavior all bets are off, the results of our program are no longer reliable.

Unfortunately with strict aliasing violations, we will often obtain the results we expect, leaving the possibility the a future version of a compiler with a new optimization will break code we th

@mbinna
mbinna / effective_modern_cmake.md
Last active July 20, 2024 22:17
Effective Modern CMake

Effective Modern CMake

Getting Started

For a brief user-level introduction to CMake, watch C++ Weekly, Episode 78, Intro to CMake by Jason Turner. LLVM’s CMake Primer provides a good high-level introduction to the CMake syntax. Go read it now.

After that, watch Mathieu Ropert’s CppCon 2017 talk Using Modern CMake Patterns to Enforce a Good Modular Design (slides). It provides a thorough explanation of what modern CMake is and why it is so much better than “old school” CMake. The modular design ideas in this talk are based on the book [Large-Scale C++ Software Design](https://www.amazon.de/Large-Scale-Soft

@dvlden
dvlden / ffmpeg.md
Last active July 7, 2024 17:09
Convert video files to MP4 through FFMPEG

This is my personal list of functions that I wrote for converting mov files to mp4!

Command Flags

Flag Options Description
-codec:a libfaac, libfdk_aac, libvorbis Audio Codec
-quality best, good, realtime Video Quality
-b:a 128k, 192k, 256k, 320k Audio Bitrate
-codec:v mpeg4, libx264, libvpx-vp9 Video Codec
@mebiusbox
mebiusbox / GGXApproxDiffuse.brdf
Created September 8, 2017 14:25
GGX Approximation Diffuse for BRDF Explorer
analytic
# variables go here...
# only floats supported right now.
# [type] [name] [min val] [max val] [default val]
::begin parameters
float albedo 0 1 1
float roughness 0 1 1
::end parameters
@Leandros
Leandros / links.md
Last active May 13, 2024 11:42
Writing a Modern Rendering Engine