Skip to content

Instantly share code, notes, and snippets.

@schneidersoft
schneidersoft / makefile
Last active June 13, 2025 07:27
openssl server and client using RPK (raw public key) RFC 7250. You must compile against a recent version of libssl that supports RPK.
all:
gcc -Wall -o ssl-rpk -I./openssl/include ssl-rpk.c openssl/libssl.a openssl/libcrypto.a -lm -lc
keys:
openssl ecparam -name prime256v1 -genkey -noout -out server_key.pem
openssl ec -in server_key.pem -pubout -out server_pub.pem
openssl ecparam -name prime256v1 -genkey -noout -out client_key.pem
openssl ec -in client_key.pem -pubout -out client_pub.pem
#! /usr/bin/env python3
"""
Thanks to pyWindeployqt by Alexey Elymanov ([email protected])
This is a python implementation of windeployqt, which is missing in mxe
I don"t know why they disabled it, but here it is.
Example:
@schneidersoft
schneidersoft / Dockerfile
Last active October 31, 2024 09:22
Docker/Podman Multistage container with graceful shutdown
FROM alpine:latest as build
RUN apk add build-base
WORKDIR /tmp
COPY . ./
RUN make
FROM alpine:latest
COPY --from=build /tmp/output /usr/local/bin/output
CMD ["output"]
@schneidersoft
schneidersoft / kbd.c
Last active August 28, 2023 12:47
Manipulate keyboard LEDs from C
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <fcntl.h>
#include <unistd.h>
#include <linux/input.h>
#include <sys/ioctl.h>
struct leds {
const char *name;
@schneidersoft
schneidersoft / main.c
Created August 16, 2023 11:06
set LEDS on your keyboard
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <fcntl.h>
#include <unistd.h>
#include <linux/input.h>
#include <sys/ioctl.h>
struct leds {
const char *name;
@schneidersoft
schneidersoft / jsmn_string.c
Created April 16, 2018 13:02
function for decoding a jsmn string in place.
/*
Jsmn does not decode json strings, so it's up to you to do that.
Incidentally the json string is always going to be longer,
or the same size as the decoded string because of the way escape sequences work.
This means you can decode the json string in place in the original input buffer.
So. After you have parsed the input string into jsm tokens you can call
const char *foo = jsmn_string(buffer, token);
on any token. If the return is not NULL, it is a valid utf8 string.