Skip to content

Instantly share code, notes, and snippets.

View Daniel-Abrecht's full-sized avatar

Daniel Abrecht Daniel-Abrecht

View GitHub Profile
@Daniel-Abrecht
Daniel-Abrecht / readme.md
Created August 23, 2025 10:53
Things in C which should be changed

Things in C which should be changed

There are some things that I'd consider design mistakes in C. Real problems which absolutely need to be fixed.

Now, C23 is coming out, but we get mostly unnecessary things like nullptr, instead of fixing real issues... (I have no intention of switching to C23, for me, C17 was the last real C so far). Well, at least typeof is real now...

Allow VMTs using later parameters in a function parameter list.

diff --git a/drivers/media/dvb-frontends/Kconfig b/drivers/media/dvb-frontends/Kconfig
index 2ef2ff2a38ff..8d04e082b50f 100644
--- a/drivers/media/dvb-frontends/Kconfig
+++ b/drivers/media/dvb-frontends/Kconfig
@@ -943,6 +943,13 @@ config DVB_SP2
help
CIMaX SP2/SP2HF Common Interface module.
+config DVB_SI2183
+ tristate "Silicon Labs Si2183 DVB-T/T2/C/C2/S/S2/S2X/ISDB-T demodulator"
%import common.WS
%ignore WS
token: keyword
| identifier
| constant
| string_literal
| punctuator
#!/usr/bin/python3
import sys
import json
import pymysql
from datetime import datetime, timezone
mariadb=pymysql
a = [*sys.argv[1:]]
@Daniel-Abrecht
Daniel-Abrecht / main.c
Created April 11, 2023 21:17
Periodic tty locker
#include <libttymultiplex.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/wait.h>
const static struct tym_super_position_rectangle fullscreen_coordinates = {
.edge[TYM_RECT_TOP_LEFT].type[TYM_P_CHARFIELD].axis[TYM_AXIS_VERTICAL].value.integer = 1,
.edge[TYM_RECT_BOTTOM_RIGHT].type[TYM_P_RATIO].axis = {
[TYM_AXIS_HORIZONTAL].value.real = 1,
[TYM_AXIS_VERTICAL].value.real = 1,
@Daniel-Abrecht
Daniel-Abrecht / example
Last active November 13, 2022 15:21
A program for easily summarizing test results
$ testsuite "Hello World" bash
$$ testsuite Example bash
$$$ testsuite "This will succeed" true
$$$ testsuite "This will fail" false
$$$ testsuite "This will not start" 123
execvp: No such file or directory
$$$ exit
$$ testsuite "Another Test" test 1 = 1
$$ exit
success
#!/bin/bash
# The MIT License (MIT)
#
# Copyright © 2022
#
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the “Software”), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@Daniel-Abrecht
Daniel-Abrecht / alsa_all.c
Last active October 31, 2021 19:37
Makes all alsa devices available to jack using alsa_in and alsa_out programs. Polls alsa hw devices every 5 seconds to spawn / kill alsa_out programs as needed.
#define _DEFAULT_SOURCE
#include <stdio.h>
#include <spawn.h>
#include <alloca.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <signal.h>
#include <assert.h>
#include <stdbool.h>
@Daniel-Abrecht
Daniel-Abrecht / dpajail
Last active February 3, 2024 17:30
A simple jail using unprivileged userspace namespaces
#!/bin/sh
set -e
PATH="/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin"
self="$(realpath "$0")"
rodirs="
bin
sbin
@Daniel-Abrecht
Daniel-Abrecht / mount.ovtmp
Last active October 19, 2021 08:43
Put this script at /sbin/mount.ovtmp . Script for tmpfs overlays. Put a line for mounting an "ovtmp" fs into fstab, and it'll use a tmpfs and overlayfs to mount over the target. Useful if the root is readonly, but changes need to be possible but don't need persistance.
#!/bin/sh
set -e
cleanup(){
set +e
if [ -n "$tmp" ]
then
umount -l "$tmp" 2>/dev/null
rmdir "$tmp"