Skip to content

Instantly share code, notes, and snippets.

View posborne's full-sized avatar

Paul Osborne posborne

View GitHub Profile
@posborne
posborne / SimpleAvControl.lua
Created August 29, 2023 03:25
Generated Simple AV Controller Command Class Code for SmartThings Edge
-- Copyright 2023 SmartThings
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
@posborne
posborne / keybase.md
Created March 15, 2016 02:19
keybase.md

Keybase proof

I hereby claim:

  • I am posborne on github.
  • I am posborne (https://keybase.io/posborne) on keybase.
  • I have a public key ASCUOV5r83dMKJAKG6TMqC3sfw9JnlXAHmAQUMBtJMpfewo

To claim this, I am signing this object:

@posborne
posborne / Example Output
Last active September 1, 2015 17:23
Zinc Debug ELF Files
✘ ⚙  (env)  posborne@povm  ~/Projects/rust-playground/zinc/examples/empty   pwm-support-squashed ●  arm-none-eabi-size -A -d target/thumbv7m-none-eabi/debug/empty pwm-support-squashed [afd7fb0] modified untracked
target/thumbv7m-none-eabi/debug/empty :
section size addr
.data 0 268435456
.vector 204 0
.debug_gdb_scripts 34 204
.text 1164 240
.bss 8 268435456
.ARM.attributes 45 0
.debug_str 966614 0
//
// Generated by svdconvert.py from SVD XML description for device:
// - Device Name: MKL25Z4
// - Description: MKL25Z4 Freescale Microcontroller
// - Device Vendor: Freescale Semiconductor, Inc.
// - Device Version: 1.6
//
use volatile_cell::VolatileCell;
use core::ops::Drop;
This file has been truncated, but you can view the full file.
Archive member included because of file (symbol)
/home/posborne/Projects/rust-playground/zinc/target/thumbv7m-none-eabi/debug/libzinc.rlib(zinc.o)
/home/posborne/Projects/rust-playground/zinc/target/thumbv7m-none-eabi/debug/examples/rgb_pwm_lpc17xx.o (hal::stack::set_stack_limit::ha8bb39f7be8741e5MCF)
/home/posborne/Projects/rust-playground/zinc/target/thumbv7m-none-eabi/debug/deps/librlibc-68a115e07ddb7f5c.rlib(rlibc-68a115e07ddb7f5c.o)
/usr/bin/../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/lib/armv7-m/crt0.o (memset)
/home/posborne/Projects/rust-playground/zinc/target/thumbv7m-none-eabi/debug/deps/libcore-457ad95defb42ceb.rlib(core-457ad95defb42ceb.o)
/home/posborne/Projects/rust-playground/zinc/target/thumbv7m-none-eabi/debug/libzinc.rlib(zinc.o) (slice::_$u5b$T$u5d$.ops..Index$LT$usize$GT$::index::_MSG_FILE_LINE::h3bfbaea36dc5e266YwG)
/usr/bin/../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/lib/a
@posborne
posborne / kl25z_reg.rs
Last active August 29, 2015 14:22
KL25Z Generated ioregs!
use volatile_cell::VolatileCell;
use core::ops::Drop;
ioregs! (FTFA_FlashConfig @ 0x400 = { //! Flash configuration field
0x00 => reg8 backkey3 { //! Backdoor Comparison Key 3.
8..0 => key: ro, //= Backdoor Comparison Key.
},
0x01 => reg8 backkey2 { //! Backdoor Comparison Key 2.
8..0 => key: ro, //= Backdoor Comparison Key.
},
@posborne
posborne / k20.json
Created May 19, 2015 06:36
zinc k20 json (testing)
{
"arch": "arm",
"cpu": "cortex-m4",
"data-layout": "e-m:e-p:32:32-i1:8:32-i8:8:32-i16:16:32-i64:64-v128:64:128-a:0:32-n32-S64",
"disable-redzone": true,
"executables": true,
"llvm-target": "thumbv7m-none-eabi",
"morestack": false,
"os": "none",
"relocation-model": "static",
#include <linux/ioctl.h>
#include <stdio.h>
int main(int argc, char **argv) {
printf("_IO('q', 10) => 0x%08lX\n", (unsigned long int)_IO('q', 10));
printf("_IO('a', 255) => 0x%08lX\n", (unsigned long int)_IO('a', 255));
printf("_IOW('z', 10, char[1]) => 0x%04lX\n", _IOW('z', 10, char[1]));
printf("_IOW('z', 10, char[512] => 0x%04lX\n", _IOW('z', 10, char[512]));
printf("_IOW('z', 10, char[1 << 32] => 0x%04lX\n", _IOW('z', 10, char[1 << 32])); // _IOC_SZ_BITS = 14
@posborne
posborne / closure.c
Created February 17, 2015 04:24
Closures in C using libffi closures API
#include <stdio.h>
#include <ffi.h>
#include <stdlib.h>
/* Acts like puts with the file given at time of enclosure. */
void puts_binding(ffi_cif *cif, void *ret, void* args[], void *stream) {
*(ffi_arg *) ret = fputs(*(char **) args[0], (FILE *) stream);
}
typedef int (*puts_t)(char *);