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
@Jaykul
Jaykul / SubscriptionNameCompleterAttribute.ps1
Last active September 14, 2020 10:55
Bonus Argument Completers For Azure
using namespace Microsoft.Azure.Commands.Common.Authentication.Abstractions
using namespace System.Management.Automation.Language
using namespace System.Management.Automation
using namespace System.Collections.Generic
using namespace System.Collections
[AttributeUsage("Property,Field")]
class SubscriptionNameCompleter : ArgumentCompleterAttribute {
# PowerShell expects you to write IArgumentCompleter and register them with this syntax:
# [ArgumentCompleter([MyIArgumentCompleter])]
#region UX config
Import-Module posh-git
if (Get-Module PSReadLine) {
Import-Module oh-my-posh
$ThemeSettings.MyThemesLocation = "~/.config/powershell/oh-my-posh/Themes"
if (Get-Theme | Where-Object Name -eq Sorin-NL) {
Set-Theme Sorin-NL
@Jaykul
Jaykul / Connect-WaspRemoteDesktop.ps1
Last active August 14, 2020 21:12
Using WASP to remote desktop, for those ocassions when policy blocks you ...
<#
.SYNOPSIS
Connects to remote desktop using the specified credentials by automating UI input using WASP
.DESCRIPTION
Requires the WASP (Windows Automation Scripting in PowerShell) module to be installed.
This script is a workaround for environments where GPOs don't allow saving credentials,
but we only have the credentials via an API from PowerShell.
... hey, it's better than exposing the plain text in a browser and copy-pasting via the clipboard!
@markwragg
markwragg / mactweaks.md
Last active April 25, 2023 18:10
Mac tweaks

Changes to my Mac

Turn off "press and hold" for foreign letters, allowing you to then press and hold for repeat letters. Open Terminal and run:

defaults write NSGlobalDomain ApplePressAndHoldEnabled -bool false

Then you need to close/reopen any app before it takes effect.

Make the dock appear faster when using auto hide:

[cmdletbinding()]
param (
$SourceFolder = $PSScriptRoot
)
if (-not (Get-Module PSDepend -ListAvailable)) {
Install-Module PSDepend -Repository (Get-PSRepository)[0].Name -Scope CurrentUser
}
Push-Location $PSScriptRoot -StackName BuildScript
Invoke-PSDepend -Path $SourceFolder -Confirm:$false
using assembly System.Xml.Linq
using namespace System.Xml.Linq
function RdcDocument {
[CmdletBinding()]
param (
[Parameter(Mandatory, Position = 1)]
[String]$FileName,
[Parameter(Mandatory, Position = 2)]
@indented-automation
indented-automation / ActiveDirectory.md
Last active February 7, 2024 16:59
Active Directory

A small collection specialised scripts for Active Directory.

Includes:

  • Compare-ADMemberOf
  • Get-ADSystemInfo
  • Get-GroupMemberTree
  • Get-LdapObject
  • Get-MemberOfTree
  • Test-LdapSslConnection
@indented-automation
indented-automation / New-Password.ps1
Last active April 6, 2023 19:57
PowerShell random password generator.
function New-Password {
<#
.SYNOPSIS
Generate a random password.
.DESCRIPTION
Generate a random password.
.NOTES
Change log:
27/11/2017 - faustonascimento - Swapped Get-Random for System.Random.
Swapped Sort-Object for Fisher-Yates shuffle.
@jasonjoh
jasonjoh / sendactionablemessage.py
Last active October 17, 2023 12:45
A sample Python script that sends an actionable message via the Office 365 SMTP server.
#! /usr/local/bin/python
"""Sends an actionable message to yourself
Usage: 'sendactionablemessage.py -u <username> -p <password>'
"""
import sys
import getopt
from smtplib import SMTP as SMTP
from email.mime.text import MIMEText
Wordlist ver 0.732 - EXPECT INCOMPATIBLE CHANGES;
acrobat africa alaska albert albino album
alcohol alex alpha amadeus amanda amazon
america analog animal antenna antonio apollo
april aroma artist aspirin athlete atlas
banana bandit banjo bikini bingo bonus
camera canada carbon casino catalog cinema
citizen cobra comet compact complex context
credit critic crystal culture david delta
dialog diploma doctor domino dragon drama