Skip to content

Instantly share code, notes, and snippets.

View pothos's full-sized avatar
🌴
On vacation

Kai Lüke pothos

🌴
On vacation
View GitHub Profile
@pothos
pothos / systemd-sudo.sh
Created January 26, 2022 12:31
systemd-sudo.sh: a non-setuid sudo-alike using systemd-run
#!/bin/bash
set -euo pipefail
MYNAME=$(basename "${0}")
opts=$(getopt --name "$MYNAME" --options 'hVsEnu:g:D:' \
--longoptions 'help,version,shell,preserve-env,non-interactive,user:,group:,chdir:' -- "${@}")
eval set -- "${opts}"
U=0
@pothos
pothos / set-flatcar-instance-alias
Created November 26, 2020 12:23
set-flatcar-instance-alias
#!/bin/bash
set -euo pipefail
if [ $# -lt 1 ] || [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
echo "Usage: $0 ALIAS"
echo "To be executed on the Flatcar instance"
exit 1
fi
ALIAS="$1"
@pothos
pothos / netmap_pipe_bug_test.c
Created August 5, 2018 17:26
Netmap pipe bug test
#define NETMAP_WITH_LIBS
#include <net/netmap_user.h>
#include <sys/poll.h>
void sender(int tx_sync) {
struct nm_desc *d;
struct pollfd fds;
printf("Using %s\n", tx_sync ? "TXSYNC ioctl" : "TX_POLL POLLIN poll");
d = nm_open("netmap:pipe}0", NULL, 0, 0);
fds.fd = NETMAP_FD(d);
@pothos
pothos / log-and-pcap-fail.txt
Last active January 3, 2018 11:30
smoltcp's trace and PCAP for reordered fin
TRACE:smoltcp::socket::set: [0]: adding
connecting
TRACE:smoltcp::socket::tcp: #0:0.0.0.0:50180:78.46.93.45:80: state=CLOSED=>SYN-SENT
TRACE:smoltcp::socket::tcp: #0:0.0.0.0:50180:78.46.93.45:80: outgoing segment will update window
TRACE:smoltcp::socket::tcp: #0:0.0.0.0:50180:78.46.93.45:80: sending SYN
DEBUG:smoltcp::iface::ethernet: address 143.248.197.1 not in neighbor cache, sending ARP request
TRACE:smoltcp::socket::meta: #0: neighbor 78.46.93.45 missing, silencing until t+3000ms
TRACE:smoltcp::iface::neighbor: filled 143.248.197.1 => 00-1a-1e-00-41-a0 (was empty)
TRACE:smoltcp::socket::meta: #0: neighbor 78.46.93.45 discovered, unsilencing
TRACE:smoltcp::socket::tcp: #0:0.0.0.0:50180:78.46.93.45:80: outgoing segment will update window
@pothos
pothos / linux-4.4.0-neon.git.patch
Created January 3, 2018 04:52
Patches for NEON/LoGA on Linux 4.4 (Gentoo) with NVIDIA driver 304.137 (works with NVIDIA Quadro NVS 295)
diff --git a/arch/x86/include/asm/pf_in.h b/arch/x86/include/asm/pf_in.h
new file mode 100644
index 0000000..e05341a
--- /dev/null
+++ b/arch/x86/include/asm/pf_in.h
@@ -0,0 +1,39 @@
+/*
+ * Fault Injection Test harness (FI)
+ * Copyright (C) Intel Crop.
+ *