Skip to content

Instantly share code, notes, and snippets.

View u1735067's full-sized avatar

Alexandre L. u1735067

View GitHub Profile
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys, argparse
import os, os.path
import re, stat
import csv, subprocess
from datetime import datetime
'''
import sys, io, PIL, PIL.Image, PIL.ImageFile
from PIL import Image
from struct import unpack, pack
'''
https://gbatemp.net/threads/open-a-ttp-ttpf-image-vc-edit.442031/
https://pillow.readthedocs.io/en/4.3.x/reference/Image.html?highlight=rgba#PIL.Image.frombytes
https://pillow.readthedocs.io/en/4.3.x/handbook/writing-your-own-file-decoder.html#file-decoders
https://pillow.readthedocs.io/en/stable/handbook/writing-your-own-file-decoder.html
@u1735067
u1735067 / gba_3ds_vc_footer.ksy.yml
Created November 27, 2017 20:25
3DS GBA VC Rom footer from https://3dbrew.org/wiki/3DS_Virtual_Console#Footer + tests, for Kaitai struct
input_vendor_id = "1118"
input_product_id = "746"
===
input_vendor_id = "1118"
input_product_id = "765"
Lakka:~ # lsusb
Bus 001 Device 008: ID 045e:02ea Microsoft Corp.
Lakka:/etc/retroarch-joypad-autoconfig # udevadm info -p /sys/devices/platform/soc/20980000.usb/usb1/1-1/1-1.2/1-1.2\:1.0/bluetooth/hci0/hci0\:68/0005\:045E\:02FD.0007/
Constant Wrapper function Codec_ID Extension Extension alt. Python dict
MKV_A_AC3 xtr_base_c(new_codec_id, new_tid, tspec,"Dolby Digital (AC-3)"); A_AC3 ac3 'A_AC3': 'ac3'
MKV_A_EAC3 xtr_base_c(new_codec_id, new_tid, tspec,"Dolby Digital Plus (E-AC-3)"); A_EAC3 eac3 'A_EAC3': 'eac3'
A_MPEG/L* xtr_base_c(new_codec_id, new_tid, tspec,"MPEG-1 Audio Layer 2/3"); A_MPEG/L2 mp2 'A_MPEG/L2': 'mp2'
A_MPEG/L3 mp3 'A_MPEG/L3': 'mp3'
MKV_A_DTS xtr_base_c(new_codec_id, new_tid, tspec,"Digital Theater System (DTS)"); A_DTS dts 'A_DTS': 'dts'
MKV_A_PCM xtr_wav_c(new_codec_id, new_tid, tspec); A_PCM/INT/LIT wav 'A_PCM/INT/LIT': 'wav'
MKV_A_PCM_BE xtr_wav_c(new_codec_id, new_tid, tspec); A_PCM/INT/BIG wav 'A_PCM/INT/BIG': 'wav'
MKV_A_FLAC xtr_flac_c(new_codec_id, new_tid, tspec); A_FLAC flac ogg 'A_FLAC': 'flac'
MKV_A_ALAC xtr_alac_c(new_codec_id, new_tid, tspec); A_ALAC caf m4a 'A_ALAC': 'caf'
@u1735067
u1735067 / mkv-track-extractor.py
Last active June 14, 2021 12:51
Tool to extract one or many tracks from one or many mkv
#!/usr/bin/env python3
''' BSD 3-Clause License — but if it was useful to you, you may tell me :)
Copyright (c) 2016-2017, Alexandre Levavasseur
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
@u1735067
u1735067 / event-log.xml
Last active August 25, 2017 23:22
Task Scheduler: error 2147943767 (0x80070557) when starting second action
- <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
- <System>
<Provider Name="Microsoft-Windows-TaskScheduler" Guid="{DE7B24EA-73C8-4A09-985D-5BDADCFA9017}" />
<EventID>104</EventID>
<Version>0</Version>
<Level>2</Level>
<Task>104</Task>
<Opcode>0</Opcode>
<Keywords>0x8000000000000000</Keywords>
<TimeCreated SystemTime="2017-08-25T22:34:23.310635500Z" />
@u1735067
u1735067 / mobi.ksy.yml
Last active November 9, 2017 07:36
MOBI & PDB (Palm DataBase) container in kaitai lang
meta:
id: mobi
file-extension: mobi
endian: be
# https://wiki.mobileread.com/wiki/MOBI
seq:
- id: pdb_header
type: pdb_header_type
size: 78 # 0x4e
@u1735067
u1735067 / P2Pub.json
Created June 11, 2017 07:00
BDE example image with associated output from Kaitai (Web IDE) – if you manage get a working key for this one, I might actually give you a reward.
{
"metadata": {
"bdeMetadataBlockHeaderCommon": {
"signature": [45, 70, 86, 69, 45, 70, 83, 45],
"size": 0x35,
"version": 0x2
},
"bdeMetadataBlockHeaderSpecific": {
"unknown1": [4, 0],
"unknown2": [4, 0],
@u1735067
u1735067 / bde_metadatas.ksy.yml
Last active March 13, 2018 17:37
BitLocker headers format in real kaitai format, with recursive parsing
meta:
id: bde_metadatas
endian: le
doc-ref: https://github.com/libyal/libbde/blob/master/libbde/bde_metadata.h
doc-ref: https://github.com/libyal/libbde/blob/master/libbde/libbde_definitions.h.in
# This will be find at first_metadata_offset from bde_volume_header
seq:
- id: metadata