Skip to content

Instantly share code, notes, and snippets.

View kammce's full-sized avatar

Khalil Estell kammce

  • Bay Area, California
  • 04:54 (UTC -08:00)
View GitHub Profile
@kammce
kammce / EULA.html
Created May 20, 2023 17:01
Arm Gnu Toolchain EULA
This file has been truncated, but you can view the full file.
<div class="modal__header">
<h3 class="title"></h3>
</div>
<div class="modal__body eula-content no-footer"><p>Contains code from project GNU Binutils (https://www.gnu.org/software/binutils/),<br>
GNU Debugger (https://www.gnu.org/software/gdb/) under the following license(s).<br>
<br>
<br>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; GNU GENERAL PUBLIC LICENSE<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Version 3, 29 June 2007<br>
<br>
@kammce
kammce / create_libhal_clangd.sh
Created March 19, 2024 19:58
Use this to create a `.clangd` file for workspace folders containing libhal libraries. Should work with any conan project that generates a `compile_commands.json` file
#!/bin/bash
# Start the .clangd file afresh
echo "" > .clangd
# Get the absolute path to the script's directory
root_dir=$(pwd)
# Iterate over all directories in the current directory
for dir in */ ; do
@kammce
kammce / auto-gh.sh
Created March 23, 2024 07:02
Command to automate deploying sweeping changes through github repos. Pass it a list of github URLs, absolute path to a script and a commit message.
#!/bin/bash
# Check if enough arguments are passed
if [ "$#" -lt 3 ]; then
echo "Usage: $0 <file_with_repo_urls> <path_to_script> <'commit_message'>"
exit 1
fi
REPO_FILE=$1
SCRIPT_PATH=$2
@kammce
kammce / ld2410c.cpp
Last active April 10, 2024 20:54
Quick driver for the ld2410c human presence board
// Copyright 2024 Khalil Estell
//
// 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,
@kammce
kammce / escape_hatch.cpp
Last active October 30, 2024 01:54
A means to escape from an infinite loop using C++ exceptions and interrupts
void read_sensor_data(hal::i2c& p_device)
{
hal::byte status = 0;
do {
status = hal::write_then_read<1>(p_device,
0x11,
std::to_array<hal::byte>({ 0xAA }),
hal::never_timeout())[0];
} while (status & (1 << 5)); // but the sensor is dead 😱 !!!
@kammce
kammce / libhal-coro-attempt.cpp
Created June 5, 2025 14:40
Getting non-heap stack-allocating-like coroutines working
#include <algorithm>
#include <array>
#include <coroutine>
#include <cstddef>
#include <cstdint>
#include <cstdio>
#include <exception>
#include <memory_resource>
#include <numeric>
#include <span>
@kammce
kammce / conan-modules-support-failure.py
Created November 2, 2025 20:21
I made a script to enable module support not realizing that CMake already had the support and that I've been using Conan's CMake libraries incorrectly. I don't need this but thought I'd keep it around.
#!/usr/bin/python
#
# Copyright 2024 - 2025 Khalil Estell and the libhal contributors
#
# 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
#