Skip to content

Instantly share code, notes, and snippets.

View Groostav's full-sized avatar

Geoff Groostav

View GitHub Profile

Getting element type from a Kotlin Array

Context: You are working on project that uses Java SDK version 16., Kotlin API version 1.9. Messages: 8

User: if I have a kotlin Array, how can i get the element type from it? That is, given vars: Array, how can I get a Class?

Groostav /
Created April 26, 2024 03:47
rom description 2024-04-25

Reduced Order Modelling Toolkit

version 0.1. by Empower Operations. Copyright 2023.

This repository contains releases (sans source code) for the Reduced Order Modelling "ROM" toolkit by Empower Operations "empower-rom".

This is the culmination of work from research by Empower Operations under grant from the Government of Canada. We hope it helps you accelerate engineering!

Groostav /
Created September 11, 2023 16:17
attempt 2 at benchmarking different switch types
package org.example;
public class JavaSwitchExpressions {
public static int intSwitchExpression(Node node) {
return switch(node.typeInt()){
case 0 -> ((Node.FirstNodeType) node).firstId();
case 1 -> ((Node.SecondNodeType) node).secondId();
case 2 -> ((Node.ThirdNodeType) node).thirdId();
case 3 -> ((Node.FourthNodeType) node).fourthId();
Groostav /
Created September 6, 2023 23:13
attempting to performance profile forms java switch expressions
package org.example;
import org.openjdk.jmh.annotations.*;
import java.util.concurrent.TimeUnit;
@Warmup(iterations = 5, time = 5)
@Measurement(iterations = 5, time = 1)
parser = argparse.ArgumentParser()
subparsers = parser.add_subparsers(dest='command')
parsed_args = parser.parse_args()
match vars(parsed_args):
Groostav / dumb-dsl.kt
Last active March 1, 2023 22:46
An attempt to create a statically-checked "domain-path" type
sealed interface PathTrace<out T> {
val elements: List<Nodable>
class Composite(override val elements: List<Nodable>): PathTrace<Nothing>
open class Empty: PathTrace<Nothing> {
override val elements: List<Nodable> get() = emptyList()
Groostav / output_log.txt
Last active June 6, 2022 21:56
"prop counting failure!" w/ traffic light replacer on load & when changing light set.
This file has been truncated, but you can view the full file.
Initialize engine version: 5.6.7f1 (e80cc3114ac1)
GfxDevice: creating device client; threaded=1
Version: Direct3D 11.0 [level 11.1]
Renderer: AMD Radeon RX 5700 XT (ID=0x731f)
Vendor: ATI
VRAM: 8151 MB
Driver: 30.0.13023.4001
Begin MonoManager ReloadAssembly
Platform assembly: H:\SteamLibrary\steamapps\common\Cities_Skylines\Cities_Data\Managed\UnityEngine.dll (this message is harmless)
Groostav / DoubleArrayHashList.kt
Created October 12, 2021 20:01
a first crack at an implementation of a reasonably compact matrix with fast indexOf(row) and contains(row) operations
package com.empowerops.jargon.model.opt2
import java.lang.IndexOutOfBoundsException
* Why, why on gods green earth would you implement this geoff!?
* Ok, after studying the access patterns, we need fast contains and fast indexOf.
* fast contains is easily provided by hashMap,
* to get indexOf, you want a NavigableSet (indexOf(elem) == headSet(elem).size)
package com.empowerops.visualizer;
import com.empowerops.common.*;
import com.empowerops.common.eventbus.EventBus;
import com.empowerops.common.ui.FXController;
import com.empowerops.common.ui.FXMLLoader;
import com.empowerops.dal.OptimizationMetadata;
import com.empowerops.dal.OptimizationModel;
import com.empowerops.jargon.OptimizerService;
Groostav / More-Testing-Try-Catch.ps1
Last active October 9, 2020 20:28
what is powershells Stop-Process doing
Write-Host "Host Version:" $Host.Version
Write-Host "before!"
Stop-Process 123456789 -EA Stop
Write-Host "after!"