Skip to content

Instantly share code, notes, and snippets.

View keithduncan's full-sized avatar
🌏

Keith Duncan keithduncan

🌏
  • Scotland
View GitHub Profile
@keithduncan
keithduncan / pipe_source.m
Last active May 24, 2016 08:41
Various options for streaming from the read end of a pipe until EOF
/*
pipe_source.m
clang pipe_source.m -o pipe -framework Foundation -D [ USE_SOURCE | USE_IO | USE_FILEHANDLE [ FILEHANDLE_READABILITY | FILEHANDLE_WAIT ] ]
*/
#import <Foundation/Foundation.h>
int main(void) {
enum RunLoop {
@keithduncan
keithduncan / buildkite_agent_step_function.json
Created March 5, 2019 11:19
An AWS step function to register and ping multiple virtual Buildkite agents.
{
"StartAt": "RegisterBuildkiteAgents",
"TimeoutSeconds": 1800,
"States": {
"RegisterBuildkiteAgents": {
"Type": "Pass",
"Result": {
"TaskDefinitions": {
"Definitions": [],
"Count": 0
mod mcu {
extern crate atsamd_hal as hal;
pub use hal::target_device::*;
pub use hal::*;
}
pub fn configure_eic(pm: &mut mcu::PM, clocks: &mut mcu::clock::GenericClockController, eic: &mut mcu::EIC) {
pm.apbamask.modify(|_, w| w.eic_().set_bit());
@keithduncan
keithduncan / dma_buffer.rs
Last active February 14, 2020 12:38
Static DMA buffer for http://github.com/atsamd-rs/atsamd samd21
use core::{
marker::PhantomData,
mem::MaybeUninit,
ops::{Mul, Sub},
ptr::{self, NonNull},
};
use crate::board::mcu::dmac;
use generic_array::{