Skip to content

Instantly share code, notes, and snippets.

View fdcastel's full-sized avatar

F.D.Castel fdcastel

View GitHub Profile
@fdcastel
fdcastel / setup-router.sh
Last active November 9, 2024 10:49
Configure a simple router based on Debian 12/Bookworm.
#
# setup-router.sh
#
# Configure a simple router based on Debian 12/Bookworm.
#
# Base image:
# https://cloud.debian.org/images/cloud/bookworm/20240901-1857/debian-12-genericcloud-amd64-20240901-1857.qcow2
#
@fdcastel
fdcastel / Test-PublicIpServicesResponseTimes.ps1
Last active November 11, 2024 05:03
Test response times of public "what is my ip" services.
[CmdletBinding(SupportsShouldProcess)]
Param()
#
# Settings
#
# Services to test
$urls = 'https://1.1.1.1/cdn-cgi/trace', # 13,86
'https://myip.dnsomatic.com/', # 17,45
@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 / 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 / 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