Skip to content

Instantly share code, notes, and snippets.

View iahuang's full-sized avatar

Ian Huang iahuang

View GitHub Profile
@iahuang
iahuang / linked_list.py
Last active January 14, 2022 20:17
A Python Linked List implementation modeled after the built-in List object
"""Example Linked List Implementation"""
from __future__ import annotations
from dataclasses import dataclass
from typing import Any, Iterable, Optional, Type, TypeVar, Generic, cast
import math
T = TypeVar("T")
@iahuang
iahuang / input_manager.ts
Created July 2, 2021 04:56
A general purpose input listener designed for web-based games.
/*
A general purpose keyboard/mouse input listener designed for
web-based games.
Usage:
let inputManager = new InputManager(window);
let keys = inputManager.pollKeys();
let mouse = inputManager.pollMouse();
@iahuang
iahuang / mount.sh
Created May 18, 2021 18:02
Mount external drive on WSL
# Assuming ext. drive G: and /mnt/g, respectively
sudo mkdir /mnt/g
sudo mount -t drvfs G: /mnt/g
@iahuang
iahuang / lol_unique_name.md
Last active March 22, 2021 16:36
Find a unique League of Legends username by adding various combinations of diacritics to an existing name

Dependencies and Setup

> npm install random-useragent @types/random-useragent jsdom @types/jsdom node-fetch @types/node-fetch
> tsc --init
> tsc
> node main.js
@iahuang
iahuang / localStorageSize.js
Last active January 16, 2021 09:14
A bit of code to check the size limit of your browser's localStorage
/*
An over-engineered way to check the max window.localStorage size of your browser.
To run the test, past this code into the console of any browser tab.
*/
function testStorage(size, progress) {
localStorage.clear();
let dummyData = "";
for (let i=0; i<size; i++) {
// very small utility library for doing physics calculations in a js console
// designed mostly for my physics homework
(function () {
window.Cos = function (x) { // degree cosine
return Math.cos(x * 0.01745329251);
};
window.Sin = function (x) { // degree sine
return Math.sin(x * 0.01745329251);
};
@iahuang
iahuang / addRandomDiacritics.js
Created October 13, 2020 22:20
Add random diacritics to strings for the purposes of bypassing chat filters etc.
const diacritics = [];
for (let row = 0; row < 6; row++) {
for (let col of "0123456789ABCDEF") {
diacritics.push(eval('"\\u03' + row + col + '"'));
}
}
function randomItem(items) {
return items[Math.floor(Math.random() * items.length)];
@iahuang
iahuang / apfs_crack.py
Last active May 30, 2024 16:04
A command line tool for Kali Linux that uses apfs-fuse to crack encrypted MacOS drives. Run with -h to see usage
from subprocess import Popen, PIPE, STDOUT
from multiprocessing import Process, Queue
import queue
import os
import re
from termcolor import colored
import argparse
import time
from datetime import datetime
from dataclasses import dataclass
@iahuang
iahuang / switch_case.py
Created January 14, 2020 04:05
Very hacky implementation of switch/case syntax for Python
import types
def switch(x, *args):
for c in args:
if type(c.val) == types.LambdaType:
c.val()
if c.should_break:
return
elif c.matches(x):
@iahuang
iahuang / snowday.py
Last active May 31, 2024 19:35
Simple Python API for snowdaycalculator.com
import requests
from dataclasses import dataclass
import re
import datetime
class SchoolType:
PUBLIC = 0
URBAN_PUBLIC = 0.4
RURAL_PUBLIC = -0.4
PRIVATE = -0.4