Skip to content

Instantly share code, notes, and snippets.

View joshenders's full-sized avatar

Josh Enders joshenders

View GitHub Profile
@joshenders
joshenders / openwrt_lxd_multiwan.md
Last active September 16, 2023 07:28
OpenWrt 22.03.3 Setup Under LXD 5.0 on Debian 11 with PCI Passthrough
View openwrt_lxd_multiwan.md

OpenWrt 22.03.3 Setup Under LXD 5.0 on Debian 11 with PCI Passthrough

Install lxd via snap and configure

💡 If using Debian Bookworm/testing, or newer you can just apt install lxd

apt install snapd
snap install lxd

Configure lxd

@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
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 / devkitpro_setup_macos.md
Last active November 29, 2023 09:25
Getting started with Nintendo Switch Development using devkitpro on macOS
View devkitpro_setup_macos.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 / 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
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 / varnish.init.patch
Last active December 13, 2016 01:22
Patch for varnish-3.0.2-0ubuntu0.1 to enable safe stop
View varnish.init.patch
--- 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
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 / rules.patch
Created November 25, 2016 23:32
Patch for varnish-3.0.2-0ubuntu0.1 to enable debug symbols
View rules.patch
--- 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
View 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
@joshenders
joshenders / reload-vcl.patch
Last active December 11, 2016 10:34
reload-vcl patch for config discards and safe stop
View reload-vcl.patch
--- reload-vcl 2011-10-29 13:24:10.000000000 +0000
+++ /usr/share/varnish/reload-vcl 2016-12-11 09:51:08.696300339 +0000
@@ -1,9 +1,13 @@
#!/bin/sh
-
+#
# reload-varnish: Script to reload varnishd from VCL defined in
# /etc/default/varnish.
#
# Stig Sandbeck Mathisen <ssm@debian.org>
@joshenders
joshenders / cache_gzip.c.patch
Last active November 3, 2016 06:52
Ticket #1220: Temporary gzip issue: Invalid Gzip data: incorrect header check
View cache_gzip.c.patch
--- a/bin/varnishd/cache_gzip.c
+++ b/bin/varnishd/cache_gzip.c
@@ -646,9 +646,6 @@
bytes -= w;
VGZ_Ibuf(vg, st->ptr + st->len, w);
st->len += w;
- sp->obj->len += w;
- if (sp->wrk->do_stream)
- RES_StreamPoll(sp);