Skip to content

Instantly share code, notes, and snippets.

View sreimers's full-sized avatar

Sebastian Reimers sreimers

View GitHub Profile
@sreimers
sreimers / gist:cb2afad2992cb7b7af367f5c5b20abce
Last active September 3, 2024 13:12
v4l2/gst radxa examples
v4l2-ctl --get-edid | edid-decode
v4l2-ctl -D -d /dev/video0 --get-fmt-video
v4l2-ctl --verbose -d /dev/video0 --set-fmt-video=width=3840,height=2160,pixelformat='NV12'
# radxa 4k cam
gst-launch-1.0 v4l2src device=/dev/video11 ! video/x-raw,format=NV12,width=3840,height=2160, framerate=30/1 ! xvimagesink
#include <stdlib.h>
#include <re.h>
#include <baresip.h>
#define REALTIME 1
static uint64_t next_value = 0;
/**
@sreimers
sreimers / Makefile
Last active September 10, 2023 10:11
baresip makefile
#RELEASE += RelWithDebInfo
RELEASE += Debug
#FLAGS += -DHAVE_THREADS= -DCMAKE_C_FLAGS="-fanalyzer"
#FLAGS += -DCMAKE_C_FLAGS="-m32"
#FLAGS += -DCMAKE_C_FLAGS="-gdwarf-4 --coverage" -DHAVE_THREADS=
#FLAGS += -DCMAKE_C_FLAGS="-gdwarf-4" -DHAVE_THREADS=
#FLAGS += -DCMAKE_C_FLAGS="-gdwarf-4 -fsanitize=address" -DHAVE_THREADS= -DCMAKE_CXX_FLAGS="-fsanitize=address"
#FLAGS += -DCMAKE_C_FLAGS="-gdwarf-4 -fsanitize=thread" -DHAVE_THREADS= -DCMAKE_CXX_FLAGS="-fsanitize=thread"
#FLAGS += -DCMAKE_C_FLAGS="-Weverything -Wno-padded -Wno-extra-semi-stmtq -gdwarf-4 -fsanitize=undefined -fno-sanitize-recover" -DHAVE_THREADS= -DCMAKE_CXX_FLAGS="-fsanitize=undefined"
@sreimers
sreimers / bench.sh
Last active January 27, 2023 13:22
tcp_performance
#!/bin/bash
idle=$1
active=$2
port=$3
rounds=50
echo "" > /tmp/bench.csv
redis-benchmark -c ${idle} -p ${port} -I &
#include <re.h>
#include <rem.h>
#include <stdint.h>
enum {
SILENCE_Q = 1024 * 1024, /* Quadratic sample value for silence */
};
static bool auframe_silence(struct auframe *af)
#define __format(arg) _Generic((arg), \
char: "%c", \
signed char: "%hhd", \
unsigned char: "%hhu", \
signed short: "%hd", \
unsigned short: "%hu", \
signed int: "%d", \
unsigned int: "%u", \
long int: "%ld", \
unsigned long int: "%lu", \
@sreimers
sreimers / gist:62e58c8a790d431bde6786bed619b9b9
Created February 5, 2022 13:44
github master main rename
git branch -m master main
git fetch origin
git branch -u origin/main main
git remote set-head origin -a
@sreimers
sreimers / sh
Last active November 24, 2021 17:07
curl -I https://sip-tcploadbalancer04.live.sipgate.de:5061
curl -I http://sip-tcploadbalancer04.live.sipgate.de:5060
/* compile with:
on linux: gcc -g stack_traces.c
on OS X: gcc -g -fno-pie stack_traces.c
on windows: gcc -g stack_traces.c -limagehlp
*/
#include <signal.h>
#include <stdio.h>
#include <assert.h>
diff --git a/src/net/posix/pif.c b/src/net/posix/pif.c
index 17e93abc..2fcf1113 100644
--- a/src/net/posix/pif.c
+++ b/src/net/posix/pif.c
@@ -90,14 +90,67 @@ int net_if_getaddr4(const char *ifname, int af, struct sa *ip)
/**
- * Enumerate all network interfaces
+ * Enumerate all IPv6 network interfaces