Skip to content

Instantly share code, notes, and snippets.

@jpbruckler
jpbruckler / DevMachineSetup.ps1
Last active September 6, 2024 14:06 — forked from codebytes/DevMachineSetup.ps1
DevMachineSetup
#Install WinGet
#Based on this gist: https://gist.github.com/crutkas/6c2096eae387e544bd05cde246f23901
$hasPackageManager = Get-Command winget -ErrorAction SilentlyContinue
[version]$version = if ($hasPackageManager) {
(winget --version).trim('v')
}
else {
'0.0.0'
}
$releasesUrl = 'https://api.github.com/repos/microsoft/winget-cli/releases/latest'
format = """
$os\
$username\
$c\
$dotnet\
$elixir\
$erlang\
$java\
$kotlin\
$lua\
@jpbruckler
jpbruckler / AutomateDCRAssignment.ps1
Created May 14, 2024 12:48
Assigns Data Collection Rules to Windows Servers
<#
.SYNOPSIS
Assigns Data Collection Rules to Azure VMs and Azure Arc servers.
.DESCRIPTION
This script connects to Azure, retrieves all Windows Azure VMs and Azure Arc
servers from specified subscriptions, and applies Data Collection Rules to
them. It is intended to streamline the setup of monitoring across both Azure
VM and Azure Arc environments by automating the association of DCRs.
function Invoke-IamWorkflow {
<#
.SYNOPSIS
Invokes one or more worker scripts in parallel using a runspace pool, passing in items and a shared thread-safe state.
.DESCRIPTION
The Invoke-IamWorkflow function takes an array of input objects and an array of worker script names.
It creates a shared ConcurrentDictionary to store global or aggregated state in a thread-safe manner.
Each worker script is executed in its own runspace, When all worker scripts have finished executing,
the function outputs the per-run results as well as the final shared state.
git clone --bare [email protected]:jpbruckler/dotfiles.git $HOME/.dotfiles
function config {
/usr/bin/git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME $@
}
mkdir -p .config-backup
config checkout
if [ $? = 0 ]; then
echo "Checked out config.";
else
echo "Backing up pre-existing dot files.";