Skip to content

Instantly share code, notes, and snippets.

View aldrichtr's full-sized avatar

Tim Aldrich aldrichtr

View GitHub Profile
@aldrichtr
aldrichtr / multi-workspace.md
Created October 11, 2023 23:25 — forked from kevinslin/multi-workspace.md
mutli-workspace-setup

Creating a Personal and Work specific workspace

  1. Create a personal workspace using Initialize Workspace
    • initialize with a blank vault
      • if you want to version control the vault, run Vault Convert to add a git repository to this vault
    • repeat this process with other vaults as needed (we recommend just starting off with a single vault), see reasons for going multi-vault here
    • add your workspace to version control by running the following:
      1. Initialize a git repo
@aldrichtr
aldrichtr / .gitconfig
Created September 28, 2023 17:37 — forked from rocketraman/.gitconfig
.gitconfig aliases useful for gitworkflow (https://github.com/rocketraman/gitworkflow)
[alias]
# Basically `log --oneline --decorate --graph` with different colors and some additional info (author and date)
lg = log --graph --abbrev-commit --decorate --format=format:'%C(yellow)%h%C(reset) %C(normal)%s%C(reset) %C(dim white)%an%C(reset) %C(dim blue)(%ar)%C(reset) %C(dim black)%d%C(reset)'
# lg (see above) with --first-parent
lgp = log --graph --abbrev-commit --decorate --format=format:'%C(yellow)%h%C(reset) %C(normal)%s%C(reset) %C(dim white)%an%C(reset) %C(dim blue)(%ar)%C(reset) %C(dim black)%d%C(reset)' --first-parent
# https://stackoverflow.com/questions/61510067/show-specific-commits-in-git-log-in-context-of-other-commits
hl = "!f() { cd -- ${GIT_PREFIX:-.}; grep --color -E \"$(git log --pretty=%h \"$@\" | tr '\n' '|')\" || true; }; f"
hlp = "!f() { cd -- ${GIT_PREFIX:-.}; less -R -p $(git log --pretty=%h \"$@\" | tr '\n' '|'); }; f"
@aldrichtr
aldrichtr / Manage-ADComputers.ps1
Created September 22, 2023 17:49 — forked from 9to5IT/Manage-ADComputers.ps1
PowerShell: Cleanup inactive AD computer objects
Import-Module ActiveDirectory
# Set the number of days since last logon
$DaysInactive = 90
$InactiveDate = (Get-Date).Adddays(-($DaysInactive))
#-------------------------------
# FIND INACTIVE COMPUTERS
#-------------------------------
# Below are three options to find inactive computers. Select the one that is most appropriate for your requirements:
@aldrichtr
aldrichtr / github-actions-notes.md
Created September 13, 2023 08:14 — forked from br3ndonland/github-actions-notes.md
Getting the Gist of GitHub Actions
@aldrichtr
aldrichtr / Matchinfo.Format.ps1xml
Created September 2, 2023 11:34 — forked from mdgrs-mei/Matchinfo.Format.ps1xml
Format file to add links to Select-String outputs
<?xml version="1.0" encoding="utf-8"?>
<Configuration>
<ViewDefinitions>
<View>
<Name>MatchInfo</Name>
<ViewSelectedBy>
<TypeName>Microsoft.PowerShell.Commands.MatchInfo</TypeName>
</ViewSelectedBy>
<CustomControl>
<CustomEntries>
@aldrichtr
aldrichtr / MoonSpinner.ps1
Created September 2, 2023 11:33 — forked from mdgrs-mei/MoonSpinner.ps1
Show a moon spinner on the tab title using DynamicTitle PowerShell module
#Requires -Modules DynamicTitle
$commandStartJob = Start-DTJobCommandPreExecutionCallback -ScriptBlock {
param($command)
(Get-Date), $command
}
$promptJob = Start-DTJobPromptCallback -ScriptBlock {
(Get-Date)
}
@aldrichtr
aldrichtr / ShellIntegration.ps1
Created September 2, 2023 11:32 — forked from mdgrs-mei/ShellIntegration.ps1
Adds escape codes to the prompt for the shell integration
# Reference:
# https://devblogs.microsoft.com/commandline/shell-integration-in-the-windows-terminal/
param
(
[ValidateSet('WindowsTerminal', 'ITerm2')]
[String]$TerminalProgram = 'WindowsTerminal'
)
# Restore hooked functions in case this script is executed accidentally twice
@aldrichtr
aldrichtr / Microsoft.PowerShell_profile.ps1
Created August 15, 2023 20:58 — forked from dprice/Microsoft.PowerShell_profile.ps1
PowerShell Profile #tag PowerShell
$sw = [Diagnostics.Stopwatch]::StartNew()
Write-Host "Updating path..." -foregroundColor DarkGreen
if(!($env:path).contains((Split-Path $PROFILE))) {
$env:path += ";" + (Split-Path $PROFILE)
}
if(!($env:path).contains('D:\dNx\dnx-util;')) {
$env:path += ";" + 'D:\dNx\dnx-util;'
}
if(!($env:path).contains('D:\dNx\dnx-util\test;')) {
$env:path += ";" + 'D:\dNx\dnx-util\test;'

Credit: Mark Kraus
Website: https://get-powershellblog.blogspot.com

Collection Type Guidence

When to use what

  • Use Arrays if you know the element types and have a fixed length and/or known-up-front collection size that will not change.
  • Use ArrayList if you have an unkown collection size with either unknown or mixed type elements.
  • Use a Generic List when know the type of the elements but not the size of the collection.
  • Use a HashTable if you are going to do key based lookups on a collection and don't know the object type of the elements.
  • Use a Dictionary<TKey, TValue> you are going to do key based lookups on a collection and you know the type of the elements.
  • Use a HashSet when you know the type of elements and just want unique values and quick lookups and assignmnets.
@aldrichtr
aldrichtr / PracticalSubmodulesWithGitAndPester.txt
Created July 7, 2023 14:45 — forked from sdoubleday/PracticalSubmodulesWithGitAndPester.txt
Notes on the act of developing with external repositories (i.e. submodules) in git and pester
Notes on the act of developing with external repositories (i.e. submodules) in git and pester
*To the reader:* If you are here looking for expert advice, please leave as swiftly as possible. No such advice is present here. This is purely a set of reminders for the physical(?) act of how I handle working with git submodules and pester tests.
This assumes you are working in PowerShell. Version 5, if it matters, with git 2.10 (or later? It was what I had when I wrote this) and pester.
*Downloading and using a repo with submodules* - When I was getting started with this, I NEVER developed submodules from the main module. I schlepped over to the submodule, branch, develop, merge back to master, and then come back here and update the submodule, and I still think that's a good policy for anything other than mass hotfixes.
Clone the repo as normal. Here, the folder PesterNewFixtureModule will be created in the current folder:
git clone https://github.com/sdoubleday/PesterNewFixtureModule.git PesterNewFixtureModu