Skip to content

Instantly share code, notes, and snippets.

###### 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
@ksumrall
ksumrall / ConvertTo-PSON.ps1
Created July 23, 2018 16:56 — forked from Chirishman/ConvertTo-PSON.ps1
Convert to PowerShell Object Notation
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
@ksumrall
ksumrall / Merge-Json.ps1
Last active December 11, 2019 19:50 — forked from Badabum/Merge-Json.ps1
Merge two .json objects using PowerShell
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;
@ksumrall
ksumrall / join.ps1
Created July 5, 2018 13:48 — forked from jehugaleahsa/join.ps1
PowerShell Script to Split Large Files
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)
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;