Skip to content

Instantly share code, notes, and snippets.

View kurtschelfthout's full-sized avatar
🙃

Kurt Schelfthout kurtschelfthout

🙃
View GitHub Profile
@kurtschelfthout
kurtschelfthout / repro.rs
Last active May 27, 2023 13:06
wgpu memory leak repro
use std::borrow::Cow;
use wgpu::util::DeviceExt;
async fn get_device_async() -> Option<(wgpu::Device, wgpu::Queue)> {
// Instantiates instance of WebGPU
let instance = wgpu::Instance::default();
// Use the util method to respect the env vars `WGPU_POWER_PREF` and `WGPU_ADAPTER_NAME`
// WGPU_POWER_PREF can be set to `low` or `high` to prefer integrated or discrete GPUs respectively.
@kurtschelfthout
kurtschelfthout / conftest.py
Last active September 2, 2022 09:22
referenced from pytest-cloudist Medium article for Meadowrun
def pytest_report_teststatus(report):
category, short, verbose = '', '', ''
if hasattr(report, 'wasxfail'):
if report.skipped:
category = 'xfailed'
verbose = 'xfail'
elif report.passed:
category = 'xpassed'
verbose = ('XPASS', {'yellow': True})
return (category, short, verbose)
@kurtschelfthout
kurtschelfthout / hoghug.md
Last active December 17, 2017 11:12
Debunking some hedgehog marketing

Hedgehog in its tutorial provides some marketing that illustrates its "integrated shrinking", claiming that FsCheck cannot do this. There are in fact, a number of ways to rewrite their example so it also shrinks in FsCheck.

The original example hedgehog gives is:

let version =
    Arb.generate<byte>
    |> Gen.map int
    |> Gen.three
@kurtschelfthout
kurtschelfthout / overloads-solution.fsx
Last active August 29, 2015 14:27
Overload resolution and inline tricks puzzler
type Term<'a>() = class end
let termint = Term<int>()
let termint2 = Term<int>(), Term<int>()
type Tuples = Tuples with
static member Eq(a:Term<'a>,a':Term<'a>) = 0
static member Eq((a:Term<'a>,b:Term<'b>), (c:Term<'a>, d:Term<'b>)) = 2
static member Eq(a:bool, b:bool) = 3
//this overload is apparantely crucial: see kvb's comment on Gustavo's answer here:http://stackoverflow.com/questions/2812084/overload-operator-in-f

Keybase proof

I hereby claim:

  • I am kurtschelfthout on github.
  • I am kurts (https://keybase.io/kurts) on keybase.
  • I have a public key whose fingerprint is 6DBE 6C4A 6B2E 305B E052 5DA8 DF48 CCF0 F1BF 2218

To claim this, I am signing this object:

@kurtschelfthout
kurtschelfthout / Generate
Created February 15, 2014 16:25
FSharp.Formatting gains fsi evaluation support
let relative subdir = Path.Combine(__SOURCE_DIRECTORY__, subdir)
/// Processes a single F# Script file and produce HTML output
let processScriptAsHtml () =
let file = relative "QuickStart-Formatting.fsx"
let output = relative "QuickStart-Formatting.html"
let template = relative "templates/template-file.html"
Literate.ProcessScriptFile(file, template, output, fsiEvaluator=FSharp.Literate.Evaluation.FsiEvaluator(), lineNumbers=false)