Skip to content

Instantly share code, notes, and snippets.

View brettmillerb's full-sized avatar
🏠
Working from home

Brett Miller brettmillerb

🏠
Working from home
View GitHub Profile
@brettmillerb
brettmillerb / servicenowuser.ps1
Created February 28, 2020 11:52
ServiceNow Sys_User
# Eg. User name="admin", Password="admin" for this code sample.
$user = "admin"
$pass = "admin"
# Build auth header
$base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f $user, $pass)))
# Set proper headers
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add('Authorization', ('Basic {0}' -f $base64AuthInfo))
@brettmillerb
brettmillerb / profile.ps1
Last active January 18, 2022 00:46
Mac Pwsh Profile
Import-Module -Name Toolbox
Import-Module -Name Microsoft.PowerShell.UnixCompleters
Import-Module -Name Terminal-Icons
function BackOne {
Set-Location ..
}
function BackTwo {
Set-Location ../..
}
HelpUri : https://go.microsoft.com/fwlink/?LinkID=113308
ResolvedCommandName : Get-ChildItem
DisplayName : gci -> Get-ChildItem
ReferencedCommand : Get-ChildItem
ResolvedCommand : Get-ChildItem
Definition : Get-ChildItem
Options : ReadOnly
Description :
OutputType : {System.IO.FileInfo, System.IO.DirectoryInfo}
Name : gci
function Get-RandomAdilioSticker {
[CmdletBinding()]
param ()
begin {
$results = irm -Uri 'https://api.github.com/repos/adilio/ps-design/git/trees/master?recursive=1'
}
process {
start ("{0}/{1}" -f 'https://raw.githubusercontent.com/adilio/ps-design/master', ($results.tree | ? path -match 'png$' | Get-Random | Select-Object -ExpandProperty path))
@brettmillerb
brettmillerb / BeRightBack.html
Last active April 7, 2021 17:17
Twitch Stream Starting Animation
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<style>
body {
@brettmillerb
brettmillerb / Split-FolderPath.ps1
Last active October 10, 2019 13:17
Creates pscustomobject from filepath
using namespace System.Collections.Specialized
Get-ChildItem -Path C:\support\git\gitpersonal | Select-Object -ExpandProperty FullName |
function Split-FolderPath {
[CmdletBinding()]
param (
[Parameter(ValueFromPipeline)]
[string[]]
$Path
@brettmillerb
brettmillerb / run.ps1
Last active September 13, 2019 06:36
ServiceNow Helper
using namespace System.Net
using namespace System.Management.Automation
# Input bindings are passed in via param block.
param (
$Request,
$TriggerMetadata
)
# Write to the Azure Functions log stream.
@brettmillerb
brettmillerb / Get-MultiPass.ps1
Last active July 18, 2019 11:20
MultiPass CLiXML Handlers
function Get-MultiPass {
<#
.SYNOPSIS
Retrieves a previously created MultiPass file
.DESCRIPTION
Retrieves a previously created MultiPass file from the specified Path
.PARAMETER Path
Specifies a path to the location of a credential XML file.
function Get-Syntax {
[CmdletBinding()]
param (
$Command,
[switch]
$Normalise
)
$check = Get-Command -Name $Command