https://medium.com/faun/cleaning-up-a-terraform-state-file-the-right-way-ab509f6e47f3
This file contains hidden or 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
| [CmdletBinding()] | |
| Param() | |
| $noProcessors = (Get-WmiObject -class 'Win32_Processor' -Namespace 'root\cimv2').NumberOfLogicalProcessors | |
| if ($noProcessors -gt 1) { | |
| $maxAffinity = [Math]::Pow(2, $noProcessors) - 1 # i.e. this signfies that all processors are assigned to a process | |
| $procsPerUser = [Math]::Ceiling($noProcessors / 3) # i.e. allow users to use 1/3rd the available processors (rounded up) | |
| while ($true) { | |
This file contains hidden or 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
| # git@github.com: Permission denied (publickey). | |
| # fatal: Could not read from remote repository | |
| # Please make sure you have the correct access rights and the repository exists | |
| # run git bash | |
| #ssh-agent | |
| eval `ssh-agent` | |
| # should output: Agent pid #### | |
| # change the filename in the below to match your key file (found under `%userprofile%/.ssh`) |
This file contains hidden or 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
| class FzLogEntry { | |
| [long]$SessionId | |
| [DateTime]$DateTime | |
| [string]$User | |
| [version]$ClientIp # I've used version assuming it's always IPv4... if that assumption's wrong we may have to amend to string | |
| [string]$Msg | |
| FzLogEntry(){} | |
| } | |
| Function Get-FzLogData { |
This file contains hidden or 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
| { | |
| "SYNC": { | |
| "blacklist": { | |
| "facebook.com": {}, | |
| "twitter.com": {}, | |
| "ycombinator.com": {} | |
| }, | |
| "storageMap": { | |
| "backup-1587628948311": 3, | |
| "backup-1587628948312": 3, |
This file contains hidden or 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 Repair-RemoteSafeModeBoot { | |
| [CmdletBinding()] | |
| Param ( | |
| [Parameter(Mandatory = $true)] | |
| [string]$ComputerName | |
| ) | |
| if (-not (Test-Connection -ComputerName $ComputerName -Quiet -Count 1 -ErrorAction 'Stop')) { | |
| throw "Could not ping $ComputerName; no attempt made to fix it" | |
| } | |
| $os = Get-WmiObject -ComputerName $ComputerName -Class 'Win32_OperatingSystem' -ErrorAction 'Stop' |
This file contains hidden or 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
| # | |
| # A collection of registry keys wrapped in scripts to help use them and with comments on what they're for | |
| # | |
| <# | |
| SYMPTOM | |
| User gets a temporary profile every time they log on | |
| CAUSE | |
| .bak entry for the user in the profile list | |
| FIX |
This file contains hidden or 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 New-DummyFile { | |
| [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'Medium')] | |
| Param ( | |
| # full path to file to be created | |
| [Parameter(Mandatory = $true, ValueFromPipeline = $true)] | |
| [string]$Path | |
| , | |
| # the size of the file to be created (you can use shorthand terms like 1GB to populate this) | |
| [Parameter(Mandatory = $true)] | |
| [UInt64]$FileSizeBytes # use uint to avoid negatives; use int64 to ensure we can hold values in terrabytes |
This file contains hidden or 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
| <Query Kind="Program"> | |
| <Reference><RuntimeDirectory>\System.DirectoryServices.AccountManagement.dll</Reference> | |
| <Reference><RuntimeDirectory>\System.DirectoryServices.dll</Reference> | |
| <Namespace>System.DirectoryServices</Namespace> | |
| <Namespace>System.DirectoryServices.AccountManagement</Namespace> | |
| <Namespace>System.DirectoryServices.ActiveDirectory</Namespace> | |
| <Namespace>System.Threading.Tasks</Namespace> | |
| </Query> | |
| void Main() |
This file contains hidden or 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]$ComputerName) | |
| [System.Collections.Generic.IDictionary[[uint32],[string]]]$statusCodes = New-Object -TypeName 'System.Collections.Generic.Dictionary[[uint32],[string]]' | |
| # list from https://docs.microsoft.com/en-us/previous-versions/windows/desktop/wmipicmp/win32-pingstatus | |
| @' | |
| Success (0) | |
| Buffer Too Small (11001) | |
| Destination Net Unreachable (11002) | |
| Destination Host Unreachable (11003) | |
| Destination Protocol Unreachable (11004) | |
| Destination Port Unreachable (11005) |