Skip to content

Instantly share code, notes, and snippets.

Avatar

Josh Enders joshenders

View GitHub Profile
@joshenders
joshenders / catalina_devkitpro_setup.md
Last active Feb 23, 2021
Getting started with Nintendo Switch Development using devkitpro on macOS
View catalina_devkitpro_setup.md

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 / mitmproxy.md
Last active Feb 6, 2021
mitmproxy configuration for iPad
View mitmproxy.md

Successful mitmproxy-3.7 setup tested on OS X 10.13.6 and iPhone X running 12.1.4

Enable IP forwarding and disable ICMP redirects to keep the iPad sending traffic to the proxy

sudo sysctl -w net.inet.ip.forwarding=1
sudo sysctl -w net.inet.ip.redirect=0

net.inet.ip.forwarding
Enable IP forwarding between interfaces

@joshenders
joshenders / smokeping.sh
Last active Dec 17, 2020
Poor man's smokeping for OS X
View smokeping.sh
#!/bin/bash
# https://gist.github.com/joshenders/52cb78bedaea6787faac
# This script uses the BSD variants of commands and is intended to
# be run on an unmodified installation of OSX.
pmset noidle &
now=$(date +%s)
duration=$((86400*3)) # 3days
@joshenders
joshenders / usbloadergx_hdd.md
Last active Oct 25, 2020
How to format a USB drive for storing GameCube games
View usbloadergx_hdd.md

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

@joshenders
joshenders / lldb-hand-rolled-headers.md
Created Oct 18, 2020 — forked from zcutlip/lldb-hand-rolled-headers.md
Importing Hand-Rolled C Header Files in LLDB
View lldb-hand-rolled-headers.md

Importing Hand-Rolled C Header Files in LLDB

Scenario

  • We're debugging a dylib, libhello.dylib
  • The dylib is linked from hello
  • The exported function is helloworld()
  • We do not have source, but have reversed a struct from the library and created a hand-crafted header file

Header File

@joshenders
joshenders / make_ipxe_uefi_usb.md
Created Aug 29, 2017 — forked from AdrianKoshka/make_ipxe_uefi_usb.md
Making a UEFI bootable iPXE USB drive
View make_ipxe_uefi_usb.md

Making a UEFI bootable iPXE USB drive

Build the UEFI executable for iPXE

# First we'll clone iPXE
$ git clone git://git.ipxe.org/ipxe.git
# Go into the src directory of the cloned git repo
$ cd ipxe/src
# Compile the UEFI iPXE executable
@joshenders
joshenders / nodejs.md
Last active Jun 27, 2019
How to patch the NodeJS binary to write perfdata to a path other than /tmp
View nodejs.md

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 / HPN40L BMC Setup.md
Last active Mar 22, 2019
How to setup an N40L Remote Access Card (BMC/IPMI) under Debian Wheezy
View HPN40L BMC Setup.md

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
@joshenders
joshenders / certchain.sh
Last active Jan 14, 2019
Simple Bash function to visualize PKI chain-of-trust
View certchain.sh
function certchain() {
# Usage: certchain
# Display PKI chain-of-trust for a given domain
# GistID: https://gist.github.com/joshenders/cda916797665de69ebcd
if [[ "$#" -ne 1 ]]; then
echo "Usage: ${FUNCNAME} <ip|domain[:port]>"
return 1
fi
local host_port="$1"