Skip to content

Instantly share code, notes, and snippets.

View NWPlayer123's full-sized avatar

NWPlayer123 NWPlayer123

View GitHub Profile
@NWPlayer123
NWPlayer123 / keybase.md
Created October 28, 2014 01:03
Keybase Identification

Keybase proof

I hereby claim:

  • I am NWPlayer123 on github.
  • I am nwplayer123 (https://keybase.io/nwplayer123) on keybase.
  • I have a public key whose fingerprint is 2544 F55A 61A7 4A80 829A 143D 2042 204A 3A9B 193D

To claim this, I am signing this object:

#Only tested on Python 2.7.13 but it *might* work on 3.X
from struct import pack, unpack
from os.path import exists
from os import mkdir, makedirs
import sys
endian = ">" #Initial endian until we read the BOM
def byte(f):
return unpack("%sB" % endian, f.read(1))[0]
def half(f):
@NWPlayer123
NWPlayer123 / verify.py
Created March 24, 2017 06:36
Script to get icon and metadata for any Wii U title, title ID is hardcoded
# only dependencies are pycrypto and requests, I had to rename pycrypto's thing
# in C:\Python27\Lib\site-packages to Crypto from pip cause it defaulted to lowercase
from StringIO import StringIO
from Crypto.Cipher import AES
from struct import unpack
from requests import get
from os.path import exists
from os import mkdir
import warnings, sys
warnings.filterwarnings("ignore")
@NWPlayer123
NWPlayer123 / create_screen.py
Created June 5, 2017 05:58
Script to combine top and bottom screen from Luma3DS v8.0+ screenshots
#only dependency is pillow, just run "pip install pillow"
#tested on python 3.6 and 2.7
from PIL import Image
mode = ["Normal", "Twitter"][1] #0 = Normal, 1 = Twitter (add clear pixel)
number = "0001" #change to screenshot number
drive = "E:" #change to SD card drive
path = drive + "/luma/screenshots/"
if mode == "Normal": #400x240 + 320x240, black background
from PyQt5.QtWidgets import QApplication, QMenuBar, QTreeView, \
QHBoxLayout, QVBoxLayout, QWidget, QStyle, qApp, QFrame, \
QAction, QMenu
from PyQt5.QtGui import QStandardItem, QStandardItemModel, QIcon
from PyQt5.QtCore import QSize, Qt
import sys
def getIcon(iconType):
if iconType == 21:
return qApp.style().standardIcon(QStyle.SP_DirOpenIcon)
from struct import pack, unpack
from os import mkdir, makedirs
from os.path import exists
import sys
def half(f, en):
return unpack("%sH" % en, f.read(2))[0]
def full(f, en):
return unpack("%sI" % en, f.read(4))[0]
@NWPlayer123
NWPlayer123 / narcinfo.py
Created August 12, 2017 10:00
Puyo Puyo Tetris
#very rough writeup, looks like:
# "RBIN" magic
# two tables, which link to strings, absolute
# table 1 data points to the location of table 2 data which points to strings
# the two counts *should* be the same
from struct import pack, unpack
import sys
def getstr(f):
ret = "";char = f.read(1)
@NWPlayer123
NWPlayer123 / yaz0dec.py
Created August 23, 2017 04:37
Yaz0 decompression, written in python
from struct import unpack
import sys
with open(sys.argv[1], "rb") as f:
base = ".".join(sys.argv[1].split(".")[:-1])
with open(base + ".sarc", "wb+") as o:
assert f.read(4) == b"Yaz0"
unc_size = unpack(">I", f.read(4))[0]
o.write("\x00" * unc_size) #pre-allocate
o.seek(0);f.seek(16)
@NWPlayer123
NWPlayer123 / music_hax.py
Created August 30, 2017 05:06
Sonic Mania music swap script
from struct import pack, unpack
from binascii import hexlify, unhexlify
from os.path import exists
from os import mkdir
mode = 1
filename = b"b15bad41162c48c8d5d3dbc533b0e1c8.ogg"
hashname = filename.split(".")[0]
if mode == 0: #extract
@NWPlayer123
NWPlayer123 / rebuild_tiles.py
Created August 31, 2017 10:30
Sonic Mania Tile Separator
from PIL import Image
from os import mkdir
from os.path import exists
if not exists("tiles"):
mkdir("tiles")
inf = Image.open("16x16Tiles.gif")
pos = 0
for i in range(1024):