Skip to content

Instantly share code, notes, and snippets.

View kilasuit's full-sized avatar

Ryan Yates kilasuit

View GitHub Profile

Keybase proof

I hereby claim:

  • I am kilasuit on github.
  • I am kilasuit (https://keybase.io/kilasuit) on keybase.
  • I have a public key ASBstNdIFccVz5yNeqf8znJgYYaTsbS4hF3gHne9Pthv1go

To claim this, I am signing this object:

@kilasuit
kilasuit / search-history.ps1
Created September 9, 2021 00:20
helper function to search PSReadline history
function Search-History {
<#
.Synopsis
Will do this sometime later
.Example
Search-History
#>
@kilasuit
kilasuit / Install-Chrome.ps1
Created May 25, 2021 13:11
Install-Chrome.ps1
Invoke-WebRequest https://dl.google.com/tag/s/dl/chrome/install/googlechromestandaloneenterprise64.msi -OutFile $env:TEMP\chrome.msi
Start-Process -FilePath $env:TEMP\chrome.msi -ArgumentList "/quiet /norestart" -Wait
Remove-Item $env:TEMP\chrome.msi
$data = .\Script1.ps1
.\Script2.ps1 -data $data
@kilasuit
kilasuit / ASTCheck.ps1
Created April 14, 2021 10:16
Pester Test for script error checking
It "Is valid Powershell (Has no script errors)" {
$contents = Get-Content -Path $module.FullName -ErrorAction Stop
$errors = $null
$null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors)
$errors.Count | Should Be 0
}
function gitcleanbranches {
[CmdletBinding()]
[alias('gitcb')]
param(
[switch]
[alias('n')]
$Notmerged,
[switch]
[alias('f')]
@kilasuit
kilasuit / gitcleanups.ps1
Created March 16, 2021 14:58
Functions for cleaning up local git branches
function gitforcecleanbranches {
[CmdletBinding()]
[alias('gitcbf')]
param(
[switch]
$Notmerged
)
if ($notmerged) {
git for-each-ref --format '%(refname:short)' refs/heads | ForEach-Object { if ($_ -match 'master|main') { git branch $_ -D } }
}
@kilasuit
kilasuit / historyhandler.ps1
Created September 25, 2020 16:27
PSReadline no keys/secrets/tokens
Set-PSReadLineOption -AddToHistoryHandler {
param([string]$line)
$sensitive = "password|asplaintext|token|key|secret"
return ($line -notmatch $sensitive)
}
@kilasuit
kilasuit / Export-MyIngiteToICS.ps1
Last active September 22, 2020 17:46 — forked from comnam90/Export-MyIngiteToICS.ps1
Export MyIgnite Schedule to ICS Files
#Requires #Requires -PSEdition Desktop
#IMPORTANT, you need to do this!
#How to get your auth cookie?
#Note the token seems to expire after 10 hours or so!
#logon to myignite with your creds.
#In your prefered browser start dev tools,this F12 in edge,firefox, goto Debugger/storage, Cookies and then find the ignite.token cookie
#copy the cookie value, depending on browser remove "ignitefall.prod.token" from the start and then", myignite.tech....18/09...." from the end so you are left with a base64 string - no commas or other stuff.
#when done it should look like this. dont use this one its not real!
@kilasuit
kilasuit / Wrong
Created June 3, 2020 11:49
ARM Role GUID - right and wrong way
"roleNameGuid": {
"type": "string",
"defaultValue": "[newGuid()]",
"metadata": {
"description": "A new GUID used to identify the role assignment"
}