Skip to content

Instantly share code, notes, and snippets.

@friedkeenan
friedkeenan / epicycle.py
Created January 17, 2021 23:54
A manim scene for drawing stuff with epicycles using Fourier shenanigans
import random
import numpy as np
import manim as mn
from svg.path import parse_path
def integrate(func, a, b, *, dx=0.01):
return sum(func(x) * dx for x in np.arange(a, b, dx))
class SVGPath(mn.VMobject):
def __init__(self, path_str, *, num_points=500, **kwargs):
@friedkeenan
friedkeenan / Euler.py
Created November 21, 2020 06:05
A manim scene for drawing a visualization of "z = e^(iθ)"
import numpy as np
from manim import *
class ComplexPlaneWithFunctionDots(ComplexPlane):
class InputDot(Dot):
def __init__(self, plane, **kwargs):
super().__init__(**kwargs)
self.plane = plane
@friedkeenan
friedkeenan / deobfuscate_base.py
Last active December 15, 2019 07:20
Scripts to further deobfuscate deobfuscated Transformice code
#!/usr/bin/env python3
import sys
import re
def get_num_methods(string):
m = re.search(r'private function method_(\d+)\(... rest\) : Object(\s*\{\s*)return const_1\[(\d+)\];(\s*\}\s*\})', string)
return int(m.group(1))
def index_for_method(method_num, string):
@friedkeenan
friedkeenan / main.c
Created November 14, 2019 15:28
Minimal example to show the socketInitializeDefault hang
#include <stdio.h>
#include <switch.h>
int main(int argc, char **argv) {
consoleInit(NULL);
printf("Before socketInitializeDefault\n");
consoleUpdate(NULL);
socketInitializeDefault();
printf("After socketInitializeDefault\n");
#!/usr/bin/env python3
import sys
import os
import subprocess
from PIL import Image
from pathlib import Path
from ips_util import Patch
def exec_cmd(cmd):
@friedkeenan
friedkeenan / mercury_decrypt.py
Last active July 27, 2019 15:13
Decrypts NROs from Mercury that have the encrypted flag set
#!/usr/bin/env python3
# Reverse engineering sure is easy when you have source code to reference
import struct
import argparse
import sys
from Crypto.Cipher import AES
from pathlib import Path
@friedkeenan
friedkeenan / main.c
Last active January 2, 2019 19:15
envSetNroReturnPath() Example
#include <stdio.h>
#include <switch.h>
int main(int argc, char* argv[])
{
consoleInit(NULL);
printf("Hello World!\n");
@friedkeenan
friedkeenan / hbtheme.cfg
Created September 13, 2018 00:55
Example Homebrew Menu Theme for the Nintendo Switch
lightTheme={
textColor=(0,0,0,255);
frontWaveColor=(255,102,204,255);
middleWaveColor=(255,51,153,255);
backWaveColor=(204,0,153,255);
backgroundColor=(233,236,241,255);
highlightColor=(255,77,166,255);
separatorColor=(128,0,128,255);
enableWaveBlending=0;
buttonAText="";