Skip to content

Instantly share code, notes, and snippets.

@dave-britten
dave-britten / Compare-ADGroupMembership.ps1
Created October 1, 2018 22:35
Compares group membership of 2 or more users
Function Compare-ADGroupMembership {
[CmdletBinding()]
Param (
[Parameter(Mandatory=$true,ValueFromPipeline=$true)]
[Alias('Name')]
[string[]]$Username
)
BEGIN {
$groups = @{}
@dave-britten
dave-britten / PYUITest.py
Created September 16, 2015 13:48
PYUITest.py
#Attempt to load a .pyui file and generate code that would produce the same results.
#Note: this doesn't actually work yet.
from __future__ import print_function
infilename = raw_input("Input File?")
#infilename = "RegexSandbox.pyui"
outfilename = infilename + ".py"
f = open(infilename, "r")
@dave-britten
dave-britten / DiceProb.py
Last active September 1, 2015 13:05
Calculate a probability distribution of totals acquired from rolling an arbitrary number of dice, each with an arbitrary configuration of non-negative, integer face values.
import re
dice = [] #Input dice as polynomial coefficients
print "Enter face values as non-negative integers, separated by spaces, commas, or semicolons. (e.g. \"1,2;3 4 5 6\")"
while True:
rawdie = [] #List of face values
qty = 1 #Quantity of a single die spec
inp = raw_input("Die " + str(len(dice) + 1) + "? ")
@dave-britten
dave-britten / ImageResize.py
Last active August 4, 2017 11:03
Select and resize an image from iOS device's photo library. (Pythonista)
#Gist ID: 9951701907ed328218dd
import console
import photos
from PIL import Image
from PIL.ExifTags import TAGS
def adjust(dim, newdim):
newdim = newdim.strip()
try:
if newdim[-1] == "%":