Skip to content

Instantly share code, notes, and snippets.

View praeclarum's full-sized avatar

Frank A. Krueger praeclarum

View GitHub Profile
@praeclarum
praeclarum / Globe.cs
Created April 9, 2023 16:02
Renders a 3D globe using SHP files
class Globe : Scene
{
const double PI = Math.PI;
const double DegToRad = PI / 180.0;
public const double EarthRadius = 2.0;
const double EarthFlattening = 1.0/298.257223563;
const double EarthFF = (1.0 - EarthFlattening) * (1.0 - EarthFlattening);
public const double CameraDistance = 50.0;
@praeclarum
praeclarum / OpenIVProcNames.txt
Created March 7, 2023 00:40
List of procedures in the OpenIV app
$00965170 Rage.AI.NavigationMesh..navSectorData
$009687CC Rage.AI.NavigationMesh.navAABB.GetMax
$009687F8 Rage.AI.NavigationMesh.navAABB.GetMin
$00967C18 Rage.AI.NavigationMesh.navMesh.addInnerBlocks
$00967CD0 Rage.AI.NavigationMesh.navMesh.Create
$00967E8C Rage.AI.NavigationMesh.navMesh.getCenterPoint
$00968524 Rage.AI.NavigationMesh.navPoly.getVertexCount
$009685B0 Rage.AI.NavigationMesh.navPoly.setVertexCount
$0096D4D8 Rage.Audio2.IO.Bank..TRageAudio2BankContainer
$00977C70 Rage.Audio2.IO.Container..TBaseRageAudio2File
@praeclarum
praeclarum / mactestflight.yaml
Created January 5, 2023 19:22
GitHub Actions to build a Mac AppStore app
- name: Import Apple Certificate
uses: apple-actions/import-codesign-certs@v1
with:
create-keychain: true
keychain-password: ${{ secrets.APPSTORE_CERTIFICATE_P12_PASSWORD }}
p12-file-base64: ${{ secrets.APPSTORE_CERTIFICATE_P12 }}
p12-password: ${{ secrets.APPSTORE_CERTIFICATE_P12_PASSWORD }}
- name: Import Mac Installer Certificate
uses: apple-actions/import-codesign-certs@v1
@praeclarum
praeclarum / CoreMLImport.fs
Created March 10, 2022 01:48
Shows how to import CoreML files using F# and the CoreML Protocol Buffers
module Neural.CoreMLSupport
open Data
open Neural.Layers
open CoreML.Specification
open FSharp.NativeInterop
#nowarn "9"
let rec modelDataFromCoreML (min : System.IO.Stream) : ModelData =
@praeclarum
praeclarum / MPSGraphMnistTest.cs
Created March 3, 2022 22:22
Translation of Apple's MPSGraph MNIST sample to Xamarin.iOS
#nullable enable
using System;
using System.Collections.Generic;
using System.IO;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using Foundation;
using Metal;
@praeclarum
praeclarum / Database.fs
Created February 16, 2022 17:11
An immutable database with reference entities, cascading deletes, undo buffers, serialization, and reactive variables
namespace Neural
type Id = System.String
type Id<'T> =
| Id of Id
override this.ToString () = match this with Id id -> id
type IEntity =
abstract References : Id seq with get
abstract DeleteReference : Id -> IEntity option
@praeclarum
praeclarum / build-net6-apple.yml
Last active January 29, 2022 15:35
GitHub jobs to build and deploy .NET 6 apps multi-targeting iOS and macOS
name: Build and Test
on:
pull_request:
push:
branches:
- main
schedule:
- cron: '13 13 * * *'
@praeclarum
praeclarum / NNControl.c
Created October 28, 2021 19:19
C code implementing the neural network that I trained to control my balancing robot
#include "NNControl.h"
#include <math.h>
extern const float nncontrol_dense_74_weights0[320]; // (5, 64)
extern const float nncontrol_dense_74_weights1[64]; // (64,)
extern const float nncontrol_dense_75_weights0[4096]; // (64, 64)
extern const float nncontrol_dense_75_weights1[64]; // (64,)
extern const float nncontrol_dense_76_weights0[64]; // (64, 1)
static const float tf_math_multiply_69_Mul_0_const0[1] = {0};
@praeclarum
praeclarum / MinimalOoui.cs
Created June 6, 2021 17:26
Minimal Ooui application
using System;
using Ooui;
namespace MinimalOoui
{
class Program
{
static Element CreateUI()
{
@praeclarum
praeclarum / read_rotary.c
Created April 16, 2021 18:07
Arduino code to get clean values from even the noisiest and silliest rotary encoder
// 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;