Skip to content

Instantly share code, notes, and snippets.

View jaeheonshim's full-sized avatar

Jaeheon Shim jaeheonshim

View GitHub Profile
@jaeheonshim
jaeheonshim / conceal_scores.user.js
Last active July 4, 2022 03:14
This userscript conceals scores on the AP score report page until you reveal each score individually.
// ==UserScript==
// @name Conceal AP Scores
// @namespace https://jaeheonshim.com
// @version 1.0
// @description Conceals scores on AP score report page until you reveal each score individually.
// @author Jaeheon Shim
// @match https://apstudents.collegeboard.org/view-scores
// @icon https://www.google.com/s2/favicons?sz=64&domain=collegeboard.org
// @require https://gist.github.com/raw/2625891/waitForKeyElements.js
// @grant none
@jaeheonshim
jaeheonshim / RoundedRectangles.java
Created December 29, 2021 16:35
Draw rounded rectangles onto pixmaps in LibGDX
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.Pixmap;
public class RoundedRectangles {
/**
* Draws a filled rounded rectangle taking up the full width and height of the Pixmap.
* @param pixmap Pixmap to draw rounded rectangle on
* @param radius Radius of rounded corners
* @return The pixmap
*/
@jaeheonshim
jaeheonshim / MidiHandler.java
Created December 23, 2021 22:39
MIDI WASD - Control WASD and mouse using MIDI instrument
import javax.sound.midi.*;
import java.awt.*;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
import java.util.Map;
import java.util.Scanner;
import java.util.concurrent.atomic.AtomicInteger;
public class MidiHandler {
private MidiDevice inputDevice;
@jaeheonshim
jaeheonshim / determinant.py
Created December 12, 2021 01:42
Take the determinant of a square matrix in Python
def determinant(matrix):
if len(matrix) == 1:
return matrix[0][0]
if len(matrix) == 2:
return matrix[0][0] * matrix[1][1] - matrix[0][1] * matrix[1][0]
sign = 1
det = 0
for i in range(len(matrix)):
det += matrix[0][i] * determinant(minor(matrix, 0, i)) * sign
sign *= -1
@jaeheonshim
jaeheonshim / complex.h
Created October 11, 2021 19:36
Complex number operations in C for arbitrary data types (Header File)
#include <math.h>
// ===== TYPE AND OPERATION DEFINITIONS =====
#define _NTYPE_SQRT(n) sqrtl(n)
typedef long double _NTYPE;
// ==========
typedef struct complex {
_NTYPE real;
_NTYPE i;
@jaeheonshim
jaeheonshim / gist:850231abee3c2f9eb425a8e85c59117d
Created January 29, 2021 16:07
AStar with Union-Find : Checks to see if a path is possible to the target before running AStar algorithm
package brain;
import actor.Creature;
import actor.GameObject;
import grid.Location;
public class AStarUtil {
private PriorityQueue<Node> openList = new PriorityQueue<>();
private Set<Node> closedList = new HashSet<>();
@jaeheonshim
jaeheonshim / AStarUtil.java
Created January 29, 2021 00:27
BotWorld AStar Code
package brain;
import actor.GameObject;
import grid.Location;
import java.util.*;
public class AStarUtil {
private PriorityQueue<Node> openList = new PriorityQueue<>();
private Set<Node> closedList = new HashSet<>();
1/2 < floor(mod(floor(y/17)*2^(-17*floor(x)-mod(floor(y),17)),2))
Constant k: 53025630449919516305794555145176559852494297839841120715661516560065261393879737063336176846178468973301063087223765665824314971283618022541525669974126578370803315428489561147738989680370644019395207321265990458908342194366873957546836387126097325649786212132993653676186727203879383442596824251022967691260527038356957919419078238248371450430211035025236809004304798246691077285961805241071737043300674863158018691439912564030591979991659606406277177927139442643704275565890298776128141168913558394827577806908077444114962066702336