Skip to content

Instantly share code, notes, and snippets.

View shinyquagsire23's full-sized avatar
💭
Fiddling with emulation/patching between schoolwork.

Max Thomas shinyquagsire23

💭
Fiddling with emulation/patching between schoolwork.
View GitHub Profile
@shinyquagsire23
shinyquagsire23 / assist_dec.txt
Last active January 6, 2019 21:01
lua vs lua2cpp vs luac vs nrooooooo tokens
function <?:27,31> (25 instructions at 0x563b8aad94d0)
0 params, 17 slots, 1 upvalue, 0 locals, 7 constants, 0 functions
1 [-] GETTABUP 0 0 -1 ; - "sv_animcmd"
2 [-] GETTABLE 0 0 -2 ; "is_excute"
3 [-] CALL 0 1 2
4 [-] TEST 0 0
5 [-] JMP 0 19 ; to 25
6 [-] GETTABUP 0 0 -1 ; - "sv_animcmd"
7 [-] GETTABLE 0 0 -3 ; "LANDING_EFFECT"
8 [-] LOADK 1 -4 ; 85833409598
@shinyquagsire23
shinyquagsire23 / tbv_extract.c
Created May 7, 2019 22:59
TBV package extraction for Lionel Train Town
#include <stdint.h>
#include <stdio.h>
struct pkx_header
{
uint32_t magic1;
uint32_t magic2;
uint32_t magic3;
uint32_t type;
uint32_t comp_size;
@shinyquagsire23
shinyquagsire23 / aboot-verify.py
Last active June 18, 2019 00:35
Python script for verifying ELF aboot images
#!/usr/bin/env python2
import struct
import sys
import hashlib
from pyasn1_modules import rfc2437,rfc2459
from pyasn1.codec.der import decoder
from pyasn1.codec.native import encoder
@shinyquagsire23
shinyquagsire23 / surfacego-touchscreen
Created January 12, 2020 22:15
Surface Go ChromeOS touchscreen fix - on-wake script and upstart daemon config
#!/bin/bash
# copy to /usr/sbin
interface=org.chromium.PowerManager
member=SetPolicy
# Run once just to be sure
echo "Surface Go fix daemon start..." > /dev/kmsg
echo "on" > /sys/devices/pci0000:00/0000:00:15.1/i2c_designware.1/power/control
@shinyquagsire23
shinyquagsire23 / colors.py
Created March 14, 2020 19:35
Extracting prominent color gradients from an image
import imageio
import numpy as np
import cv2
q = "20191230_221836_HDR.jpg"
r = "legs.png"
im = np.array(imageio.imread(r))
im_orig = im
dims = im.shape
diff -r /home/maxamillion/workspace/qt5_compare/qt-everywhere-src-5.12.2/qtbase/src/android/jar/src/org/qtproject/qt5/android/QtNative.java ./qtbase/src/android/jar/src/org/qtproject/qt5/android/QtNative.java
491a492,495
> float tiltRot = event.getAxisValue(MotionEvent.AXIS_TILT);
> float orientation = event.getAxisValue(MotionEvent.AXIS_ORIENTATION);
> float tiltX = (float) Math.toDegrees(-Math.sin(orientation) * tiltRot);
> float tiltY = (float) Math.toDegrees(Math.cos(orientation) * tiltRot);
493c497
< event.getButtonState(), event.getX(), event.getY(), event.getPressure());
---
> event.getButtonState(), event.getX(), event.getY(), event.getPressure(), tiltX, tiltY, (float)Math.toDegrees(orientation));
@shinyquagsire23
shinyquagsire23 / t210.cfg
Last active March 26, 2022 04:01
Tegra X1 T210 OpenOCD JTAG config for Jetson Nano/TX1
#
# OpenOCD configuration for Tegra X1 (T210)
# by shinyquagsire23
# For use on Jetson Nano/TX1 and similar
#
transport select jtag
adapter speed 3000
reset_config trst_and_srst
jtag_ntrst_delay 500
@shinyquagsire23
shinyquagsire23 / gist:7e9a8b5f4cbb6ca79fb0de1b54bd2bfb
Last active March 30, 2022 02:57
Spam "MooBot Mirai DDoS" with the bee movie script
# run `ulimit -n 94000` or it'll run out of socket fd's
# grab your bee movie script from
# https://gist.githubusercontent.com/ElliotGluck/64b0b814293c09999f765e265aaa2ba1/raw/79f24f9f87654d7ec7c2f6ba83e927852cdbf9a5/gistfile1.txt
# and save as `beemovie.txt`
import time
import threading
import socket
import struct
connections = 0
# Requires pyusb
import usb.core
import usb.util
import struct
import time
# Requires doing something like this before running, otherwise Linux kernel has control of the drive
# echo 1-1:1.0 > /sys/bus/usb/drivers/usb-storage/unbind
# find our device
@shinyquagsire23
shinyquagsire23 / imagedata-extract.py
Created June 1, 2020 21:04
Nexus 5 imagedata extraction
import struct
import imageio
import numpy as np
import sys
if len(sys.argv) < 2:
print ("Usage: image-extract.py [imgdata.image]")
exit(0)
f = open(sys.argv[1], "rb")