Skip to content

Instantly share code, notes, and snippets.

@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
@sreimers
sreimers / gist:11304646d975765a984a892d4b40b42e
Created September 14, 2021 07:26
Maintain baresip-libs subtree
# add
git subtree add --prefix=re-ng https://github.com/baresip/re.git master
git subtree add --prefix=rem-ng https://github.com/baresip/rem.git master
git subtree add --prefix=test https://github.com/baresip/retest.git master
# update
git subtree pull --prefix=re-ng https://github.com/baresip/re.git master
git subtree pull --prefix=rem-ng https://github.com/baresip/rem.git master
git subtree pull --prefix=test https://github.com/baresip/retest.git master
@sreimers
sreimers / script.sh
Last active April 21, 2021 18:19
trace.json to csv
jq -r '.traceEvents[] | [.ts, .args.webapp_jitter]| @csv' test_trace.json > /tmp/log.csv