Skip to content

Instantly share code, notes, and snippets.

<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.0</TargetFramework>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<RootNamespace></RootNamespace>
<IsPackable>False</IsPackable>
<NoWarn>CS0649;CS0169</NoWarn>
@jordanrobot
jordanrobot / excel-export-sheet-to-csv.vb
Created September 4, 2021 18:42
VBA: export Excel sheet to CSV file
Sub ExportSheetToCSV(sheetName As String)
Application.ScreenUpdating = False
Dim wb As Workbook, wbCSV As Workbook
Dim ws As Worksheet, wsCSV As Worksheet
Set wb = ThisWorkbook
Set ws = wb.Worksheets(sheetName)
@jordanrobot
jordanrobot / compare-file-hash.ps1
Created September 16, 2021 14:01
Compares the hashes of two files
param(
[string]$fileA,
[string]$fileB
)
if ((!($fileA)) -or (!(Test-Path $fileA -PathType Leaf)))
{$fileA=Read-Host "Enter First File to Compare"}
if ((!($fileB)) -or (!(Test-Path $fileB -PathType Leaf)))
{$fileB=Read-Host "Enter Second File to Compare"}
@jordanrobot
jordanrobot / get-msi-product-ids.ps1
Created November 29, 2022 16:14
List MSI product IDs for installed packages
get-wmiobject Win32_Product | Sort-Object -Property Name |Format-Table IdentifyingNumber, Name, LocalPackage -AutoSize
@jordanrobot
jordanrobot / GuardAgainstMissingProgram.cs
Created April 9, 2023 00:34
Throw if an application is not found on the executing system
//Guard.AgainstMissingProgram("Excel.Application");
public static class Guard
{
public static void AgainstMissingProgram(string input)
{
Type applicationType = Type.GetTypeFromProgID(input);
if (applicationType is null)
{
throw new SystemException($"Application {input} not found. Exiting...");
@jordanrobot
jordanrobot / EnsureSupportPaths.cs
Created December 31, 2024 01:42
AutoCAD Ensure Support Paths C#
public static bool EnsureSupportPaths()
{
List<string> supportPaths = [
$@"{RoamingAppData}\Autodesk\ApplicationPlugins\plugin.bundle\Contents\",
$@"{RoamingAppData}\Autodesk\ApplicationPlugins\plugin.bundle\Contents\lisp\",
$@"{RoamingAppData}\Autodesk\ApplicationPlugins\plugin.bundle\Contents\assets\objects\",
$@"{RoamingAppData}\Autodesk\ApplicationPlugins\plugin.bundle\Contents\assets\templates\",
$@"{RoamingAppData}\Autodesk\ApplicationPlugins\plugin.bundle\Contents\assets\plot styles\",
$@"{RoamingAppData}\Autodesk\ApplicationPlugins\plugin.bundle\Contents\icons\",
$@"{RoamingAppData}\Autodesk\ApplicationPlugins\plugin.bundle\Contents\cui\",