Skip to content

Instantly share code, notes, and snippets.

View praeclarum's full-sized avatar

Frank A. Krueger praeclarum

View GitHub Profile
@praeclarum
praeclarum / AlgorithmW.fs
Last active March 19, 2024 17:44
Algorithm W - or Hindley-Milner polymorphic type inference - in F#
module AlgorithmW
// HINDLEY-MILNER TYPE INFERENCE
// Based on http://catamorph.de/documents/AlgorithmW.pdf
// (Now at http://web.archive.org/web/20170704013532/http://catamorph.de/documents/AlgorithmW.pdf)
type Lit =
| LInt of int
| LBool of bool
@praeclarum
praeclarum / EasyLayout.cs
Last active April 21, 2023 10:28
**OUT OF DATE** Please use the NuGet package https://www.nuget.org/packages/EasyLayout or the code on GitHub https://github.com/praeclarum/EasyLayout. (EasyLayout makes writing auto layout code in Xamarin.iOS easier. See [the example](https://gist.github.com/praeclarum/8185036) for hints on how to use this library.)
//
// Copyright (c) 2013-2015 Frank A. Krueger
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
@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 / Dark Continuous.json
Created March 6, 2019 17:28
A dark and vibrant color theme for Visual Studio for Mac
{
"name": "Dark Continuous",
"version": "1.0",
"description": "Dark and Vibrant from Continuous for the iPad",
"originator": "Frank A. Krueger",
"palette": [
{ "name": "cont-white", "value": "#F2F2F8" },
{ "name": "cont-selection", "value": "#4B5566" },
{ "name": "cont-background", "value": "#282A2E" },
@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 / Dsp.cs
Created April 9, 2013 19:38
DSP functions for Xamarin.iOS bound to the Accelerate framework. See it in action by buying my Spectrogram app for iOS: https://itunes.apple.com/us/app/live-spectrogram/id630831185
using System;
using System.Runtime.InteropServices;
namespace Circuit
{
public static class Dsp
{
class FftSetupD : IDisposable
{
public IntPtr Handle;
@praeclarum
praeclarum / TileSticher.cs
Created April 10, 2014 22:28
Downloads and stitches map tiles
using System;
using System.Net;
using System.IO;
using Gdk;
namespace TileSticher
{
class App
{
public static int Main (string[] args)
@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 / 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 =