Skip to content

Instantly share code, notes, and snippets.

View odytrice's full-sized avatar

Ody Mbegbu odytrice

View GitHub Profile
@odytrice
odytrice / fsharp-tutorial.fs
Last active March 3, 2024 04:32
F# Code Samples
// This sample will guide you through elements of the F# language.
//
// *******************************************************************************************************
// To execute the code in F# Interactive, highlight a section of code and press Alt-Enter in Windows or
// Ctrl-Enter Mac, or right-click and select "Send Selection to F# Interactive".
// You can open the F# Interactive Window from the "View" menu.
// *******************************************************************************************************
// For more about F#, see:
@odytrice
odytrice / README.md
Last active March 24, 2023 07:24
Kubectx, Kubens for Windows (Powershell)
@odytrice
odytrice / Ninject.Http.cs
Last active February 14, 2023 12:15
A small Library to configure Ninject (A Dependency Injection Library) with a WebAPI Application.
using Ninject.Modules;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Web;
using System.Web.Http;
using System.Web.Http.Dependencies;
// A small Library to configure Ninject (A Dependency Injection Library) with a WebAPI Application.
@odytrice
odytrice / Ninject.Mvc.cs
Last active December 12, 2022 11:48
A small Library to configure Ninject (A Dependency Injection Library) with an ASP.NET Application.
using Ninject;
using Ninject.Modules;
using Ninject.Web.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Web;
using System.Web.Mvc;
@odytrice
odytrice / RecordProvider.fs
Created May 24, 2020 21:55
Simple F# Type Provider for Mutable Records
namespace TestProvider.Provided
open System.Reflection
open FSharp.Core.CompilerServices
open ProviderImplementation.ProvidedTypes
open System.Collections.Generic
open Microsoft.FSharp.Quotations
[<TypeProvider>]
type SampleProvider(config) as this =
{
"name": "Example Pool",
"description": "Cardano stakepool example",
"ticker": "STEAK",
"homepage": "https://github.com/abracadaniel/cardano-node-docker"
}
@odytrice
odytrice / restore-rkestate-file.md
Created November 24, 2020 02:20 — forked from superseb/restore-rkestate-file.md
Recover cluster.rkestate file from controlplane node

Recover cluster.rkestate file from controlplane node

RKE

Run on controlplane node, uses any found hyperkube image

docker run --rm --net=host -v $(docker inspect kubelet --format '{{ range .Mounts }}{{ if eq .Destination "/etc/kubernetes" }}{{ .Source }}{{ end }}{{ end }}')/ssl:/etc/kubernetes/ssl:ro --entrypoint bash $(docker inspect $(docker images -q --filter=label=org.label-schema.vcs-url=https://github.com/rancher/hyperkube.git) --format='{{index .RepoTags 0}}' | tail -1) -c 'kubectl --kubeconfig /etc/kubernetes/ssl/kubecfg-kube-node.yaml -n kube-system get configmap full-cluster-state -o json | jq -r .data.\"full-cluster-state\" | jq -r .' > cluster.rkestate
@odytrice
odytrice / windows-terminal-profile.json
Last active February 16, 2020 22:46
Ody's Windows Terminal Profile
{
"$schema": "https://aka.ms/terminal-profiles-schema",
"globals" :
{
"alwaysShowTabs" : true,
"copyOnSelect" : false,
"defaultProfile" : "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
"initialCols" : 120,
"initialRows" : 30,
"keybindings" :
@odytrice
odytrice / sicp.fs
Last active October 29, 2019 10:07
Structure and Interpretation of Computer Programs - F# Code Examples
(* SICP Chapter #01 Examples in F# *)
#light
(* 1.1.1 The Elements of Programming - Expressions *)
486
137 + 349
1000 - 334
5 * 99
10 / 5
2.7 + 10.0
@odytrice
odytrice / Extensions.cs
Last active September 28, 2019 07:37
Generic Abstract Model
public static class Extensions
{
public static T ParseEnum<T>(this string value) where T : struct
{
if (Enum.TryParse(value, true, out T enumobj))
{
return enumobj;
}
else
{