This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# List the directories in PATH on Windows for either User or Machine | |
# Specify the target (User or Machine) | |
# Usage .\path_pretty_print.ps1 -Target Machine | |
# or .\path_pretty_print.ps1 -Target User | |
param( | |
[Parameter(Mandatory=$false)] | |
[ValidateSet("User", "Machine")] | |
[string]$Target = "User" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Remove Duplicate paths in the PATH on Windows (for either User or Machine). Has an optional 'Dry Run' mode | |
# Specify the target (User or Machine) and dry run mode | |
# example... | |
# .\remove_path_duplicates.ps1 -Target Machine -DryRun true | |
# .\remove_path_duplicates.ps1 -Target User -DryRun false | |
param( | |
[Parameter(Mandatory=$false)] | |
[ValidateSet("User", "Machine")] | |
[string]$Target = "User", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Repairs the PATH variable for VS Code (if it gets lost or removed). | |
# | |
# Specify the target (User or Machine) and dry run mode | |
# .\repair_vscode_path.ps1 -Target Machine -DryRun true | |
# | |
# If dry run is true (default) the it only shows you what it would | |
# have done if dryrun had been false... it's a safety thing! | |
# Specify the target (User or Machine) and dry run mode | |
param( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Powershell script to remove a directory from the PATH on Windows for either System or User | |
# Can optionally run it in dry run mode to be certain it's going to do what you require | |
# | |
# Specify the target (User or Machine), dry run mode, and directory to remove | |
# Examples | |
# .\remove_from_path.ps1 -DirectoryToRemove "C:\Path\To\Directory" | |
# This will remove C:\Path\To\Directory from the user PATH. | |
# | |
# .\remove_from_path.ps1 -DirectoryToRemove "C:\Path\To\Directory" -Target Machine | |
# This will remove C:\Path\To\Directory from the system PATH. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Original tool from Hannes Paulsson | |
From: https://gist.github.com/Happsson/af02d7a644db6b44bc834c8699bf3495 | |
Updated 2023/05/15 by Mark Castle (and ChatGPT :P) to add excluded paths and to also | |
give the option of opening files in the current editor, plus some minor tweaks | |
to keep re-sharper happy. | |
https://gist.github.com/markcastle/be019a471b44016d73c11f308feb5249 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Linq; | |
namespace CaptiveReality.Utils | |
{ | |
public class Common | |
{ | |
public static bool IsNumeric(string value) | |
{ | |
return value.All(char.IsNumber); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' Author: Mark Castle | |
' Email: mark@markcastle.com | |
' Updated: 03 March 2003 | |
' Language: VB.NET | |
' Framework Version: V1.1 | |
' Create thumbnail images on the fly. | |
<%@ Import Namespace=System.Drawing %> | |
<%@ Import Namespace=System %> | |
<%@ Import Namespace=System.Web %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Some simple Float Extensions | |
*/ | |
using System; | |
namespace YOURNAMESPACE.Extensions | |
{ | |
public static class FloatExtensions | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Set the Solution and Application Names | |
- export SOLUTION_NAME=YourSolutionName | |
- export APP_NAME=YourAppName | |
# Create an Env Var File that we'll import from | |
- export ENV_VARS_FILE=ENVIRONMENT_VARIABLES.txt | |
- echo -n "VERSION=" >> $ENV_VARS_FILE | |
# Search for the version tag, pipe the tag into sed then extract just the version, append that to the env vars file | |
- grep -Eoi "<version>([[:digit:]\.]+)</version>" ./$SOLUTION_NAME/$SOLUTION_NAME.csproj | sed -n 's:.*<Version>\(.*\)</Version>.*:\1:p' >> $ENV_VARS_FILE | |
# Finally, parse the env vars file and then export those vars so that we can use them in bitbucket pipelines. | |
- export $(cat $ENV_VARS_FILE | xargs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rem Extract Version string from a dotnet C# project file using just grep and sed... | |
# eg source file ./ProjectFolder/ProjectName.csproj contains.. | |
# <Version>0.0.3</Version> | |
grep -Eoi "<version>([[:digit:]\.]+)</version>" ./ProjectFolder/ProjectName.csproj | sed -n 's:.*<Version>\(.*\)</Version>.*:\1:p' | |
# Expected Result... | |
0.0.3 |
NewerOlder