Skip to content

Instantly share code, notes, and snippets.

View aytch's full-sized avatar

Brandon Presley aytch

  • Portland, OR, United States
View GitHub Profile
function Set-ElevatedStatus {
$WindowsPrincipal = new-object System.Security.Principal.WindowsPrincipal(`
[System.Security.Principal.WindowsIdentity]::GetCurrent()
)
$IsAdmin = $WindowsPrincipal.IsInRole(`
[System.Security.Principal.WindowsBuiltInRole]::Administrator)
if ($IsAdmin -eq $True) {
# No action required
}
else {
@aytch
aytch / keybase.md
Created April 4, 2019 17:49
keybase.md

Keybase proof

I hereby claim:

  • I am aytch on github.
  • I am aytch (https://keybase.io/aytch) on keybase.
  • I have a public key ASB8aYbAlzFPBykM_tac_Lp03pZE_ewUHqv6-ypzCIttmwo

To claim this, I am signing this object:

@aytch
aytch / workaround.md
Created June 7, 2019 15:21 — forked from cheeseplus/workaround.md
Chef Infra License Errors in Test-kitchen and Packer

If you're getting errors like:

       +---------------------------------------------+
            Chef License Acceptance
       
       Before you can continue, 2 product licenses
       must be accepted. View the license at
       https://www.chef.io/end-user-license-agreement/
       
$serverlist = "server1","server2"
# `%{}` is shorthand for ForEach-Object.
# `$_` is a special variable that refers to "this" item in the array.
$serverlist | %{ Invoke-Command -ComputerName $_ -AsJob -ScriptBlock { <some commands> } }
# To view results of jobs
Get-Job | Receive-Job
@aytch
aytch / start-noita.ps1
Created January 22, 2021 00:01 — forked from vexx32/start-noita.ps1
Starts Noita from the given path, optionally with a specific seed set.
function Start-Noita {
<#
.SYNOPSIS
Starts Noita from a PowerShell prompt, optionally with a specific set seed for a new game.
.DESCRIPTION
To use this function, copy and paste the complete function definition into a PowerShell
session, and then invoke it with `Start-Noita`. Supply `-Seed somevalue` if you would like
to run a specific seed (see the examples below).
@aytch
aytch / Noita Functions
Created April 2, 2021 14:57
Powershell $PROFILE functions for Noita. You can start Noita with a specific seed, and/or set all the game flags back to unmodded (after you save and quit). If you don't have a powershell profile, open Powershell and run: 'New-Item -Type File -Path $PROFILE -force', then run: 'notepad $PROFILE' and paste the contents below and save the file. Rel…
function Start-Noita {
<#
.SYNOPSIS
Starts Noita from a PowerShell prompt, optionally with a specific set seed for a new game.
.DESCRIPTION
To use this function, copy and paste the complete function definition into a PowerShell
session, and then invoke it with `Start-Noita`. Supply `-Seed somevalue` if you would like
to run a specific seed (see the examples below).