Skip to content

Instantly share code, notes, and snippets.

View jgstew's full-sized avatar

JGStew jgstew

View GitHub Profile
'''
Created on Mar 27, 2011
@author: hassane
@original: http://code.activestate.com/recipes/577649-dhcp-query/
@modified: Rusty Myers - June 2016 with much help from @frogor and @bruienne. Thanks!
@requirments: python3
@function: returns DHCP offer and BSDP list
@notes: BSDP format - https://static.afp548.com/mactips/bootpd.html
'''
#!/usr/bin/python
#--------------------------------------------------------------------------------------------------
#-- bigfixPkgCustomzer
#--------------------------------------------------------------------------------------------------
# Program : bigfixPkgCustomzer
# To Complie : n/a
#
# Purpose :
#
# Called By :
@mattifestation
mattifestation / ProcessMitigationOption.ps1
Created October 21, 2016 21:22
Helper function for working with registry process mitigation options.
function ConvertTo-ProcessMitigationOption {
[OutputType([String])]
param (
[Switch]
$DEPEnable,
[Switch]
$DEPATLThunkEnable,
[Switch]
#!/usr/bin/env perl
# Author: philsmd (for hashcat)
# License: public domain
# Date: January 2017
use strict;
use warnings;
use Crypt::PBKDF2;
@mattifestation
mattifestation / DFSPoC.ps1
Created December 2, 2015 23:59
Perform unauthenticated WMI queries on a Dell Foundation Services server
function Get-DellFoundationServicesWmiObject {
<#
.SYNOPSIS
Performs a WMI query on a Dell Foundation Services server.
Author: Matthew Graeber (@mattifestation)
License: BSD 3-Clause
.DESCRIPTION
@grantcarthew
grantcarthew / Test-SSD.ps1
Last active November 5, 2019 05:13
PowerShell script to test if a hard disk is an Solid State Disk (SSD) or not.
<#
.SYNOPSIS
Detects if the passed Physical Disk Id is a Solid State Disk (SSD) or a
spindle disk. Returns true for an SSD and false for anything else.
.DESCRIPTION
Use Get-PhysicalDisk to get the Physical Disk Ids for the system you wish
to test. This script supports values being passed throught the pipeline.
The methods used for detecting are by reading the Nominal Media Rotation
@mwulftange
mwulftange / exec-with-timeout.vbs
Created February 9, 2016 09:46
Exec with timeout in VBScript
' Calls WshShell.Exec with c and kills the process tree after the specified timeout t
' Returns the created WshScriptExec object
Function Exec(c, t)
Dim s, e : Set s = CreateObject("WScript.Shell") : Set e = s.Exec(c)
Do While e.Status = 0
Call s.Run("waitfor /t 1 OneSecond", 0, True)
t = t - 1
If 0 >= t Then
Call s.Run("taskkill /t /f /pid " & e.ProcessId, 0, True)
Exit Do
@krmnn
krmnn / collectwindows
Created March 20, 2015 12:42
Move all windows to main display (OS X)
-- Example list of processes to ignore: {"xGestures"} or {"xGestures", "OtherApp", ...}
property processesToIgnore : {}
-- Get the size of the Display(s), only useful if there is one display
-- otherwise it will grab the total size of both displays
tell application "Finder"
set _b to bounds of window of desktop
set screen_width to item 3 of _b
set screen_height to item 4 of _b
end tell
@gregneagle
gregneagle / gist:01c99322cf985e771827
Created January 20, 2015 18:16
Using CFPreferences in Python to set a complex preference
import plistlib
import CoreFoundation
from Foundation import NSDate, NSMutableArray, NSMutableDictionary
# read the current ManagedPlugInPolicies
policy = CoreFoundation.CFPreferencesCopyAppValue("ManagedPlugInPolicies", "com.apple.Safari")
if policy:
# policy is an immutable dict, so we have to make a mutable copy
my_policy = NSMutableDictionary.alloc().initWithDictionary_copyItems_(policy, True)
@mattifestation
mattifestation / NanoServerSetup.ps1
Last active August 16, 2021 18:10
My setup steps to get Nano Server running on bare metal on my Intel NUC
#region Step #1 (optional): Salvaging of drivers
# I had to manually install a disk and network driver the last time I installed Nano Server.
# I saved my previous WIM file and exported the installed drivers using the Dism cmdlets.
# These paths are specific to my system.
# This was my old Nano Server TP5 image.
$NanoTP5ImagePath = 'C:\Users\Matt\Desktop\Temp\NanoTP5Setup\NanoServerBin\NanoServer.wim'
$WimTempMountDir = 'C:\Users\Matt\Desktop\TempMountDir'
$ExportedDriverDir = 'C:\Users\Matt\Desktop\ExportedDrivers'