Skip to content

Instantly share code, notes, and snippets.

View praeclarum's full-sized avatar

Frank A. Krueger praeclarum

View GitHub Profile
@praeclarum
praeclarum / backup-vscode-chats.sh
Last active April 30, 2026 03:33
Script to copy VS Code AI chats to a backups directory
#!/usr/bin/env bash
# Copy all VS Code chatSessions folders to a backup location, preserving timestamps.
set -euo pipefail
SRC="$HOME/Library/Application Support/Code/User/workspaceStorage"
DEST="$HOME/Dropbox/Backups/VSCodeChatSessions"
if [ ! -d "$SRC" ]; then
echo "Source directory not found: $SRC" >&2
@praeclarum
praeclarum / clean_bin_obj.fish
Last active April 18, 2026 05:45
Fish function to recursively delete all bin and obj files in a directory
function clean_bin_obj
argparse --name clean_bin_obj 'n/dry-run' -- $argv
or return $status
set -l dry_run 0
if set -q _flag_n
set dry_run 1
end
set -l roots $argv
@praeclarum
praeclarum / fnn.py
Created January 28, 2026 18:19
Frank's little neural network library
import math
from collections import namedtuple
from typing import Any, Callable, Dict, Optional
import json
import torch
from torch import Tensor
import torch.nn as nn
import torch.nn.functional as F
import torchvision.transforms.v2
@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 * * *'