Skip to content

Instantly share code, notes, and snippets.

@Rich-Harris
Rich-Harris / footgun.md
Last active April 19, 2024 07:47
Top-level `await` is a footgun

Edit — February 2019

This gist had a far larger impact than I imagined it would, and apparently people are still finding it, so a quick update:

  • TC39 is currently moving forward with a slightly different version of TLA, referred to as 'variant B', in which a module with TLA doesn't block sibling execution. This vastly reduces the danger of parallelizable work happening in serial and thereby delaying startup, which was the concern that motivated me to write this gist
  • In the wild, we're seeing (async main(){...}()) as a substitute for TLA. This completely eliminates the blocking problem (yay!) but it's less powerful, and harder to statically analyse (boo). In other words the lack of TLA is causing real problems
  • Therefore, a version of TLA that solves the original issue is a valuable addition to the language, and I'm in full support of the current proposal, which you can read here.

I'll leave the rest of this document unedited, for archaeological

@osama2kabdullah
osama2kabdullah / Tailwind CSS with Shopify Theme.md
Created June 12, 2023 08:45
How to add Tailwind CSS in a shopify theme in development mode only

Add Tailwind CSS in Shopify Theme

  1. Initial node.js package manager with npm or yarn by running
yarn init -y 
#or
npm init -y
@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