Skip to content

Instantly share code, notes, and snippets.

View jkone27's full-sized avatar
🌴
On vacation

gparmigiani jkone27

🌴
On vacation
View GitHub Profile
@jkone27
jkone27 / SwaggerRequiredSchemaFilter.cs
Created January 31, 2025 10:55
Required Schema filter to remove nullable properties from required list in Swagger generation in aspnetcore
namespace App.Swagger.Filters;
using System;
using System.Linq;
using System.Reflection;
using Microsoft.OpenApi.Models;
using Swashbuckle.AspNetCore.SwaggerGen;
/*
services.AddSwaggerGen(c =>
@jkone27
jkone27 / fileDownloaderFsharp.fsx
Created January 20, 2025 14:07
file downloader F#
#r "nuget: Microsoft.ML"
#r "nuget: Microsoft.ML.OnnxTransformer"
#r "nuget: System.Net.Http"
#r "nuget: Downloader"
// Import required namespaces
open System
open Downloader
let downloadFileWithProgress (destinationPath: string) (url: string) =
@jkone27
jkone27 / spectreConsoleHttpDownloadProgress.fsx
Last active January 20, 2025 12:38
spectre console F# SpectreCoff HTTP file download with progress bar
#r "nuget: EluciusFTW.SpectreCoff, 0.49.12"
open System
open System.IO
open System.Net.Http
open System.Threading.Tasks
open SpectreCoff.Progress
open SpectreCoff
// Function to download a file with a progress bar
@jkone27
jkone27 / fantomas_extract_namespace_oak.fsx
Last active January 6, 2025 18:26
fantomas extract namespace declaration from oak synthax F# AST
#r "nuget:Fantomas.Core"
open Fantomas.Core
open Fantomas.Core.SyntaxOak
open Fantomas.FCS.Text
open System
(** `namespace A.B.C` : https://fsprojects.github.io/fantomas-tools
Oak (1,0-1,15)
ModuleOrNamespaceNode (1,0-1,15)
ModuleOrNamespaceHeaderNode (1,0-1,15)
@jkone27
jkone27 / falco_openapi.fsx
Last active October 23, 2024 09:49
Falco openapi swagger fsharp
#nowarn "20"
// invoke this script locally to load aspnet dependencies
// https://github.com/TheAngryByrd/IcedTasks/blob/master/generate-sdk-references.fsx
#load "runtime-scripts/Microsoft.AspNetCore.App-latest-8.fsx"
#r "nuget: Falco, 5.0.0-alpha3"
#r "nuget: Falco.OpenApi, 1.0.0-alpha1"
#r "nuget: Swashbuckle.AspNetCore"
open Falco
open Falco.OpenApi
@jkone27
jkone27 / oxpecker_openapi.fsx
Created October 21, 2024 21:50
oxpecker openapi F# swagger
#nowarn "20" // for OOP/ignore values
// invoke this script locally to load aspnet dependencies
// https://github.com/TheAngryByrd/IcedTasks/blob/master/generate-sdk-references.fsx
#load "runtime-scripts/Microsoft.AspNetCore.App-latest-8.fsx"
#r "nuget: Oxpecker"
#r "nuget: Oxpecker.OpenApi"
#r "nuget: Swashbuckle.AspNetCore "
open Microsoft.AspNetCore.Builder
open Microsoft.Extensions.DependencyInjection
@jkone27
jkone27 / orleans-fsharp-actor-model-test.fsx
Created September 30, 2024 10:19
Orleans F# fsx test (not working atm)
#r "nuget: Microsoft.Orleans.Server"
#r "nuget: Microsoft.Extensions.Logging.Console"
#r "nuget: IcedTasks"
open System
open Orleans.Runtime
open Microsoft.Extensions.Hosting
open Orleans.Hosting
open Microsoft.Extensions.Logging
open Microsoft.Extensions.DependencyInjection
@jkone27
jkone27 / semantic_kernel_hugging_chat.fsx
Last active September 16, 2024 16:52
semantic kernel hugging chat completion engine sample
#r "nuget: Microsoft.Extensions.DependencyInjection"
#r "nuget: Microsoft.Extensions.Http"
#r "nuget: Microsoft.Extensions.Logging.Console"
#r "nuget: Microsoft.Extensions.Logging"
#r "nuget: Microsoft.SemanticKernel.Connectors.HuggingFace, 1.12.0-preview"
open Microsoft.SemanticKernel
open Microsoft.SemanticKernel.ChatCompletion
open Microsoft.Extensions.Logging
@jkone27
jkone27 / sdkman_oracle_jdk_macos.sh
Last active July 29, 2024 00:13 — forked from smola/sdkman_oracle_jdk.sh
Install Oracle JDK 8 for use with SDKMAN (test macos not working)
#!/bin/bash
#
# not working atm, Install Oracle JDK 8 for use with SDKMAN on macOS
# download not working...to fix
#
# https://download.oracle.com/otn/java/jdk/8u401-b10/4d245f941845490c91360409ecffb3b4/jdk-8u401-macosx-x64.dmg
# https://gist.github.com/wavezhang/ba8425f24a968ec9b2a8619d7c2d86a6
set -eu
@jkone27
jkone27 / fsharp-minimal-api.fsx
Last active March 7, 2024 12:26
F# aspnetcore minimal API working with OpenApi specs
#load "runtime-scripts/Microsoft.AspNetCore.App-latest-8.fsx"
// to gen the above run this script in the local folder
// https://raw.githubusercontent.com/TheAngryByrd/IcedTasks/master/generate-sdk-references.fsx
#r "nuget: Feliz.ViewEngine"
#r "nuget: Microsoft.AspNetCore.OpenApi"
#r "nuget: Swashbuckle.AspNetCore"
open Microsoft.AspNetCore
open Microsoft.AspNetCore.Builder