Skip to content

Instantly share code, notes, and snippets.

Josh Enders joshenders

Block or report user

Report or block joshenders

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@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 / varnish.init.patch
Last active Dec 13, 2016
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 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 / rules.patch
Created Nov 25, 2016
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 Nov 3, 2016
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 Dec 11, 2016
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 Nov 3, 2016
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);
@joshenders
joshenders / varnishncsa.c.patch
Last active Oct 28, 2016
Varnish 3.0.3 (9e6a70f) Time to Last Byte varnishncsa patch
View varnishncsa.c.patch
diff --git a/bin/varnishncsa/varnishncsa.c b/bin/varnishncsa/varnishncsa.c
index ff07ed5..3af1367 100644
--- a/bin/varnishncsa/varnishncsa.c
+++ b/bin/varnishncsa/varnishncsa.c
@@ -98,6 +98,7 @@ static struct logline {
struct tm df_t; /* %t, Date and time */
char *df_u; /* %u, Remote user */
char *df_ttfb; /* Time to first byte */
+ char *df_ttlb; /* Time to last byte */
const char *df_hitmiss; /* Whether this is a hit or miss */
@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"
@joshenders
joshenders / ylint.sh
Created Dec 14, 2015
YAML syntax checker
View ylint.sh
function ylint() {
if [[ "$#" -ne 1 ]]; then
echo "Usage: ${FUNCNAME} <infile>"
return 1
fi
ruby -e "require 'yaml'; YAML.load_file('$1')"
}
You can’t perform that action at this time.