Skip to content

Instantly share code, notes, and snippets.

View battlesnake's full-sized avatar
🇪🇺

Mark Cowan battlesnake

🇪🇺
View GitHub Profile
@battlesnake
battlesnake / react-context.js
Created October 28, 2023 15:28
Playing with react Context hook, in playcode.io/react
import React from 'react';
const Ctx = React.createContext();
function Editor(props) {
const [value, setValue] = React.useContext(Ctx);
return (
<input type="number" value={value} onChange={React.useCallback(e => setValue(e.target.value), [])} />
);
}
@battlesnake
battlesnake / 0-spec.txt
Last active October 19, 2022 07:31
STM32H750 DMA-based memcpy performance
Max clocks (480MHz CPU/SysTick, 240MHz AXI+AHB1+AHB2)
Using DMA2 (in D2 domain)
Copying 32-bit non-bursts
@battlesnake
battlesnake / archive-old-branches.sh
Last active January 26, 2022 12:34
Archive Git branches in remote that have not received a commit for x days/weeks/months/years
#!/usr/bin/env bash
set -euo pipefail
declare -a branches=()
# Update our view of the remote
git fetch --all
# Read in names of branches in remote (<remote-name>/<branch-name>), excluding already-archived branches
@battlesnake
battlesnake / audio.html
Created February 3, 2021 21:33
Dirty and simple web audio demo, plotting oscilloscope and spectrum
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Audio stuff</title>
<style>
html,
body {
height: 100%;
padding: 0;