Skip to content

Instantly share code, notes, and snippets.

View leodido's full-sized avatar
🚒

Leo Di Donato leodido

🚒
View GitHub Profile
@leodido
leodido / awssdk-cpp.patch
Last active March 28, 2022 00:14
Patch for building AWS SDK C++ with gcc 11 (fix landed Nov 4th, 2021)
diff --git a/aws-cpp-sdk-core/source/utils/event/EventStreamDecoder.cpp b/aws-cpp-sdk-core/source/utils/event/EventStreamDecoder.cpp
index f70a6c88f6..e09a4e0ee6 100644
--- a/aws-cpp-sdk-core/source/utils/event/EventStreamDecoder.cpp
+++ b/aws-cpp-sdk-core/source/utils/event/EventStreamDecoder.cpp
@@ -72,9 +72,7 @@ namespace Aws
assert(handler);
if (!handler)
{
- AWS_LOGSTREAM_ERROR(EVENT_STREAM_DECODER_CLASS_TAG, "Payload received, but decoder encountered internal errors before."
- "ErrorCode: " << EventStreamErrorsMapper::GetNameForError(handler->GetInternalError()) << ", "
@leodido
leodido / argp-subcommand.c
Created October 4, 2021 21:28 — forked from sam-github/argp-subcommand.c
argp subcommand example
/*
* Sample command line parser.
*
* Implements sub-commands with their own option handlers.
*
*/
#include <assert.h>
#include <stdarg.h>
#include <stdio.h>
@leodido
leodido / ping.cmake
Created January 29, 2021 16:38
Play to ping-pong with CMake files
set(PING_RESPONSE "pong")
@leodido
leodido / README.md
Last active January 2, 2021 15:01
ebpf-debugging

Debugging

@leodido
leodido / kubectl-exec-node.sh
Last active March 26, 2020 19:02
Exec into a node with kubectl
#!/usr/bin/env bash
NODE=kind-control-plane
IMG="docker.io/library/alpine"
POD="nsenter-$(tr -dc a-z0-9 < /dev/urandom | head -c 6)"
OVERRIDE="{\"spec\":{\"nodeName\":\"$NODE\",\"hostPID\":true,\"containers\":[{\"securityContext\":{\"privileged\":true},\"image\":\"${IMG}\",\"name\":\"nsenter\",\"stdin\":true,\"stdinOnce\":true,\"tty\":true,\"command\":[\"nsenter\",\"--target\",\"1\",\"--mount\",\"--uts\",\"--ipc\",\"--net\",\"--pid\",\"--\",\"bash\",\"-l\"]}]}}"
kubectl run --rm \
--image "${IMG}" \
--overrides="${OVERRIDE}" \
ARG KERNEL_VERSION
FROM linuxkit/kernel:${KERNEL_VERSION} AS src
FROM linuxkit/alpine:3fdc49366257e53276c6f363956a4353f95d9a81 AS builder
LABEL maintainer="cncf-falco-dev@lists.cncf.io"
COPY --from=src /kernel-dev.tar /
RUN apk add --no-cache --update \
@leodido
leodido / dumpstack.cpp
Created September 23, 2019 18:40
Dump the Lua stack
/*
* dump_stack(ls);
*/
void dump_stack(lua_State *L)
{
int i;
int top = lua_gettop(L);
printf("\n#### BOS ####\n");
for(i = top; i >= 1; i--)
{
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
function cache_uname {
what=$(uname -srm)
read -ra uname <<< "$what"
kern_name="${uname[0]}"
kern_vers="${uname[1]}"
mach_arch="${uname[2]}"
}
function get_os {
@leodido
leodido / rsyslog.conf
Last active March 20, 2022 10:00
Rsyslog configuration to grab syslog messages from journald, convert them to RFC5424 syslog format and send them with octet-counting framing to a syslog receiver
# This only works with the following docker logging drivers currently: journald, json-file, and CRI-O log files
global(processInternalMessages="on")
global(parser.permitSlashInProgramName="on")
global(workDirectory="/var/spool/rsyslog") # default location for work (spool) files
# Raise limits within /etc/systemd/journald.conf on the host(s) - ie., RateLimitIntervalSec=30s + RateLimitBurst=1000000
module(load="imjournal" ignorepreviousmessages="on" ratelimit.interval="60" ratelimit.burst="2000000" persiststateinterval="10000" statefile="/var/spool/rsyslog/imjournal.state")
module(load="mmutf8fix")
module(load="mmkubernetes"
tls.cacert="/run/secrets/kubernetes.io/serviceaccount/ca.crt"
tokenfile="/run/secrets/kubernetes.io/serviceaccount/token"