Skip to content

Instantly share code, notes, and snippets.

@greed9
greed9 / parse_rtl433.awk
Created March 8, 2025 15:27
Read temperature (or other available measurement) from rtl433 output and display via cowsay command
# Read 433 Mhz telemetry and display selected value via cowsay
# use: rtl_433 -C customary -F json | awk -f parse_rtl433.awk
BEGIN {
# fields delimited by colon or comma
FS=":|,"
}
# if the ID matches and the maasusrement name matches, shell cowsay
{
# Fields to examine
// Turntable/sequencer to MIDI
// Tracks numbered zero-relative from the hub outwards
#define TRACK_3_PIN 51
#define TRACK_2_PIN 52
#define TRACK_1_PIN 49
#define TRACK_0_PIN 50
#define FLASH_PIN 4 // Flash LED strips when mark detected
#define INTERRUPT_PIN 48
16
14
17
9
16
14
19
14
7
21
@greed9
greed9 / flares.csv
Last active August 27, 2023 01:07
Example Solar Event CSV file
We can make this file beautiful and searchable if this error is corrected: It looks like row 5 should actually have 1 column, instead of 12 in line 4.
# From : solar-geophysical-event-reports.txt
# Use: wget https://services.swpc.noaa.gov/text/solar-geophysical-event-reports.txt
# Archived data is available as listed here:
# wget ftp://ftp.swpc.noaa.gov/pub/indices/events/
event,begin,begin_date_time,begin_epoch_time,Max,End,Obs,Q,Type,Loc/Frq,Particulars,Reg
4400,0000,2023-8-23-00-00-0,1692763200,0005,0022,LEA,3,FLA,N11W29,SF,
4400,0000,2023-8-23-00-00-0,1692763200,-1,0900,LEA,C,RSP,025-180,VI/2,
4400,0000,2023-8-23-00-00-0,1692763200,-1,0959,LEA,C,RSP,025-180,CTM/2,
4410,0120,2023-8-23-01-20-0,1692768000,0130,0138,G16,5,XRA,1-8A,C3.4, 2.9E-03
4420,0243,2023-8-23-02-43-0,1692772980,0243,0406,PAL,G,RNS,245,230,
@greed9
greed9 / flares.awk
Last active August 27, 2023 01:06
Awk program to convert NOAA textual solar event files to CSV
# flares.awk
# Convert text file of solar data in the format here:
# https://services.swpc.noaa.gov/text/solar-geophysical-event-reports.txt
# to CSV
#
# see README for some info
BEGIN {
state=0 # init
}
From: ftp://ftp.swpc.noaa.gov/pub/indices/events/README
January 28, 2011
EDITED SOLAR EVENTS LISTS
------------------------------------------------------------------
Jan 28, 2011 -- Edited Events lists from Jan 24 through 28 had bad
Radio and Flare date/times. The files have been corrected.
@greed9
greed9 / tinywav.c
Created February 5, 2023 17:37
Implementation of simple WAV file read/write
/**
* Copyright (c) 2015-2022, Martin Roth ([email protected])
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
@greed9
greed9 / tinywav.h
Created February 5, 2023 17:35
Header file with WAV struct types
/**
* Copyright (c) 2015-2022, Martin Roth ([email protected])
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
@greed9
greed9 / example_wav.c
Created February 5, 2023 17:32
Example of reading (and possibly modifying) a 16 or 32 bit WAV file.
/**
* Copyright (c) 2015-2022, Martin Roth ([email protected])
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
@greed9
greed9 / ascii_fft_disp_curses.c
Created October 8, 2022 20:17
Display integer fft results from stdin as ascii chars using ncurses. Ugly but fast
#include <stdio.h>
#include <errno.h>
#include <string.h>
// based in part on: https://www.linuxjournal.com/content/getting-started-ncurses
#include <curses.h>
#include <stdlib.h>
#define FFT_SIZE (256)
#define ABS(x) ( (x )< 0 ? -(x) : (x))