Skip to content

Instantly share code, notes, and snippets.

@MightyPork
MightyPork / custom-serde.rs
Created June 11, 2019 20:34
example of custom serialize and deserialize in serde
use serde::ser::SerializeMap;
use serde::{Serialize, Serializer, de::Visitor, de::MapAccess, Deserialize, Deserializer};
use std::fmt;
#[derive(Debug)]
struct Custom(String, u32);
impl Serialize for Custom {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
vSphere 6 Enterprise Plus:
1C20K-4Z214-H84U1-T92EP-92838
1A2JU-DEH12-48460-CT956-AC84D
MC28R-4L006-484D1-VV8NK-C7R58
5C6TK-4C39J-48E00-PH0XH-828Q4
4A4X0-69HE3-M8548-6L1QK-1Y240
vSphere with Operations Management 6 Enterprise:
4Y2NU-4Z301-085C8-M18EP-2K8M8
1Y48R-0EJEK-084R0-GK9XM-23R52
@khang06
khang06 / 0-SD-GUIDE.md
Last active April 19, 2024 07:41
Switch SD Dumping 101

https://gbatemp.net/threads/nintendo-switch-sd-to-nsp-dumper.514816/ for a more automated and easier way to do this

This guide assumes you have previous experience with hactool and messing with your NAND. You aren't supposed to blindly copy commands in this, so read before pasting!

Also, the Python sections require Python 2.7 and pycrypto. Make sure your hactool is v1.2 or above.

Obtaining Your SD Seed

  1. Run https://cdn.discordapp.com/attachments/432400335235973120/478053328857726976/Compelled-Disclosure.nro (source at https://github.com/shadowninja108/Compelled-Disclosure, thx Shadów#6239)

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

@Karunamon
Karunamon / guide.md
Last active April 19, 2024 07:41
Nintendo Switch reverting to stock with no NAND backup

Restoring your Switch to stock WITHOUT a NAND backup.

Just use Haku33, it is this but automated and safe. There is no reason for you to manually follow this process, it is dangerous!

Procedure by Nevercholt Tech (https://www.youtube.com/watch?v=gVjF_MKjSv8) - transcribed by Karunamon

Note: This procedure is somewhat advanced and, if you screw up, you are likely to hard brick your switch. *Proceed with caution!

Also note that this is a full reset. All save data, installed apps, everything will be lost.

@MarceloPrado
MarceloPrado / ReactNativeGlobalAlert.tsx
Created August 8, 2023 11:05
This gist describes how to build a global alert system that follows a similar API as RN's Alert.alert(). It can be cleaned up and improved, especially in the GlobalAlertManager side, but it's a good starting point.
import { BottomSheetModalProvider } from "@gorhom/bottom-sheet";
/**
* This gist describes how to build a global alert system that follows a similar
* API as RN's Alert.alert().
*
* This can be cleaned up and improved, especially in the GlobalAlertManager
* side, but it's a good starting point.
*/
@andrewfraley
andrewfraley / pbs_on_rpi.md
Last active April 19, 2024 07:40
Backup a Raspberry Pi to Proxmox Backup Server using the Proxmox Backup Client

Backup a Raspberry Pi to Proxmox Backup Server using the Proxmox Backup Client

This works on a Pi 4, and should work on a Pi 3, but to work on a Pi Zero you would have to figure out how to compile your own client. More info in this thread on the Proxmox forums.

Determine if your Pi is 32bit or 64bit

Run the following command. If you get arm64, it's 64bit, otherwise you'll see armv7l which is 32bit.

uname -m
@cabarger
cabarger / multithreading_example.zig
Last active April 19, 2024 07:40
ZIG multithreading example
//!
//! multithreading_example.zig
//! Caleb Barger
//! 06/27/2023
//! Zig 0.11.0
//!
//! Minified ZIG version of Casey Muratori's multithreading example from Handmade Hero.
//!
const std = @import("std");
@kheachang
kheachang / gist:4ce5a98140ad21129acd49aff0df11a8
Created November 4, 2021 19:37
etherscan-scraped-labels
0-gas-sender:0xc35d77d25d81be78ad60ce14fea7c92d438782e3,0x33a330a68d824bf56c7dbc42d4cd827368441321,0x0d4beb5cc5ee47d461416fe10cab46e543b6620c,0x71c7656ec7ab88b098defb751b7401b5f6d8976f
0x:0xdffe798c7172dd6deb32baee68af322e8f495ce0,0x38a795580d0f687e399913a00ddef6a17612c722,0x45797531b873fd5e519477a070a955764c1a5b07,0xccc2431a7335f21d9268ba62f0b32b0f2efc463f,0x7eefbd48fd63d441ec7435d024ec7c5131019add,0x8ed95d1746bf1e4dab58d8ed4724f1ef95b20db0,0x95e6f48254609a6ee006f7d493c8e5fb97094cef,0x71c7656ec7ab88b098defb751b7401b5f6d8976f
0x-ecosystem:0xdffe798c7172dd6deb32baee68af322e8f495ce0,0xa3b2d1087bcebe59d188a23f75620612d967df72,0x2d7dc2ef7c6f6a2cbc3dba4db97b2ddb40e20713,0x95e6f48254609a6ee006f7d493c8e5fb97094cef,0xefc70a1b18c432bdc64b596838b4d138f6bc6cad,0x12459c951127e0c374ff9105dda097662a027093,0x080bf510fcbf18b91105470639e9561022937712,0x71c7656ec7ab88b098defb751b7401b5f6d8976f
0xuniverse:0xe73480759efb6731d133b382ab8df02774e3a265,0xf91d60c576fc809bea7a08d45ee3d6d77fbf5ff7,0xe658e6eb4b478da2cf36d9e3712ba0c1b337
@disintegrator
disintegrator / https-during-dev.macos.sh
Last active April 19, 2024 07:36
Use Caddy, mkcert and dnsmasq to expose your development server over HTTPS
brew install caddy mkcert nss dnsmasq
mkcert -install
mkcert '*.app.test' '*.cdn.test'
# rename the certs and move them under /usr/local/etc/caddy/certs
cat <<EOF > /usr/local/etc/caddy/Caddyfile
*.app.test:443, *.cdn.test:443 {