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
@indented-automation
indented-automation / New-Password.ps1
Last active May 7, 2024 08: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.
@katylava
katylava / git-selective-merge.md
Last active February 27, 2024 10:18
git selective merge

Update 2022: git checkout -p <other-branch> is basically a shortcut for all this.

FYI This was written in 2010, though I guess people still find it useful at least as of 2021. I haven't had to do it ever again, so if it goes out of date I probably won't know.

Example: You have a branch refactor that is quite different from master. You can't merge all of the commits, or even every hunk in any single commit or master will break, but you have made a lot of improvements there that you would like to bring over to master.

Note: This will not preserve the original change authors. Only use if necessary, or if you don't mind losing that information, or if you are only merging your own work.

@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
@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
@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:

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
#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 / 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])]
@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!
using assembly System.Xml.Linq
using namespace System.Xml.Linq
function RdcDocument {
[CmdletBinding()]
param (
[Parameter(Mandatory, Position = 1)]
[String]$FileName,
[Parameter(Mandatory, Position = 2)]