Skip to content

Instantly share code, notes, and snippets.

View GuuD's full-sized avatar

Illia Dulskyi GuuD

  • Kyiv, Ukraine
  • 22:15 (UTC +02:00)
View GitHub Profile
@GuuD
GuuD / VList.fs
Last active May 24, 2025 07:03
Implementation of immutable cache-friendly list in F#
module Theli.Collections
open System
open System.Collections.Generic
open System.ComponentModel
open System.Runtime.CompilerServices
open System.Text
open System.Threading
open Microsoft.FSharp.Collections // For ValueOption, etc.
@GuuD
GuuD / Parsing.fs
Last active March 27, 2025 08:30
Exploration of wild experiments for parsing with combinators
module InlineIfLambdaTests.Parsing
open System
open System.Collections.Generic
open System.Numerics
open System.Runtime.CompilerServices
open Microsoft.FSharp.Core
open System.Runtime.InteropServices
type Inl = InlineIfLambdaAttribute
#nowarn "9"
module Core =
open System
open System.Runtime.CompilerServices
open Microsoft.FSharp.Core
open System.Runtime.InteropServices
open Microsoft.FSharp.NativeInterop
[<RequireQualifiedAccess>]
module Stack =
let inline alloc<'t when 't: unmanaged> (count: int) =
let mutable ref = NativePtr.toByRef (NativePtr.stackalloc<'t> (count))
@GuuD
GuuD / README.md
Created May 30, 2024 07:43 — forked from Artefact2/README.md
GGUF quantizations overview

Which GGUF is right for me? (Opinionated)

Good question! I am collecting human data on how quantization affects outputs. See here for more information: ggml-org/llama.cpp#5962

In the meantime, use the largest that fully fits in your GPU. If you can comfortably fit Q4_K_S, try using a model with more parameters.

llama.cpp feature matrix

See the wiki upstream: https://github.com/ggerganov/llama.cpp/wiki/Feature-matrix

module Threading =
let private update =
let event = Event<_>()
EditorApplication.update <- System.Delegate.Combine(EditorApplication.update, EditorApplication.CallbackFunction event.Trigger) :?> EditorApplication.CallbackFunction
event.Publish
let private waitTask (op : 't when 't :> System.Threading.Tasks.Task) = async {
while ((op.IsCompleted || op.IsFaulted || op.IsCanceled )|> not) do
do! Async.AwaitEvent update
@GuuD
GuuD / FieldsSrtp.fs
Created May 23, 2023 20:06
Fields and SRTP
open System
open System.Runtime.InteropServices
open System.Runtime.CompilerServices
module EntityId =
type T = int
let inline toValue T = T
let inline key (batch: ^a when ^a : (member EntityId: EntityId.T)): EntityId.T =
batch.EntityId
@GuuD
GuuD / XXHash.fs
Created May 4, 2023 02:48
XXHash64
open System
open System.Runtime.CompilerServices
open Microsoft.FSharp.Core
open System.Runtime.InteropServices
open Microsoft.FSharp.NativeInterop
#nowarn "9"
[<RequireQualifiedAccess>]
module Stack =
@GuuD
GuuD / StubBuilderCE.fs
Created January 16, 2023 16:12 — forked from TheAngryByrd/StubBuilderCE.fs
Computation Expression Stub for F#
open System
// Replace with your type
type MyType<'a> = Async<'a>
type Internal<'a> = MyType<'a>
// Replace with types that feel similar and can be converted to `MyType`
type External1<'a> = System.Threading.Tasks.Task<'a>
type External2<'a> = System.Threading.Tasks.ValueTask<'a>
@GuuD
GuuD / GiraffeAsyncComposer.fs
Created January 16, 2023 16:11 — forked from TheAngryByrd/GiraffeAsyncComposer.fs
F# Giraffe Compose Async SRTP
open System
open Giraffe
open Microsoft.AspNetCore.Http
open System.Threading
open System.Threading.Tasks
module HttpHandlerHelpers=
/// Converts an Async HttpHandler to a normal Giraffe Task based HttpHandler
let inline convertAsyncToTask (asyncHandler : HttpFunc -> HttpContext -> Async<HttpContext option>) (next : HttpFunc) (ctx : HttpContext) : HttpFuncResult =
// step0: quick intro about paket, fake, |> operator and unit
// ------------------ begin ----------------
(*
The problem: lots of boilerplate code to make sure the exit code is being handled properly in our build script.
when we have more steps, the code will smell worse.
*)