Skip to content

Instantly share code, notes, and snippets.

Avatar

Al-buharie harieamjari

View GitHub Profile
View wut.c
const int main[] = {
-476053503, -443744256, -442695680, -494927871,
-443744256, -476045300, -509603825, -494858196,
-476053503, -476024828, -285212672, -352321537,
-442695680, -481296284, -905969664, -352321551,
-476053504, -476024831, -285212672, 1819043176,
1634017391, 174617714, -1610612736, 805248739,
225, 2147483420, 1
};
@harieamjari
harieamjari / 2dwave00.c
Last active Apr 7, 2021
2D wave equation solver
View 2dwave00.c
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <assert.h>
#include <png.h>
#ifdef NDEBUG
#error "Don't turn NDEBUG!!"
#endif
View lb.c
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <assert.h>
#include <png.h>
#ifdef NDEBUG
#error "Don't turn NDEBUG!!"
#endif
View x-ray.c
/* REPLY CHALLENGE
*
* Minimal deterministic parser
*/
#include <stdio.h>
#include <stdlib.h>
#define ERROR(...) fprintf(stderr, __VA_ARGS__)
#define UNEXPECTED(x) {\
if (x!=TOK_ERR) \
@harieamjari
harieamjari / calc.c
Last active Feb 14, 2021
Calculator
View calc.c
/* Tiny calc
*
* Copyright (c) 2021 Al-buharie Amjari <healer.harie@gmail.com>
*
* This file is license under MIT license
*
*/
#include <ctype.h>
#include <stdio.h>
@harieamjari
harieamjari / diwav.c
Last active Jan 26, 2021
Wave equation
View diwav.c
/*
DO WHAT THE FUCK YOU WANT TO BUT IT'S NOT MY FAULT PUBLIC LICENSE
Version 1, October 2013
Copyright (c) 2020 Al-buharie Amjari <healer.harie@gmail.com>
Everyone is permitted to copy and distribute verbatim or modified copies
of this license document, and changing it is allowed as long as the name
is changed.
DO WHAT THE FUCK YOU WANT TO BUT IT'S NOT MY FAULT PUBLIC LICENSE TERMS
@harieamjari
harieamjari / sphere.c
Last active Dec 25, 2020
Minimal ray sphere intersection in C
View sphere.c
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <png.h>
#include <assert.h>
struct vec3D {
double x,y,z;
};
@harieamjari
harieamjari / circle.c
Last active Nov 8, 2020
Simple raytracer in C
View circle.c
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <png.h>
#include <assert.h>
int width, height;
int main(int argc, char *argv[]){
if (argc != 4) {printf("usage: %s Pz c r\n", argv[0]); return 1;}
@harieamjari
harieamjari / template_ping.c
Created Oct 27, 2020
Writing libpng template
View template_ping.c
#include <stdio.h>
#include <stdlib.h>
#include <png.h>
int width, height;
int main(){
width = 1500; height = 1000;
char filename[] = "t.png";
/*open stream */
@harieamjari
harieamjari / project.c
Last active Jan 26, 2021
Project a 3D vector to a 2D plane.
View project.c
/*
DO WHAT THE FUCK YOU WANT TO BUT IT'S NOT MY FAULT PUBLIC LICENSE
Version 1, October 2013
Copyright (c) 2020 Al-buharie Amjari <healer.harie@gmail.com>
Everyone is permitted to copy and distribute verbatim or modified copies
of this license document, and changing it is allowed as long as the name
is changed.
DO WHAT THE FUCK YOU WANT TO BUT IT'S NOT MY FAULT PUBLIC LICENSE TERMS