Skip to content

Instantly share code, notes, and snippets.

@aabiji
aabiji / yt.py
Created April 7, 2024 15:39
Youtube video downloader
"""
A tiny youtube video downloader.
usage: yt.py [-h] [--only-audio] [--num_retries NUM_RETRIES] [--output OUTPUT] video_url
Built by Abigail Adegbiji on April 7, 2024.
Inspried by this blog post: https://tyrrrz.me/blog/reverse-engineering-youtube-revisited
Note that the get_video_info function will be subject to change when Youtube changes their api.
Also note that ffmpeg and ffmpeg-python are required dependencies.
"""
@aabiji
aabiji / tinytest.h
Last active October 20, 2023 16:21
Single header, C++ testing library.
/* Tinytest -- a tiny testing library under the MIT liscense.
* Should compile with std=c++17
* Example usage:
```
#include "tinytest.h"
int main() {
Tinytest::test("Test example", [](){
const char *a = "hello";
const char *b = "hello";
@aabiji
aabiji / sha256.c
Created July 19, 2023 03:20
A SHA256 implementatoin written in C.
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h>
// K[0] to K[63] are initialized as the first 32 bits of the fractional
// parts of the cube roots of the first 64 primes
const uint32_t k[64] = {
0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,