This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#if __has_include(<component-version.h>) | |
/* as invoked by Makefile, regardless of cmsis-atmel version */ | |
#include <component-version.h> | |
#include <samd51.h> | |
#else | |
/* as invoked by a certain ide, in case people want to use it to test modules in isolation */ | |
#include <samd51/include/component-version.h> | |
#include <samd51/include/samd51.h> | |
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# richard campbell | |
# isc license | |
# | |
# assumptions/caveats: | |
# - this script is run by bash 3.2+, produces a Makefile suitable for gnu make 3.81+ | |
# - targets to build have a main function in a .c file of the same name | |
# - each module depended upon is in the same directory | |
# - each module depended upon consists of one .c and one .h file | |
# - if you need to link in external libraries, you still need to manually provide those to make via LDLIBS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "one_interval_has_elapsed.h" | |
#if defined(__AVR__) | |
#include <avr/power.h> | |
#if 1 | |
/* avr using timer2 and SLEEP_MODE_PWR_SAVE, uses 400-800 uA at 3.3V depending on clock speed */ | |
#include <avr/io.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
find . -type f \( -name '*.c' -o -name '*.h' -o -name '*.py' \) \ | |
-not -name 'main*' \ | |
-not -name '__init__.py' \ | |
-not -name 'version.h' \ | |
-not -name 'ViewController.h' \ | |
-not -name 'AppDelegate.h' \ | |
-not -name 'test.c' \ | |
-not -name 'config.h' -exec cksum {} + | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -e | |
for repo in $(find . -mindepth 2 -type d -name '.git' | sed -e 's/\/.git//'); do | |
(cd $repo && | |
git diff --exit-code HEAD && | |
git log --decorate --oneline | head -n1 | grep origin | |
) 1>/dev/null || printf '"%s" has uncommitted or unpushed changes\n' $(basename $repo) >&2 | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl -w | |
use strict; | |
use Fcntl qw(:DEFAULT :flock); | |
if (!@ARGV) { die "Usage: $0 fd | { lockfile prog args }\n"; } | |
# get a filehandle to either the supplied filename or fd, depending on whether it is an integer | |
open(my $fh, $ARGV[0] =~ /^\d+$/ ? ">&=" : ">", $ARGV[0]) or die "cannot open: $!\n"; | |
# flock the filehandle |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* allows c code to printf() within arduino sketches, given arm newlib or avr-libc */ | |
#ifdef __arm__ | |
/* TODO: proper check for newlib */ | |
#ifdef USE_TINYUSB | |
#include <Adafruit_TinyUSB.h> | |
#endif | |
#include <Arduino.h> | |
extern "C" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* demo of a three thread generator-style pipeline where the middle thread is a child process, with | |
which communication happens via its stdin and stdout */ | |
#include <stdlib.h> | |
#include <string.h> | |
#include <errno.h> | |
#include <stdio.h> | |
#include <unistd.h> | |
#include <sys/wait.h> | |
#include <pthread.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import sys | |
import os | |
def plot_image_vs_time(data, timestamps, x0, dx, xlabel, title=None): | |
import datetime | |
try: | |
import numpy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# campbell, 2022-2023 | |
# Given a mesh of already-mutually-known peers, initially not fully connected with non-stale | |
# handshakes, this script will propagate knowledge of current endpoints to peers which need | |
# them, such that in the steady state, the network is fully-connected and will self-heal if | |
# an endpoint moves around. | |
# This conservative implementation requires that a peer already be known to wireguard in | |
# order to have its endpoint updated. No provision is made for having peers forward traffic |
NewerOlder