Skip to content

Instantly share code, notes, and snippets.

View danieltanfh95's full-sized avatar

Daniel danieltanfh95

View GitHub Profile
@danieltanfh95
danieltanfh95 / microgpt.py
Created March 1, 2026 07:02 — forked from karpathy/microgpt.py
microgpt
"""
The most atomic way to train and run inference for a GPT in pure, dependency-free Python.
This file is the complete algorithm.
Everything else is just efficiency.
@karpathy
"""
import os # os.path.exists
import math # math.log, math.exp
@danieltanfh95
danieltanfh95 / findSmallestDivisor.py
Created December 18, 2019 15:09
findSmallestDivisor
def findSmallestDivisor(s,t):
if(check_if_divisible(s, t)):
return len(find_shortest_repeating_substring(t))
else:
return -1
def check_if_divisible(s, t):
is_length_divisible = (len(s) % len(t)) == 0
if(is_length_divisible):
return t*(len(s)//len(t)) == s
@danieltanfh95
danieltanfh95 / buttons.py
Created December 18, 2019 14:46
Buttons py
def check_if_button_touched(point_x, point_y, button_x_min, button_y_min, button_x_max, button_y_max):
within_x = button_x_min <= point_x <= button_x_max
within_y = button_y_min <= point_y <= button_y_max
return within_x and within_y
def get_mid_point(button_x_min, button_y_min, button_x_max, button_y_max):
return (button_x_min+button_x_max) / 2.0, (button_y_min+button_y_max) / 2.0

Shadowverse Card API

Basic

Every response to all the endpoints is encapsulated in a root JSON object with two keys, a data_headers and a data. The data value is a JSON object. For every endpoint, there exist different keys which contain the actual queried data. In case of any errors, data will contain an empty JSON array.

Card information

@danieltanfh95
danieltanfh95 / dl.js
Created June 10, 2017 13:28
Download stuffs from app.box
a = $("iframe").contents().find("svg")
b="<!DOCTYPE html><html><head><title></title></head><body>"
for (i = 0; i < a.length; i++) {
b +=a[i].outerHTML;
}
b+="</body></html>"
schema.pageSchema=new mongoose.Schema({
timestamp:Date,
hash:String,
text:String,
user_id:Number
});
schema.chapterSchema=new mongoose.Schema({
title:String,
page:[schema.pageSchema],