Skip to content

Instantly share code, notes, and snippets.

View dflemstr's full-sized avatar

David Flemström dflemstr

View GitHub Profile
@dflemstr
dflemstr / example.cpp
Last active September 15, 2022 00:31
A C++ implementation of fixed point math
#include "fixedp.h"
#include <iostream>
int main(int, char **)
{
fixedp<true, 16, 16> x(0); //32-bit signed 16.16 fixed-point number
fixedp<false, 8, 8> y(10); //16-bit unsigned 8.8 fixed-point number
std::cout << (fixedp<false, 4, 4>(3.5) + fixedp<false, 4, 4>(4.5)).toFloat() << std::endl;
//prints "8"
--- iampolicy-1.13.1.yaml 2020-08-14 14:19:42.352668574 +0200
+++ iampolicy-1.17.0.yaml 2020-08-14 14:41:04.743959061 +0200
@@ -1,147 +1,183 @@
-apiVersion: apiextensions.k8s.io/v1beta1
+apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
- cnrm.cloud.google.com/version: 1.17.0
- creationTimestamp: null
#include <RGBmatrixPanel.h>
#include <SPI.h>
#include <WiFi101.h>
#include <WiFi101OTA.h>
#define CLK 13
#define OE 1 // TX
#define LAT 0 // RX
#define A A5
#define B A4
@dflemstr
dflemstr / kubeval.ts
Created March 30, 2020 16:13
A kpt function that wraps kubeval and emits validation errors as kpt errors
import {Configs, KubernetesObject, KubernetesObjectError, MultiConfigError} from 'kpt-functions';
import {ChildProcess, spawn} from 'child_process';
import {Writable} from "stream";
const SCHEMA_LOCATION = 'schema_location';
const ADDITIONAL_SCHEMA_LOCATIONS = 'additional_schema_locations';
const IGNORE_MISSING_SCHEMAS = 'ignore_missing_schemas';
const SKIP_KINDS = 'skip_kinds';
const STRICT = 'strict';
import json
import os
import subprocess
from os import path
# Which k8s versions to support; this is only used to support the kubeval --kubernetes-version flag
versions = ["master"]
crd_data = json.loads(
subprocess.check_output(["kubectl", "get", "customresourcedefinitions", "-o", "json"]))
//! Demonstrates an SPI master. We try to read data from
//! an Adafruit AirLift.
#![no_std]
#![no_main]
extern crate panic_halt;
use bsp::hal::gpio::IntoGpio;
use core::fmt::Debug;
\documentclass[a4paper,10pt,swedish]{memoir}
\usepackage{listings}
\usepackage{minted}
%\usepackage{fancyhdr}
\usepackage{xunicode}
\usepackage{xltxtra}
\DeclareUTFcharacter[\UTFencname]{x00A0}{\nobreakspace}
\usepackage{polyglossia}
\usepackage[pdfusetitle,bookmarks=true,
From b4ac57c946877f8a029c9ccd94b47ad9b1af8541 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?David=20Flemstr=C3=B6m?= <david.flemstrom@gmail.com>
Date: Fri, 31 Aug 2018 17:40:29 +0200
Subject: [PATCH 1/2] Make build work with yay
---
PKGBUILD | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/PKGBUILD b/PKGBUILD
using Slab as org.marble.block.Slab
using Image as org.marble.special.Image
using CheckpointBlock as org.marble.special.CheckpointBlock
using Transformer as org.marble.special.Transformer
using WinBlock as org.marble.special.WinBlock
using PointOrb as org.marble.special.PointOrb
using LifeOrb as org.marble.special.LifeOrb
using Wall as org.marble.block.Wall
using Lantern as org.marble.block.Lantern
/**
* A list of words.
*/
class WordList {
int maxCapacity = 1024;
String[] words;
/**
* Load the words