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
#!/bin/bash | |
# Generates terraform "moved" blocks for files based on terraform state | |
export OLD_MODULE="old_module_name" | |
export NEW_MODULE="" #LEAVE EMPTY to move to root module or enter "module.new_module." if you want to move to another module | |
terraform state list | | |
grep module.${OLD_MODULE} | cut -d. -f 3- | sed 's/\"/\\\"/g' | | |
xargs -I {} sh -c 'echo "moved {" && echo " from = module.${OLD_MODULE}.{}" && echo " to = ${NEW_MODULE}{}" && echo "}"' | sed 's/\]/\"]/g' | sed 's/\[/\["/g' | tr -d '\r' > moved-blocks.tf |
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
function ConvertTo-CentralPackageManagement() { | |
Write-Host 'Searching for package references' | |
$packages = @{} | |
$conditionalPackages = @{} | |
foreach ($csproj in (Get-ChildItem -Include *.csproj, *.props -Recurse)) { | |
$root = [xml]($csproj | Get-Content -Raw) | |
foreach ($itemGroup in $root.Project.ItemGroup) { | |
foreach ($packageReference in $itemGroup.PackageReference) { | |
if ($packageReference.Include -and $packageReference.Version) { |
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
{ | |
/* | |
These are PowerShell snippets which you can use in Visual Studio Code | |
To use them click File --> Preferences --> User Snippets and type PowerShell | |
or edit $env:\appdata\code\user\snippets\powershell.json | |
In general and in order I converted exisitng snippets like this | |
Replace `$ with $$ | |
Replace \ with \\ | |
Replace " with \" | |
\r for new line |
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
######## POSH-GIT | |
# with props to https://bradwilson.io/blog/prompt/powershell | |
# | |
# | |
# Now for this to work most beautifully - you will need to have the latest posh-git module | |
# | |
# You will also need the MesloLGM Nerd Font Mono font | |
# from here https://github.com/ryanoasis/nerd-fonts/blob/master/patched-fonts/Meslo/M/Regular/complete/Meslo%20LG%20M%20Regular%20Nerd%20Font%20Complete.ttf | |
# if you are super nerdy | |
# or |
Credit: Mark Kraus
Website: https://get-powershellblog.blogspot.com
- 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.
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
# THIS CODE IS PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF | |
# FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. | |
#Requires -Modules @{ ModuleName="Microsoft.Graph.Authentication" ; ModuleVersion="2.15.0" } | |
#Requires -Modules @{ ModuleName="Microsoft.Graph.DirectoryObjects"; ModuleVersion="2.15.0" } | |
#Requires -Modules @{ ModuleName="Microsoft.Graph.Identity.SignIns"; ModuleVersion="2.15.0" } | |
#Requires -Modules @{ ModuleName="Microsoft.Graph.Applications" ; ModuleVersion="2.15.0" } | |
#Requires -Modules @{ ModuleName="Microsoft.Graph.Users" ; ModuleVersion="2.15.0" } | |
<# |
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
# Prometheus configuration to scrape Kubernetes outside the cluster | |
# Change master_ip and api_password to match your master server address and admin password | |
global: | |
scrape_interval: 15s | |
evaluation_interval: 15s | |
scrape_configs: | |
# metrics for the prometheus server | |
- job_name: 'prometheus' |
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
param ( | |
[string] | |
$sourceConnectionString = $(throw "-sourceConnectionString is required."), | |
[string] | |
$sourceTableName = $(throw "-sourceConnectionString is required."), | |
[string] | |
$targetConnectionString = $(throw "-targetConnectionString is required."), | |
[string] | |
$targetTableName = $(throw "-targetTableName is required.") | |
) |
NewerOlder