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 | |
# Get around the "stty not persistent" issue on macOS (works fine on linux too) | |
# Usage: ./catty.sh /dev/cu.SLAB_USBtoUART 115200 | |
exec 3<>$1 | |
stty speed $2 <&3 >/dev/null | |
exec cat <&3 |
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
see https://github.com/rlcamp/coroutine |
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
/* standalone test case for https://github.com/kaniini/libucontext/issues/2 | |
# compile libucontext: | |
git clone --depth 1 https://github.com/kaniini/libucontext.git | |
cd libucontext | |
make FREESTANDING=yes libucontext.a | |
# and then compile this test case: | |
cc -Wall -Wextra -Wshadow -Os -o libucontext_fp_test libucontext_fp_test.c -I${HOME}/Downloads/libucontext/include/ ${HOME}/Downloads/libucontext/libucontext.a | |
*/ |
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
/* isc license probably */ | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <errno.h> | |
#include <string.h> | |
#include <time.h> | |
#include <unistd.h> | |
#include <fcntl.h> | |
#include <poll.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
#include "lora_minimalist.h" | |
#include "lora_minimalist_hal.h" | |
unsigned char lora_minimalist_recv_buffer[242]; | |
volatile size_t lora_minimalist_recv_buffer_filled; | |
static struct spi_settings * spi_settings; | |
static volatile enum { STANDBY, TRANSMITTING, RECEIVING } mode, mode_after_tx; | |
static void spi_write_register(uint8_t reg, uint8_t val) { |
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 | |
TMPFILE=$(mktemp) | |
cc -Wall -Wextra -Wshadow -Os -lm -o ${TMPFILE} -x c <(tail -n+$(awk '/^exit$/ { print NR + 1 }' $0) $0) && chmod +x ${TMPFILE} && ${TMPFILE} "$@" | |
rm ${TMPFILE} | |
exit | |
#include <stdio.h> | |
#include <unistd.h> | |
int main(const int argc, const char ** const argv) { |
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
/* blink the LED on the pi zero 2W using /dev/gpiomem, and best-effort realtime timing */ | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <stdint.h> | |
#include <errno.h> | |
#include <string.h> | |
#include <time.h> | |
#include <unistd.h> | |
#include <fcntl.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/bash | |
# TODO: this leaks the session key to arguments visible to ps while decrypting | |
set -euo pipefail | |
# if an argument was provided, use it as the path to the rsa private key, otherwise assume openssh | |
keypath=${1:-"$HOME/.ssh/id_rsa"} | |
# deal with converting openssh special file format to something openssl understands | |
TMPFILE=$(mktemp) | |
cp -p "$keypath" $TMPFILE |
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 |
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 |
OlderNewer