Skip to content

Instantly share code, notes, and snippets.

@joshenders
joshenders / usbloadergx_hdd.md
Last active July 25, 2024 21:54
How to format a USB drive for storing GameCube games

Why do we change the cluster size when formatting USB drives for storing GameCube games?

For loading GC Games with USBLoaderGX via DiosMios/Nintendont, format your usb drive's primary partition as FAT32 with 32KB clusters (also known as blocks). This increases performance by reducing the NUMBER of transactions required to perform a read/write operation at the expense of the (very negligible) LENGTH of time to complete a transaction; since it's reading more data per transaction.

I'm not certain, since I can't find a GameCube disk specification, but I don't think the 32KB cluster size is an attempt to imitate the on-disk storage format of retail GameCube discs; which may or may not be 32KB. Retail Wii discs however, actually DO use 32KB clusters. As far as I can tell, 32KB is simply the highest density of bytes per cluster that is supported by FAT32 and of course, by extension, Wii homebrew storage libraries.

If you're concerned about storage efficiency

#!/usr/bin/python -tt
# Copyright 2010 Google Inc.
# Licensed under the Apache License, Version 2.0
# http://www.apache.org/licenses/LICENSE-2.0
# Google's Python Class
# http://code.google.com/edu/languages/google-python-class/
# Basic string exercises
# Fill in the code for the functions below. main() is already set up
@joshenders
joshenders / devkitpro_setup_macos.md
Last active June 27, 2024 02:26
Getting started with Nintendo Switch Development using devkitpro on macOS

Getting started with Nintendo Switch Development using devkitpro on macOS

Prerequsite: Ensure Xcode command line tools are installed

xcode-select --install

Install the devkitpro Package Manager

@joshenders
joshenders / flatcar_incus_setup.md
Last active June 15, 2024 00:14
Flatcar Container Linux UEFI Setup Under Incus on Debian

Flatcar Container Linux Setup Under Incus on Debian

In case you missed it, Canonical relicensed LXD under AGPLv3 in December 2023 with a mandatory CLA. The LXD project was hard forked as Incus and licensed under an Apache 2.0 License.

Incus is maintained by the same team of developers that first created LXD and is recommended for new users going forward.

Install and configure

Borrowed from here.

@joshenders
joshenders / sshrc
Created March 13, 2015 12:47
/etc/ssh/sshrc to fix X11 Forwarding on Debian
if read proto cookie && [ -n "$DISPLAY" ]; then
if [ `echo $DISPLAY | cut -c1-10` = 'localhost:' ]; then
# X11UseLocalhost=yes
echo add unix:`echo $DISPLAY |
cut -c11-` $proto $cookie
else
# X11UseLocalhost=no
echo add $DISPLAY $proto $cookie
fi | xauth -q -
fi
@joshenders
joshenders / openwrt_lxd_multiwan.md
Last active February 11, 2024 10:07
OpenWrt 23.05.x Setup Under LXD 5.x on Debian 12 with PCI Passthrough

OpenWrt 23.05.x Setup Under LXD 5.x on Debian 12 with PCI Passthrough

In case you missed it, Canonical relicensed LXD under AGPLv3 in December 2023 with a mandatory CLA. The LXD project was hard forked as Incus and licensed under an Apache 2.0 License.

Incus is maintained by the same team of developers that first created LXD and is recommended for new users going forward.

If you continue with this guide using Incus, substitute incus for lxc in each command.

Install lxd via snap and configure

💡 If using Debian 12 (Bookworm) or newer, you can just apt install lxd but keep in mind this pacakge is EOL and new users are encouraged to move to Incus.

@joshenders
joshenders / swap.md
Last active February 6, 2024 21:16
Stop making swap partitions

Stop making swap partitions—use swap files instead!

Swap files have had the same performance characteristics as swap partitions for almost 20 years[1] and yet, linux distributions continue to encourage the use of swap partitions during install.

Swap files are easier to use/add/remove/modify/extend after installation. They're better in every way––use swap files!

  1. Create a swap file.

💡 You can use dd for this too but if your filesystem supports it, fallocate is faster.

@joshenders
joshenders / nodejs.md
Last active November 30, 2023 00:32
How to patch the NodeJS binary to write perfdata to a path other than /tmp

Background

The current verison of NodeJS hardcodes the path where perf data is written when the --perf-basic-prof flag is used.

https://github.com/v8/v8/blob/061c2ab23a1d4cd192b935e7912e7dfb1fed845d/src/log.cc#L236

At Pinterest, /tmp has limited capacity and so we weren't able to utilize perf data to troubleshoot NodeJS without filling the disk and crashing the running system.

How to patch

First I'll copy the system node binary to my local directory so this set of actions isn't destructive to the running system:

@joshenders
joshenders / mdsetup.md
Last active November 19, 2023 19:04
Create mdraid mirror from an existing Wheezy installation

Create mdraid mirror from an existing Debian installation

Throughout this guide, /dev/sda will be referred to as the old drive and /dev/sdb will be referred to as the new drive. If possible, I suggest disconnecting all other disks attached to the system while performing this maintenance.

Prerequisite software

apt-get install mdadm rsync

1. Partition the new drive.

sfdisk -d /dev/sda | sfdisk /dev/sdb 

sfdisk --change-id /dev/sdb 1 DA # change partition-type to, "0xDA" aka "non-fs data" as "linux raid auto" is deprecated

@joshenders
joshenders / HPN40L BMC Setup.md
Last active September 2, 2023 08:00
How to setup an N40L Remote Access Card (BMC/IPMI) under Debian Wheezy

Update BMC Firmware

As of this writing (2014-02-18), the latest firmware is 1.3. It can be updated from the webif. Use Safari, the credentials are admin/password. If you're trying to find it on your network, the OUI of the BMC NIC is a0:b3:cc.

Install Utilities

apt-get install openipmi ipmitool