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
| ###### STEP 1 - Get GIT Credentials | |
| $EncryptedPasswordString = "Your Encrypted Github Password String" | |
| $Args = "Your Github Username", ($EncryptedPasswordString |ConvertTo-SecureString) | |
| $GitCreds = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $Args | |
| # Required Functions | |
| Function Update-AllPowerShellProfile | |
| { | |
| $ProfileDirectory = "$env:USERPROFILE\Documents\WindowsPowerShell\" | |
| $AllPSPRofiles = dir $ProfileDirectory | ?{$_.name -like "*Profile*"} | sort LastWriteTime -Descending |
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 branch -r) | % { git log -n 1 --format="%d`t%h`t%cd`t%an`t'%s'" $_.trim() -- } | Set-Content -Path "output.csv" |
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
| # for viewing the matching branches | |
| git branch -vv | foreach { if($_ -match "^\s{2}([^\s]+).+?: gone]"){ Write-Host $matches[1] } } | |
| # to delete the branches | |
| git branch -vv | foreach { if($_ -match "^\s{2}([^\s]+).+?: gone]"){ git branch -d $matches[1] } } |
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 ConvertTo-PSON { | |
| <# | |
| .SYNOPSIS | |
| Generates a PowerShell object-notation in the style of a PSD1 document | |
| .DESCRIPTION | |
| This stringifies a PowerShell object following the style of a PSD1 document, the powerShell-equivalent of JSON. The behavior is incomplete but works fine for simple objects. | |
| .EXAMPLE | |
| $array=@() | |
| $array+=Get-Process wi* | Select-Object Handles,NPM,PM,WS,VM,CPU,Id,ProcessName | |
| ConvertTo-PSON $array |
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 Join-Objects($source, $extend){ | |
| if($source.GetType().Name -eq "PSCustomObject" -and $extend.GetType().Name -eq "PSCustomObject"){ | |
| foreach($Property in $source | Get-Member -type NoteProperty, Property){ | |
| if($extend.$($Property.Name) -eq $null){ | |
| continue; | |
| } | |
| $source.$($Property.Name) = Join-Objects $source.$($Property.Name) $extend.$($Property.Name) | |
| } | |
| }else{ | |
| $source = $extend; |
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 join($path) | |
| { | |
| $files = Get-ChildItem -Path "$path.*.part" | Sort-Object -Property @{Expression={ | |
| $shortName = [System.IO.Path]::GetFileNameWithoutExtension($_.Name) | |
| $extension = [System.IO.Path]::GetExtension($shortName) | |
| if ($extension -ne $null -and $extension -ne '') | |
| { | |
| $extension = $extension.Substring(1) | |
| } | |
| [System.Convert]::ToInt32($extension) |
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
| using System; | |
| using System.Globalization; | |
| using System.Net; | |
| using System.Security.Cryptography; | |
| using System.Text; | |
| public class GoogleAuthenticator | |
| { | |
| const int IntervalLength = 30; | |
| const int PinLength = 6; |