Skip to content

Instantly share code, notes, and snippets.

@jimbrig
jimbrig / comma-first-var.js
Created March 14, 2024 22:49 — forked from isaacs/comma-first-var.js
A better coding convention for lists and object literals in JavaScript
// See comments below.
// This code sample and justification brought to you by
// Isaac Z. Schlueter, aka isaacs
// standard style
var a = "ape",
b = "bat",
c = "cat",
d = "dog",
@jimbrig
jimbrig / EasyFormat.ps1
Created February 17, 2024 17:54 — forked from JustinGrote/EasyFormat.psm1
A proxy for Format-Table to apply the resultant view or save it as a format definition
using namespace System.Management.Automation
using namespace System.Collections
function ConvertFrom-Format {
<#
.SYNOPSIS
Converts Format-Table output to a format that can be used with Add-FormatTable
#>
param(
#The name of the format view definition assigned to the format data. Default is 'CustomTableView
[ValidateNotNullOrEmpty()][string]$Name = 'CustomTableView',
@jimbrig
jimbrig / Trace-AICommand.ps1
Created February 17, 2024 17:03 — forked from JustinGrote/Trace-AICommand.ps1
Report the results and performance of any scriptblock to Azure Application Insights
#requires -version 7
#You can load this script with $(iwr https://tinyurl.com/TraceAICommand | iex)
using namespace Microsoft.ApplicationInsights
using namespace Microsoft.ApplicationInsights.Extensibility
using namespace Microsoft.ApplicationInsights.DataContracts
using namespace System.Management.Automation
using namespace System.Collections.Generic
using namespace System.Net
#Reference: https://docs.microsoft.com/en-us/azure/azure-monitor/app/console
@jimbrig
jimbrig / README.md
Created February 17, 2024 02:13
GitHub Markdown Callouts
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jimbrig
jimbrig / PSWakeOnLan.psm1
Created February 8, 2024 21:40
[PowerShell] Wake on LAN (WOL) and Packet Broadcast to Remote Machine
Function Get-MACAddress {
Param(
[Switch]$Local,
[String]$ComputerName
)
if ($Local) {
$MACAddress = Get-WmiObject -Class Win32_NetworkAdapterConfiguration -Filter "IPEnabled = 'True'" | Select-Object -ExpandProperty MACAddress
} else {
$MACAddress = Get-WmiObject -Class Win32_NetworkAdapterConfiguration -Filter "IPEnabled = 'True'" -ComputerName $ComputerName | Select-Object -ExpandProperty MACAddress
@jimbrig
jimbrig / Wake.ps1
Created February 8, 2024 21:03 — forked from alimbada/Wake.ps1
PowerShell script for sending Wake On LAN magic packets to given machines/MAC address(es)
#######################################################
##
## Wake.ps1, v1.0, 2013
##
## Adapted by Ammaar Limbada
## Original Author: Matthijs ten Seldam, Microsoft (see: http://blogs.technet.com/matthts)
##
#######################################################
<#
User-Report-V4
@jimbrig
jimbrig / User-Report-V4.ps1
Created November 25, 2023 22:59
Demo html
User-Report-V4
@jimbrig
jimbrig / PoSH_Postback.ps1
Created November 6, 2023 22:43 — forked from airtank20/PoSH_Postback.ps1
Script to download file from javascript Postback
#URL that needs to be fetched
$url = "https://site.state.gov/default.aspx"
#get the server name in case the process jumps to another script
$serverName = $env:computername
#wrapped it into a try/catch for some type of error handling
TRY {
#use invoke-webrequest to fetch a session from the site
Invoke-WebRequest $url -SessionVariable session -UseBasicParsing