Skip to content

Instantly share code, notes, and snippets.

View ruxo's full-sized avatar

Ruxo ruxo

  • Bangkok
View GitHub Profile
#!/usr/bin/env pwsh
<#
.SYNOPSIS
Removes outdated podman or docker images, keeping only the newest tag(s) per repository.
.DESCRIPTION
Groups every tagged image by repository, orders each group by creation date and
removes everything past the newest -Keep tags. Repositories with a single tag
(base images such as mcr.microsoft.com/dotnet/sdk) are therefore never touched.
@ruxo
ruxo / SKILLS.md
Last active July 1, 2026 01:31
Better AI search
name vet-search
description Vet web-search results by source authority, aim, and recency, then answer in confidence tiers.

Vet-Search

Treat every search result as a witness to cross-examine, not a fact to copy. Rank each result on three axes — Authority · Aim · Age — then answer in confidence tiers, each citing the sources that earned it.

Process

// #r "nuget: TiraxTech.Uri"
open System
open System.Net
open System.Net.Http
open System.Text.Json
open Microsoft.Extensions.Primitives
open RZ.Foundation.Json
open TiraxTech
@ruxo
ruxo / Program.fs
Last active November 14, 2024 10:09
This sample project shows how to use .NET Selenium WebDriver to create a Facebook for submitting a post. It is an adaptation from the Python bot https://github.com/darideveloper/facebook-groups-post-bot/tree/master, but with updated algorithm for pos
open System
open PostBot
open FSharp.UMX
let [<Literal>] ChromeFolder = @"C:\Users\user-name\AppData\Local\Google\Chrome\User Data"
Scraper.killChrome()
let driver = Scraper.startBrowser { Scraper.StartBrowserOptions.Default with ChromeFolder = ValueSome ChromeFolder }
using System.Collections.Frozen;
using System.Runtime.CompilerServices;
using System.Text.Json;
using System.Text.Json.Nodes;
using Akka.Actor;
using Akka.DependencyInjection;
using Akka.IO;
using Microsoft.Extensions.Logging;
using TCRB.CoreApp;
@ruxo
ruxo / run-helpers.fsx
Last active June 1, 2024 23:48
A helper library to assist running multiple command lines and combine their output into the current console. See `sample.fsx` about how to use it. To run the sample, use the command line `dotnet fsi sample.fsx`
[<AutoOpen>]
module RunHelpers
#r "nuget: FSharp.Control.Reactive"
open System
open System.Diagnostics
open System.IO
open System.Threading
open FSharp.Control.Reactive
@ruxo
ruxo / Program.cs
Last active April 8, 2024 13:23
Show how to use LanguageExt's Eff(ect) with memo to cache value.Note that `LanguageExt.Core` library is needed for running.
using System;
using LanguageExt;
using static LanguageExt.Prelude;
public static class Program {
public static void Main (string[] args) {
var program =
from v1 in Load
from _1 in eff(() => Console.WriteLine($"1st value = {v1}"))
from v2 in Load
@ruxo
ruxo / pinger.fsx
Last active February 24, 2024 12:15
Simple example of Akka.Net remoting. To run the example, start Ponger first. ``` dotnet fsi ponger.fsx ``` Then start Pinger in another terminal. ``` dotnet fsi pinger.fsx ```
#r "nuget:Akka.Remote"
open System
open Akka.Actor
open Akka.Configuration
type Pinger() =
inherit UntypedActor()
let Context = ActorBase.Context
@ruxo
ruxo / ConcurrentMailBox.cs
Last active September 2, 2023 23:10
Simple mailbox processor (Single-thread apartment)
using System.Collections.Concurrent;
using Microsoft.Extensions.Logging;
namespace RZ.Foundation;
/// <summary>
/// A mailbox processor that allows some concurrent dispatching.
/// </summary>
/// <param name="logger">Microsoft Logger</param>
/// <param name="concurrentLimit">Maximum number of concurrent threads allowed to process the mailbox</param>
@ruxo
ruxo / Serializer.cs
Last active August 29, 2023 00:13
LanguageExt's Seq<T> serializer for Mongo DB
using MongoDB.Bson;
using MongoDB.Bson.Serialization;
using MongoDB.Bson.Serialization.Conventions;
using MongoDB.Bson.Serialization.Serializers;
using LanguageExt;
public class SeqSerializationProvider : IBsonSerializationProvider
{
public IBsonSerializer? GetSerializer(Type type)
{