Skip to content

Instantly share code, notes, and snippets.

View craibuc's full-sized avatar

Craig Buchanan craibuc

View GitHub Profile
@machuu
machuu / WSL2_VPN_Workaround_Instructions.md
Last active July 19, 2025 14:04
Workaround for WSL2 network broken on VPN

Overview

Internet connection and DNS routing are broken from WSL2 instances, when some VPNs are active.

The root cause seems to be that WSL2 and the VPN use the same IP address block, and the VPN routing clobbers WSL2's network routing.

This problem is tracked in multiple microsoft/WSL issues including, but not limited to:

WSL 2 Cisco AnyConnect Networking Workaround

Overview

WSL 2 uses a Hyper-V Virtual Network adapter. Network connectivity works without any issue when a VPN is not in use. However when a Cisco AnyConnect VPN session is established Firewall Rules and Routes are added which breaks connectivity within the WSL 2 VM. This issue is tracked WSL/issues/4277

Below outline steps to automatically configure the Interface metric on VPN connect and update DNS settings (/etc/resolv.conf) on connect/disconnect.

Manual Configuration

Set Interface Metrics

@mklement0
mklement0 / Debug-String.ps1
Last active August 24, 2023 06:40
PowerShell function to visualize control characters and Unicode characters in strings
<#
Prerequisites: PowerShell v5.1 and above (verified; may also work in earlier versions)
License: MIT
Author: Michael Klement <[email protected]>
DOWNLOAD and DEFINITION OF THE FUNCTION:
irm https://gist.github.com/mklement0/7f2f1e13ac9c2afaf0a0906d08b392d1/raw/Debug-String.ps1 | iex
@indented-automation
indented-automation / Get-TaskStartDate.ps1
Last active August 24, 2022 09:12
Gets the next date
function Get-TaskStartDate {
<#
.SYNOPSIS
Get a start date from a string expression.
.DESCRIPTION
Finds the start date from a string expression.
.EXAMPLE
Get-TaskStartDate -Day '1st Monday'
@JustinGrote
JustinGrote / PowershellLoopBehavior.md
Last active June 3, 2022 03:01
Reference Table for Loop Behavior in Powershell
Loop Return Continue Break
Normal Expectation NextItem NextItem ExitLoop
.foreach{} NextItem ExitLoop ExitLoop
foreach ($y in $x) ExitLoop NextItem ExitLoop
for ($i;$i -lt 5;$i++) ExitLoop NextItem ExitLoop
Foreach-Object -InputObject @() NextItem NextItem NextItem
Switch ExitLoop ExitLoop ExitLoop
While ExitLoop NextItem ExitLoop
# Source: https://dev.to/ganesshkumar/pi-hole-in-azure-container-instances-4abf
# Download Azure CLI optionally
#Invoke-WebRequest -Uri https://aka.ms/installazurecliwindows -OutFile .\AzureCLI.msi; Start-Process msiexec.exe -Wait -ArgumentList '/I AzureCLI.msi /quiet'; rm .\AzureCLI.msi
cd $PSScriptRoot
$subscriptionId = "1231321332144" # shown after logging in with 'az login'
$rgName = "rg-pi-hole"
@EitanBlumin
EitanBlumin / Deploy SSRS Reports.ps1
Last active May 12, 2025 03:18
Powershell script to deploy SSRS reports from a folder (all rds and rdl files)
Param
(
[string] $SourceFolder = "C:\SSRS\My-Reports",
[string] $TargetReportServerUri = "http://localhost:8081/ReportServer",
[PSCredential] $Credential,
[switch] $CustomAuthentication,
[string] $ApiVersion,
[string] $TargetFolder = "/My-Reports/Sample-Reports",
[switch] $Recursive,
[string] $OverrideDataSourcePathForAll, #= "/My-Reports/Data Sources/ProdDS",
@indented-automation
indented-automation / Get-CommandParameter.ps1
Last active December 17, 2021 23:27
Gets the parameters for a command from the default parameter set
function Get-CommandParameter {
param (
[Parameter(Mandatory = $true)]
[String]$Command,
[Switch]$GetDefaultValues
)
$defaultParams = @(
[System.Management.Automation.Internal.CommonParameters].GetProperties().Name
@mklement0
mklement0 / Time-Command.ps1
Last active December 18, 2024 07:42
PowerShell function that times the execution of one or more commands, averaged over a specifiable number of runs.
<#
Prerequisites: PowerShell v5.1 and above (verified; may also work in earlier versions)
License: MIT
Author: Michael Klement <[email protected]>
DOWNLOAD and DEFINITION OF THE FUNCTION:
irm https://gist.github.com/mklement0/9e1f13978620b09ab2d15da5535d1b27/raw/Time-Command.ps1 | iex
@MarvinJWendt
MarvinJWendt / wordlist-german.txt
Created September 7, 2017 03:19
All german words (german wordlist).
This file has been truncated, but you can view the full file.
AA
AAA
Aachen
Aachener
Aachenerin
Aachenerinnen
Aachenern
Aacheners
Aachens