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 / 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")
@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
@shinyquagsire23
shinyquagsire23 / lg_getkdz.py
Created February 11, 2020 20:20
LG Update Pulling
from Crypto.Cipher import AES
from Crypto import Random
import base64
import requests
import xml.etree.ElementTree as ET
block_size = AES.block_size
unpad = lambda s : s[0:-ord(s[-1])]
@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 / gist:f7907fdf6b470200702e75a30135caf3
Created January 8, 2020 05:48
Philips Hue BLE Services and Characteristics (WIP)
DeviceInfo(softwareRevision, isOn,
SceneLightState(color, powerOnBehavior, deviceInfo
Light(id,
Capabilities(dimmable, customState
PowerOnBehavior(option
hueplay, huebloom, hueiris, huelightstrip, huego, plug, bollard, wallspot, groundspot, flexiblelamp, wallshade, walllantern
[ea:44:13:bd:db:59] Service [b8843add-0000-4aa1-8794-c3f462030bda] Unknown, ble_firmware_update?
[ea:44:13:bd:db:59] Characteristic [b8843add-0004-4aa1-8794-c3f462030bda]
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 / gist:291a16f1b5fa3b555f8a9da7692b72ce
Last active December 27, 2022 02:32
Surface Go ChromeOS - Jan 2020
Based somewhat on http://www.nicholasmelnick.com/2019/02/installing-chromeos-on-surface-go/
EDIT April 11, 2020: Happy to report that a lot of this isn't necessary any more! https://github.com/sebanc/brunch seems to work
perfectly with the Surface Go using the dual boot option and rEFInd, no adjustments needed. Even fixes autorotation, which I hadn't
gotten working.
# Get chromefy stuff
git clone https://github.com/imperador/chromefy.git
cd chromefy
@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 / 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 / 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