Skip to content

Instantly share code, notes, and snippets.

View fdcastel's full-sized avatar

F.D.Castel fdcastel

View GitHub Profile
@fdcastel
fdcastel / Test-PublicIpServicesResponseTimes.ps1
Created September 27, 2023 16:19
Test response times of public "what is my ip" services.
[CmdletBinding(SupportsShouldProcess)]
Param()
#
# Settings
#
# Services to test
$urls = 'https://ifconfig.me/ip',
'https://1.1.1.1/cdn-cgi/trace',
@fdcastel
fdcastel / Kopia-actions-not-running.ps1
Created August 24, 2023 18:02
Demo for issue: Kopia not running actions when snapshot source is a single file.
#
# Demo for issue: Kopia not running actions when snapshot source is a single file.
#
# Tested with
# Kopia 0.13.0
# Windows Server 2022
#
# Demo settings
@fdcastel
fdcastel / OrderedDictionary.cs
Created May 27, 2023 20:07
C# OrderedDictionary implementation
//
// Generic OrderedDictionary implementation updated for C# 11.
//
// Original code from @mattmc3: https://stackoverflow.com/a/9844528/33244
//
// http://unlicense.org
//
using System.Collections;
using System.Collections.ObjectModel;
@fdcastel
fdcastel / Get-FolderUsage
Last active November 26, 2022 15:43
Retrieve disk space used by files and subfolders of a given folder (in GB).
function Get-FolderUsage([String]$Folder) {
[PSCustomObject]@{
FullName=Join-Path -Path $Folder -ChildPath '*';
SizeGb=[int]((Get-ChildItem -File $Folder | Measure-Object -Property Length -Sum).Sum / 1GB)
} | Write-Output
Get-ChildItem -Directory -Path $Folder |
ForEach-Object {
[PSCustomObject]@{
FullName=$_.FullName;
@fdcastel
fdcastel / NUnitTests.fs
Created April 5, 2016 03:26
NUnit tests sample
namespace NUnit.Tests
open NUnit.Framework
[<TestFixture>]
module NUnitTests =
[<TestFixtureSetUp>]
let ``NUnit static member fixture setup``() =
printfn "NUnit static member fixture setup"
@fdcastel
fdcastel / VisualStudioTests.fs
Created April 5, 2016 03:25
Visual Studio tests sample
namespace VisualStudio.Tests
open Microsoft.VisualStudio.TestTools.UnitTesting
[<TestClass>]
module VisualStudioTests =
[<TestClass>]
type testrun() =
@fdcastel
fdcastel / Fable.Plugins.BitwiseWrap.fsx
Last active March 30, 2016 07:27
Fable Plugin to keep integer arithmetic in JavaScript
namespace Fable.Plugins
#r "../../build/fable/bin/Fable.exe"
open Fable.AST
open Fable.AST.Fable
open Fable.FSharp2Fable
type RandomPlugin() =
interface IReplacePlugin with