Skip to content

Instantly share code, notes, and snippets.

Avatar

Frank A. Krueger praeclarum

View GitHub Profile
@praeclarum
praeclarum / MinimalOoui.cs
Created Jun 6, 2021
Minimal Ooui application
View MinimalOoui.cs
using System;
using Ooui;
namespace MinimalOoui
{
class Program
{
static Element CreateUI()
{
@praeclarum
praeclarum / read_rotary.c
Created Apr 16, 2021
Arduino code to get clean values from even the noisiest and silliest rotary encoder
View read_rotary.c
// From https://www.best-microcontroller-projects.com/rotary-encoder.html
static uint8_t prevNextCode = 0;
static uint16_t store=0;
int8_t read_rotary() {
static int8_t rot_enc_table[] = {0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0};
prevNextCode <<= 2;
if (digitalRead(RIGHT_PIN)) prevNextCode |= 0x02;
@praeclarum
praeclarum / Rainfall.md
Created Apr 7, 2021
Rainfall using Calca
View Rainfall.md

Rainfall in Gallons

I wonder how much water falls on land throughout the year? We can use a [rainfall database][rdb] to find out how much it rains in Seattle and then use Calca's unit conversion support to help us determine that.

land area = 0.25 acre

avg annual precip = 36.15 inch / year

daily rain accumulation
 = avg annual precip * land area
@praeclarum
praeclarum / JamesSubsMatrix.ino
Created Mar 28, 2021
Arduino code to print James' subscriber count
View JamesSubsMatrix.ino
// ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
#include "secrets.h"
const char* ssid = SECRET_SSID; // SSID of local network
const char* password = SECRET_PASSWORD; // Password on network
const long UPDATE_INTERVAL_MILLIS = 10L * 60L * 1000L;
//const long UPDATE_INTERVAL_MILLIS = 1L * 1000L;
@praeclarum
praeclarum / Info.plist
Created Oct 18, 2020
Plist for QL thumbnails
View Info.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDisplayName</key>
<string>iCircuit Thumbnails</string>
<key>CFBundleName</key>
<string>CircuitThumbs</string>
<key>CFBundleIdentifier</key>
<string>com.kruegersystems.circuit.thumbs</string>
@praeclarum
praeclarum / Migrations.cs
Created Aug 30, 2020
Database migrations using Dapper
View Migrations.cs
using System;
using System.Linq;
using Microsoft.Extensions.Logging;
using Dapper;
namespace Data
{
public class Migrations
{
private readonly Database database;
View gist:75e217e58ee891ca5373a478c8c56f05
var a = 10;
var b = 200;
Console.WriteLine((a > b) ? a : b);
Console.WriteLine((a > b) ? b : a);
Console.WriteLine(Math.Max(a, b));
Console.WriteLine(Math.Min(a, b));
@praeclarum
praeclarum / DataGridView.swift
Created Jun 28, 2020
Data Grid SwiftUI using LazyVGrid
View DataGridView.swift
//
// DataGridView.swift
// Predictor
//
// Created by Frank A. Krueger on 6/25/20.
//
import SwiftUI
struct Column: Identifiable {
@praeclarum
praeclarum / MeadowEnclosure.js
Created May 22, 2020
OpenJSCAD source code for the Meadow Enclosure shown at the Wilderness Labs Dev Camp
View MeadowEnclosure.js
var resolution = 50;
var printerError = 0.05;
var xsize = 100;
var ysize = 100;
var height = 20;
@praeclarum
praeclarum / build.sh
Created Apr 12, 2020
Ooui.Wasm.Test build script
View build.sh
#!/bin/bash
msbuild ../Ooui.Wasm.Build.Tasks/Ooui.Wasm.Build.Tasks.csproj && cp ../Ooui.Wasm.Build.Tasks/bin/Debug/netstandard2.0/Ooui.Wasm.Build.Tasks.dll ./ && msbuild /t:Restore && msbuild Ooui.Wasm.Test.csproj