Skip to content

Instantly share code, notes, and snippets.

@jdek
jdek / config.txt
Last active February 21, 2020 15:01
Easily build UEFI module for the Raspberry Pi 4, also fetches fixup4.dat, start4.elf. Resulting firmware is in ./uefi/output/
[rpi4]
## enable 64bit
arm_64bit=1
enable_gic=1
## load UEFI
armstub=RPI_EFI.fd
## load device tree
# device_tree_address=0x20000
@jdek
jdek / serial_logger.h
Last active February 7, 2020 11:45
Serial logging helper for Arduino programs
/**
* SPDX-License-Identifier: MIT
*
* Arduino logging utility (with logging levels)
* =============================================
*
* Settings
* --------
*
* E_LEVEL: set the desired maximum logging level to be displayed, the default
@jdek
jdek / llvm-rc-windres.c
Last active March 12, 2018 19:15
cc -g -pedantic -Werror -Wall -Wno-unused-variable -o windres windres.c -DFORK
#include <getopt.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
#include <pthread.h>
#include <sys/stat.h>
// cc -g -pedantic -Werror -Wall -Wno-unused-variable -o windres windres.c -DFORK
#!/bin/sh -e
DIR=$(cd -P -- "$(dirname -- "$(command -v -- "$0")")" && pwd -P)
# Returns the number of processor cores available
# Usage: num_cpus
num_cpus()
{
# This *should* be available on literally everything, including OSX
getconf _NPROCESSORS_ONLN