Skip to content

Instantly share code, notes, and snippets.

View harieamjari's full-sized avatar

Al-buharie harieamjari

View GitHub Profile
@harieamjari
harieamjari / get.c
Created June 15, 2021 15:17
GET request for a file; download a file using an HTTP request. OpenSSL
/*
* Copyright 2013-2021 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
* in the file LICENSE in the source distribution or at
* https://www.openssl.org/source/license.html
*/
#include <openssl/err.h>
/* This is free and unencumbered software released into the public domain.
*
* Anyone is free to copy, modify, publish, use, compile, sell, or
* distribute this software, either in source code form or as a compiled
* binary, for any purpose, commercial or non-commercial, and by any
* means.
* In jurisdictions that recognize copyright laws, the author or authors
* of this software dedicate any and all copyright interest in the
* software to the public domain. We make this dedication for the benefit
* of the public at large and to the detriment of our heirs and
#include <stdio.h>
#include <stdint.h>
typedef struct student student;
struct student {
char name[100];
char status;
int id;
};
@harieamjari
harieamjari / aeabi.h
Last active September 8, 2023 11:17
aeabi.h declares the ARM run-time helper-function ABI for programs written in C.
/* aeabi.h - declares the ARM run-time helper-function ABI for programs written in C.
*
* This is free and unencumbered software released into the public domain.
*
* Anyone is free to copy, modify, publish, use, compile, sell, or
* distribute this software, either in source code form or as a compiled
* binary, for any purpose, commercial or non-commercial, and by any
* means.
* In jurisdictions that recognize copyright laws, the author or authors
@harieamjari
harieamjari / heat.c
Created May 3, 2021 12:59
Solving the heat equation
#include <assert.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
double init_fluid(double x) {
return 10.0 * sin(2.0 * M_PI * x / 30.0) + 8.0 * cos(x / 2.0) +
2.0 * sin(x / 2.0);
}
int main() {
#include <assert.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
double init_fluid(double x) {
return 100.0 * sin(2.0 * M_PI * 0.4 * x) *
pow(M_E, -pow(x - 15.0, 2.0) / (3.6 * 2.0)) / (3.6 * sqrt(2.0 * M_PI));
}
@harieamjari
harieamjari / half.c
Created April 24, 2021 13:58
Integration of a normal distribution from 0 to +inf
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <assert.h>
#include <stdint.h>
static double derivative(double x){
return pow(M_E, -pow(x, 2.0)/2.0)/sqrt(2.0*M_PI);}
int main(int argc, char **argv) {
#include <assert.h> // so I wont have to do error handling
#include <math.h>
#include <png.h> // to output frames as png files
#include <stdio.h> // I/O
#include <stdlib.h>
#include <string.h>
#define FRAMES 50
/* this may be a vertex or a vector */
#include <assert.h>
#include <math.h>
#include <png.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define FRAMES 300
struct vec3D {
double x, y, z;
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#define UNEXPECTED(c) \
{ \
if (c != TOK_ERROR) { \
fprintf(stderr, "stream:%d:%d error: unexpected %s\n", line_tok_found, \
column_tok_found, tok_str(c)); \
} \