Skip to content

Instantly share code, notes, and snippets.

View harieamjari's full-sized avatar

Al-buharie harieamjari

View GitHub Profile
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 April 7, 2021 08:34
2D wave equation solver
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <assert.h>
#include <png.h>
#ifdef NDEBUG
#error "Don't turn NDEBUG!!"
#endif
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <assert.h>
#include <png.h>
#ifdef NDEBUG
#error "Don't turn NDEBUG!!"
#endif
/* 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 May 1, 2021 09:46
Calculator
/* 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 January 26, 2021 05:01
Wave equation
/*
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 December 25, 2020 02:26
Minimal ray sphere intersection in 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 November 8, 2020 11:39
Simple raytracer in 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 October 27, 2020 11:46
Writing libpng template
#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 January 26, 2021 05:28
Project a 3D vector to a 2D plane.
/*
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