Skip to content

Instantly share code, notes, and snippets.

View leodido's full-sized avatar
🌀

Leo Di Donato leodido

🌀
View GitHub Profile
#!/usr/bin/env bash
set -eu
# Define variables
INSTALL_DIR="/usr/local/bin"
NAME="update_hetzner_github_hooks_ips"
SCRIPT_NAME="$NAME.py"
SCRIPT_PATH="$INSTALL_DIR/$SCRIPT_NAME"
SERVICE_FILE="/etc/systemd/system/$NAME.service"
#!/usr/bin/env bash
set -eu
# Define variables
INSTALL_DIR="/usr/local/bin"
NAME="update_hetzner_cloudflare_ips"
SCRIPT_NAME="$NAME.py"
SCRIPT_PATH="$INSTALL_DIR/$SCRIPT_NAME"
SERVICE_FILE="/etc/systemd/system/$NAME.service"
#!/usr/bin/env bash
set -eu
# Define variables
INSTALL_DIR="/usr/local/bin"
NAME="update_cloudflare_ips"
SCRIPT_NAME="$NAME.sh"
SCRIPT_PATH="$INSTALL_DIR/$SCRIPT_NAME"
SERVICE_FILE="/etc/systemd/system/$NAME.service"
@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="[email protected]"
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--)
{