Skip to content

Instantly share code, notes, and snippets.

View antoinefortin's full-sized avatar

Antoine Fortin antoinefortin

  • Montreal, Canada
View GitHub Profile
@antoinefortin
antoinefortin / marcpy.py
Created February 22, 2021 05:09
MarcAntoine
def list_to_num(thelist):
answer = 0 # The value that will be returned at the end. For now, we init to 0
tenthpower = 0 # the tenthPower start at zero
'''
Some explanation on the 10ˆn, where n is the power.
10ˆ0 = 1
10ˆ1 = 10
10ˆ2 = 100
10ˆ3 = 1000
@antoinefortin
antoinefortin / ppmcreation.cpp
Created December 30, 2020 01:38
SimplePPMCreation
#include <iostream>
int main()
{
/*
MODIFIER CES VALEURS POUR CHANGER LA GRANDEUR DE L'IMAGE
IW = IMAGE WIDTH
IH = IMAGE HEIGHT.
*/
const int iw = 10;
function MidiToHertz(midiNoteIn)
{
return 440 * Math.pow(2, (midiNoteIn - 69) / 12);
}
function HertzToMidi(hertzIn)
{
var res = 12*Math.log2(hertzIn/440) + 69;
return res;
}
vec2 rotate(vec2 pos, float angle)
{
float c = cos(angle);
float s = sin(angle);
return mat2(c,s,-s,c) * pos;
}
/* SDF */
@antoinefortin
antoinefortin / steak.txt
Created October 19, 2020 04:29
SteakList
VARIOUS nice reading
https://elemental.medium.com/why-your-brain-loves-conspiracy-theories-69ca2abd893a
https://www.nytimes.com/2020/10/18/opinion/ny-post-biden-twitter.html
http://www.inquiriesjournal.com/articles/1801/abu-ghraib-homonationalism-and-the-rationalization-of-modern-torture
https://www.amazon.ca/Only-Plane-Sky-Oral-History/dp/150118220X
COCO
http://anniedufresne.com/musique/
https://www.reddit.com/r/sports/comments/jdgrks/meanwhile_in_new_zealand_full_stadium_without/
https://www.thesun.co.uk/news/12958744/sweden-local-lockdowns-covid-cases-rise/
void PrintToPPM()
{
const int image_width = 256;
const int image_height = 256;
std::ofstream img("C:/FuckThat/Shit.ppm");
img << "P3";
img << image_width << " " << image_height << std::endl;
img << "255" << std::endl;
@antoinefortin
antoinefortin / twosum.cpp
Created August 3, 2020 06:04
Find two sum in an array
#include <iostream>
#include <vector>
template<typename T, int N>
int al(T(&arr1)[N])
{
return N;
}
void d(int& a)
{
#define RAYMARCH_STEPS = 265
float sdSphere(vec3 pos, float radius)
{
return length(pos) - radius;
}
float sdBox( vec3 p, vec3 b )
{
vec3 q = abs(p) - b;
@antoinefortin
antoinefortin / ScreenSpaceTextureQueryURP
Created July 11, 2020 06:34
This shader query a Texture Using ScreenSpace in URP
Shader "Unlit/NewUnlitShader"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
}
SubShader
{
Tags { "RenderType"="Opaque" }
LOD 100
function setup() {
createCanvas(400, 400);
}
function draw() {
var size = 12;
background(25);
translate(width /4, height /2);
fill(255);
for(var x = 0; x < 10; x++)