Skip to content

Instantly share code, notes, and snippets.

@joshenders
joshenders / flatcar_incus_setup.md
Last active August 22, 2024 22:17
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 / swap.md
Last active October 2, 2024 05:03
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 / 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 / lldb-hand-rolled-headers.md
Created October 18, 2020 21:05 — forked from zcutlip/lldb-hand-rolled-headers.md
Importing Hand-Rolled C Header Files in LLDB

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 / devkitpro_setup_macos.md
Last active October 8, 2024 15:00
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 / make_ipxe_uefi_usb.md
Created August 29, 2017 08:10 — forked from AdrianKoshka/make_ipxe_uefi_usb.md
Making a UEFI bootable iPXE USB drive

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 / varnish.init.patch
Last active December 13, 2016 01:22
Patch for varnish-3.0.2-0ubuntu0.1 to enable safe stop
--- debian/varnish.init 2016-12-13 01:13:34.465123880 +0000
+++ debian/varnish.init.new 2016-12-13 01:18:50.215749771 +0000
@@ -88,8 +88,10 @@
log_daemon_msg "Reloading $DESC" "$NAME"
if /usr/share/varnish/reload-vcl -q; then
log_end_msg 0
+ return 0
else
log_end_msg 1
+ return 1
@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 / rules.patch
Created November 25, 2016 23:32
Patch for varnish-3.0.2-0ubuntu0.1 to enable debug symbols
--- rules 2016-11-25 23:23:25.924313744 +0000
+++ rules.new 2016-11-25 23:23:17.788331016 +0000
@@ -15,7 +15,7 @@
DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
# Set local state dir for FHS
-LOCAL_CONFIGURE_FLAGS = --localstatedir=/var/lib
+LOCAL_CONFIGURE_FLAGS = --localstatedir=/var/lib --enable-debugging-symbols
ifneq ($(filter $(DEB_HOST_ARCH),$(DISABLE_JEMALLOC_ARCH_LIST)),)
@joshenders
joshenders / control.patch
Created November 3, 2016 07:11
varnish-3.0.2-1ubuntu0.1 debian/control patch
--- debian/control 2012-06-18 18:59:16.000000000 +0000
+++ debian/control 2016-11-03 07:10:00.536388796 +0000
@@ -36,13 +36,6 @@
* URL rewriting
* Graceful handling of "dead" backends
-Package: varnish-doc
-Architecture: all
-Section: doc
-Depends: ${misc:Depends}, libjs-jquery, libjs-underscore