Skip to content

Instantly share code, notes, and snippets.

View dalehamel's full-sized avatar

Dale Hamel dalehamel

View GitHub Profile
@dalehamel
dalehamel / repack.sh
Created October 2, 2021 16:52
Repack OpenPHT images to update certificate authority
#!/bin/bash
set -e
echo "Checking required dependencies..."
which wget >& /dev/null
which parted >& /dev/null
which mksquashfs >& /dev/null
which unsquashfs >& /dev/null
@dalehamel
dalehamel / test patch
Created July 26, 2021 14:08
Test rbspy patch
---
src/core/initialize.rs | 17 +++++++++++++++++
src/main.rs | 4 ++++
2 files changed, 21 insertions(+)
diff --git a/src/core/initialize.rs b/src/core/initialize.rs
index c6bed8b..2ea1b2e 100644
--- a/src/core/initialize.rs
+++ b/src/core/initialize.rs
@@ -92,10 +92,18 @@ impl StackTraceGetter {
From d75537062f1f72b8dc6115f1960d6f56a47c3793 Mon Sep 17 00:00:00 2001
From: Dale Hamel <dale.hamel@shopify.com>
Date: Tue, 10 Mar 2020 18:46:03 -0400
Subject: [PATCH] Pull patch onto 1.17.8, drop systemtap specifics
---
README | 17 +++++++-
auto/make | 43 ++++++++++++++++++
auto/modules | 3 +-
auto/options | 11 ++++-
@dalehamel
dalehamel / mcsnopp.bt
Created March 10, 2020 01:47
bpftrace script to attach to memcached and probe connections and commands
usdt::memcached:command__get,
usdt::memcached:command__set,
usdt::memcached:command__add,
usdt::memcached:command__replace,
usdt::memcached:command__prepend,
usdt::memcached:command__append,
usdt::memcached:command__cas
{
@calls[str(arg1, arg2)]++;
@bytes[str(arg1, arg2)]+= arg3;
@dalehamel
dalehamel / simple_epoll_inotify_test.c
Created February 7, 2020 19:56
Test inotify on memfd with epoll api
#include <stdio.h>
#include <sys/inotify.h>
#include <sys/time.h>
#include <sys/epoll.h>
#include <errno.h>
#include <linux/memfd.h>
#include <sys/mman.h>
#include <sys/syscall.h>
@dalehamel
dalehamel / simple_epoll_inotify_test.c
Created February 7, 2020 19:56
Test inotify on memfd with epoll api
#include <stdio.h>
#include <sys/inotify.h>
#include <sys/time.h>
#include <sys/epoll.h>
#include <errno.h>
#include <linux/memfd.h>
#include <sys/mman.h>
#include <sys/syscall.h>
@dalehamel
dalehamel / docker-desktop-headers.sh
Last active February 6, 2020 20:13
install kernel headers for docker desktop, for BCC
#!/bin/bash
set -x
set -e
KERNEL_VERSION="${KERNEL_VERSION:-$(uname -r)}"
kernel_version="$(echo "${KERNEL_VERSION}" | awk -vFS=- '{ print $1 }')"
major_version="$(echo "${KERNEL_VERSION}" | awk -vFS=. '{ print $1 }')"
apt-get install -y build-essential bc curl flex bison libelf-dev
@dalehamel
dalehamel / android-bionic-poll-t.patch
Last active January 9, 2020 03:56
BCC patches to build embedded for android
--- embedded_bcc.orig/src/cc/libbpf/include/linux/types.h 2020-01-08 16:33:31.384052137 +0000
+++ embedded_bcc/src/cc/libbpf/include/linux/types.h 2020-01-08 02:22:36.269082225 +0000
@@ -23,7 +23,7 @@
#ifndef __aligned_u64
# define __aligned_u64 __u64 __attribute__((aligned(8)))
#endif
-
+typedef unsigned __bitwise __poll_t;
struct list_head {
struct list_head *next, *prev;
@dalehamel
dalehamel / lib-makefile-warning-clang.patch
Last active January 9, 2020 02:45
Patches to build libelf with clang toolchain
Index: src/embedded_libelf/lib/Makefile.in
===================================================================
--- src.orig/embedded_libelf/lib/Makefile.in
+++ src/embedded_libelf/lib/Makefile.in
@@ -330,9 +330,9 @@ ARFLAGS = cr
# Use strict fallthrough. Only __attribute__((fallthrough)) will prevent the
# warning
-@HAVE_IMPLICIT_FALLTHROUGH_WARNING_TRUE@IMPLICIT_FALLTHROUGH_WARNING = -Wimplicit-fallthrough=5
+@HAVE_IMPLICIT_FALLTHROUGH_WARNING_TRUE@IMPLICIT_FALLTHROUGH_WARNING = -Wimplicit-fallthrough
@dalehamel
dalehamel / argp-header.patch
Created January 8, 2020 16:22
Argp android build diff
diff -Naur argp_sources/gllib/argp.h argp_sources/gllib/argp.h.new
--- argp_sources/gllib/argp.h 2019-02-19 20:38:53.000000000 +0000
+++ argp_sources/gllib/argp.h.new 2020-01-08 16:21:42.843277973 +0000
@@ -19,6 +19,17 @@
#ifndef _ARGP_H
#define _ARGP_H
+#ifndef ARGP_EI
+# define ARGP_EI inline
+#endif