Skip to content

Instantly share code, notes, and snippets.

@ChrisHayduk
ChrisHayduk / merge_qlora_with_quantized_model.py
Last active April 10, 2024 00:36
Merging QLoRA weights with quantized model
"""
The code below combines approaches published by both @eugene-yh and @jinyongyoo on Github.
Thanks for the contributions guys!
"""
import torch
import peft
@xerpi
xerpi / PSVita_Linux_build_instructions.md
Last active April 1, 2024 12:51
PSVita Linux build instructions
@luk6xff
luk6xff / ARMonQEMUforDebianUbuntu.md
Last active March 24, 2024 05:31 — forked from bruce30262/ARMDebianUbuntu.md
Emulating ARM with QEMU on Debian/Ubuntu

You might want to read this to get an introduction to armel vs armhf.

If the below is too much, you can try Ubuntu-ARMv7-Qemu but note it contains non-free blobs.

Running ARM programs under linux (without starting QEMU VM!)

First, cross-compile user programs with GCC-ARM toolchain. Then install qemu-arm-static so that you can run ARM executables directly on linux

If there's no qemu-arm-static in the package list, install qemu-user-static instead

@abcdefg30
abcdefg30 / installation.md
Last active September 15, 2023 08:47
Unofficial, manual content installation for OpenRA

Manual (unrecommended) installation of the required content files for OpenRA

⚠️ This method is not recommended and should only be applied if automatic installation fails. Success of manually installing the files can not be guaranteed. ⚠️

⚠️ The automatic installation may fail for non-english content. OpenRA does not support other languages at the current stage of development and no such content should be installed. ⚠️

⚠️ Manually installing files can corrupt your game and lead to crashes. ⚠️

If you have trouble with automatic installation, please contact the developers (via IRC, our forum, the webpage comments or our issue tracker) before attempting a manual install.

###############################################
# TX SX OS unpacker - by hexkyz and naehrwert #
###############################################
from Crypto.Cipher import AES
from Crypto.Util import Counter
import os
import struct
"""
@SciresM
SciresM / tz_5x.idc
Created April 24, 2018 01:12
IDC for the Nintendo Switch's Secure Monitor, version 5.0.0.
#define UNLOADED_FILE 1
#include <idc.idc>
static main(void)
{
// set 'loading idc file' mode
set_inf_attr(INF_GENFLAGS, INFFL_LOADIDC|get_inf_attr(INF_GENFLAGS));
GenInfo(); // various settings
Segments(); // segmentation
Enums(); // enumerations
@nwert
nwert / libusb.patch
Last active June 20, 2018 04:34
nxboot
diff --git a/libusb/os/linux_usbfs.h b/libusb/os/linux_usbfs.h
index 2449632..5ef03ba 100644
--- a/libusb/os/linux_usbfs.h
+++ b/libusb/os/linux_usbfs.h
@@ -82,7 +82,7 @@ struct usbfs_iso_packet_desc {
};
#define MAX_BULK_BUFFER_LENGTH 16384
-#define MAX_CTRL_BUFFER_LENGTH 4096
+#define MAX_CTRL_BUFFER_LENGTH 0xFFFF

Nintendo Switch RSA-PKCS#1 Public Key Recovery

This is a short writeup of a fun (but ultimately pretty useless) attack I implemented on the Nintendo Switch a few months ago resulting in the recovery of some otherwise unobtainable RSA public keys. Since public keys aren't private keys, this is pretty useless, apart from letting us validate some signatures on PC. Even so, the attack is a pretty cool one, so I thought I'd write it up.

Every Switch gamecart has a unique certificate (called its "CERT"), storing an RSA signature followed by some kind of unknown but unique encrypted data. I was trying to reverse how these certificates work, and the obvious first step was to try to see how they were validated. However, when I tried looking through the FileSystem (FS) module, which should be responsible for validating these certificates, I found no references to the format at all. The "CERT" magic number was nowhere to be seen, and I couldn't find an RSA modulus that validated the signatures I had. This was in

@shuffle2
shuffle2 / fuses.c
Created October 17, 2017 23:26
dump + decode tegra t210 ipatches
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/mman.h>
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#define ARRAYSIZE(x) (sizeof(x) / sizeof(*x))