This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* andmalloc is an explicit-free-list memory allocator. | |
* fprintf uses glibc malloc which uses the same program breakpoint | |
*/ | |
#include <stdio.h> | |
#include <stdint.h> | |
#include <stdlib.h> | |
#include <stdbool.h> | |
#include <string.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import time | |
import numpy as np | |
import torch | |
torch.set_default_device('cuda') | |
device="cuda" | |
n = 320 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Andrew's Discord color utils https://gist.github.com/classAndrew/2f151a12c49a9e4a105fd1dfa338daba | |
# See https://gist.github.com/kkrypt0nn/a02506f3712ff2d1c8ca7c9e0aed7c06 for details | |
''' | |
example: | |
from discord_ansicolor import green bold, bg_light_gray | |
colored = green(bold(bg_light_gray("hello!"))) | |
''' | |
from typing import Union, Callable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import logging | |
import time | |
import requests | |
import json | |
__version__ = "1.0.0" | |
__author__ = "Andrew Lin" | |
logging.basicConfig(level=logging.INFO, format="[%(name)s] %(levelname)s %(asctime)s :: %(message)s") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define BOOST_LOG_DYN_LINK 1 | |
#include <iostream> | |
#include <boost/log/trivial.hpp> | |
#include <SDL2/SDL.h> | |
#include <sys/time.h> | |
#include <cmath> | |
using namespace std; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
@classAndrew | |
Nonlinear regression with a single layer perceptron. | |
Forgot when this was written | |
""" | |
import numpy as np | |
import statistics | |
import matplotlib.pyplot as plt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @classAndrew | |
* Shunting-Yard logical expression truth table generator | |
* 9 September 2021 | |
*/ | |
interface BoolRefJSON { | |
[name: string]: boolean; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from collections import Counter | |
# for K, M-length dictionary words, and an N-tile hand, you can expect a complexity of | |
# O(KM * lg M) Assuming letter counting and comparing is done in O(n) time (it isn't but | |
# it can be with the cost of lots of memory) There's a pretty large coefficient of 2^26 since | |
# there's 26 characters. | |
# tiles our hand! | |
hand = "buncheesefoodragon" | |
# you can realize right away that there's "bun", "cheese", "food", "dragon", "on" |