Skip to content

Instantly share code, notes, and snippets.

@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
@JustinGrote
JustinGrote / ConvertTo-Markdown.ps1
Created January 27, 2024 00:25
Convert PowerShell Objects to Markdown Display by screen-scraping Format-Table
using namespace System.Collections.Generic
using namespace Microsoft.PowerShell.Commands.Internal.Format
#Inspired by: https://gist.github.com/aaroncalderon/09a2833831c0f3a3bb57fe2224963942
<#
.Synopsis
Converts PowerShell Objects or Format-Table output to Markdown
#>
Function ConvertTo-Markdown {
[CmdletBinding()]
@JustinGrote
JustinGrote / Update-HelpFast.ps1
Last active May 1, 2025 20:48
Update Help More Quickly using ThreadJob
#Requires -module ThreadJob
param(
#Filter modules to update by name, otherwise will update all modules
[string[]]$Name = @(),
[ValidateSet('AllUsers', 'CurrentUser')]
$Scope = 'CurrentUser',
$ThrottleLimit = 30
)
try {
@JBGruber
JBGruber / docker-compose.yml
Last active September 5, 2025 05:15
My compose file to run ollama and ollama-webui
services:
# ollama and API
ollama:
image: ollama/ollama:latest
container_name: ollama
pull_policy: missing
tty: true
restart: unless-stopped
# Expose Ollama API outside the container stack (but only on the same computer;
@business24ai
business24ai / save_note_to_obsidian.py
Created December 31, 2023 11:29
An AutoGen Studio skill to store markdown content to our second brain obsidian
# A skill to store markdown content to our second brain obsidian
import os
def store_note_to_obsidian(filename, content):
"""
Store markdown content to our second brain in a local Obsidian vault
:param filename: str, filename of the note
:param content: str, content of the note as markdown
@SQLDBAWithABeard
SQLDBAWithABeard / remove-filesystemitem.ps1
Last active April 11, 2024 16:02
cant remove unempty dorectories
function Remove-FileSystemItem {
<#
.SYNOPSIS
Removes files or directories reliably and synchronously.
.DESCRIPTION
Removes files and directories, ensuring reliable and synchronous
behavior across all supported platforms.
The syntax is a subset of what Remove-Item supports; notably,
@subfuzion
subfuzion / README.md
Last active September 27, 2024 01:47
Log and review terminal sessions

Sometimes I have a number of terminal sessions open and I want to remember where I left off (for example, when rebooting). I'm sure there's a better way to automate this, but I haven't put thought into it.

For now, I just enter log-session to log the current directory, and later when I want to view previous sessions, I enter sessions.

@jdhitsolutions
jdhitsolutions / Challenge.md
Last active April 7, 2024 11:39
PowerShell Podcast Scripting Challenge

PowerShell Podcast ScriptingChallenge

This is the PowerShell scripting challenge from my appearance on the PowerShell Podcast

Base Challenge

Using whatever tools and techniques you want, write a PowerShell function that will query the Issues section of a GitHub repository and create output showing the number of open issues by label and the percentage of all open issues. Remember that multiple labels may be used with an issue.

For example, if there are 54 open issues and the bug label is used 23 times,your output would show a count of 23 and a total percentage of 42.59 for the bug

from langchain.chat_models import ChatOpenAI
from langchain.prompts import ChatPromptTemplate
from langchain.schema.output_parser import StrOutputParser
import requests
from bs4 import BeautifulSoup
from langchain.schema.runnable import RunnablePassthrough, RunnableLambda
from langchain.utilities import DuckDuckGoSearchAPIWrapper
import json
RESULTS_PER_QUESTION = 3
@subfuzion
subfuzion / README.md
Last active June 25, 2025 10:36
Node.js 21.1.0 - build single executable application

Sharing my project's build script in case it's useful to others. I'm not testing for Windows, which is why the script reports an error, but just note that emitting Windows executables is actually supported by the Node API (see docs). Feel free to use and modify.

Notes

  • Webpack is used for bundling.
  • The entry point for the webpack config for my example is ./bin/app, which was an executable Node.js script with a shebang line. Update the config to point to whatever your app's entry point is.
  • The SEA config file uses disableExperimentalSEAWarning to suppress the experimental warning displayed when running a generated executable. This didn't work for Node 20.1.0 (see issue), but it has been tested and does work for 21.1.0.