Skip to content

Instantly share code, notes, and snippets.

View jongalloway's full-sized avatar

Jon Galloway jongalloway

View GitHub Profile
@jongalloway
jongalloway / .jump-utils.zsh
Last active March 20, 2026 21:17
jump-utils.zsh - Lightweight directory jump utilities for Zsh (macOS port of jump-utils.ps1)
# jump-utils.zsh - Lightweight directory jump utilities for Zsh
# Ported from: https://gist.github.com/jongalloway/332c3b15d2557dfa71575b79713ffbf1
#
# Quick install - add to your ~/.zshrc:
# [[ -f ~/.jump-utils.zsh ]] && source ~/.jump-utils.zsh
#
# Usage:
# repo <name> - pushd to a repo (supports partial match + tab completion)
# repo list - list all repos
# repo - pushd to repo root
@jongalloway
jongalloway / jump-utils.ps1
Last active March 20, 2026 21:34
jump-utils.ps1 - Lightweight directory jump utilities for PowerShell. Install with: iwr "https://gist.githubusercontent.com/jongalloway/332c3b15d2557dfa71575b79713ffbf1/raw/jump-utils.ps1" -outf "$(Split-Path $PROFILE)\jump-utils.ps1"
# jump-utils.ps1 - Lightweight directory jump utilities for PowerShell
# https://gist.github.com/jongalloway/332c3b15d2557dfa71575b79713ffbf1
#
# Quick install - add this to your PowerShell profile (code $PROFILE):
# iwr "https://gist.githubusercontent.com/jongalloway/332c3b15d2557dfa71575b79713ffbf1/raw/jump-utils.ps1" -OutF "$(Split-Path $PROFILE)\jump-utils.ps1"
# Add-Content $PROFILE '. (Join-Path (Split-Path $PROFILE) "jump-utils.ps1")'
#
# Or manually:
# 1. Save this file next to your profile (Split-Path $PROFILE)
# 2. Add to your PowerShell profile: . (Join-Path (Split-Path $PROFILE) "jump-utils.ps1")
@jongalloway
jongalloway / setup-copilot-terminal-profile.ps1
Last active March 14, 2026 03:02
Setup GitHub Copilot Windows Terminal profile with icon
# Setup GitHub Copilot Windows Terminal Profile
# Run: irm <gist-raw-url> | iex
$ErrorActionPreference = "Stop"
function Write-Step([string]$Message) {
Write-Host "[OK] $Message"
}
# 0. Choose the best Copilot command available
@jongalloway
jongalloway / AdobePodcastDownloader.js
Created November 9, 2025 19:24
Adobe Podcast Bulk Downloader - run in devtools console
(async () => {
function simulateSliderDrag(sliderHandle, targetValue, defaultValue) {
const track = sliderHandle.closest('.rc-slider');
if (!track) return;
const trackRect = track.getBoundingClientRect();
const totalPixels = trackRect.width;
const deltaUnits = targetValue - defaultValue;
const deltaPixels = (deltaUnits / 100) * totalPixels;
@jongalloway
jongalloway / ai-webchat-demo.md
Last active June 5, 2025 22:27
AI Web Chat Demo based on the Build 2025 lab. Full steps are in https://github.com/dotnet-presentations/build-2025-lab307

AI Chat Web App Demo Steps

Setup

  1. Install the AI Web Chat template:

    dotnet new install Microsoft.Extensions.AI.Templates
/********************************* Module Header **********************************\
* Module Name: DataGridViewPaging
* Project: CSWinFormDataGridView
* Copyright (c) Microsoft Corporation.
*
* This sample demonstrates how to page data in the DataGridView control;
\**********************************************************************************/
#region Using directives
using System;
# Define the dev drive letter and resizing percentage
$devDriveLetter = "D"
$resizePercentage = 10 # Set the percentage increase (e.g., 10%)
# Find the VHDX file associated with the dev drive
$mountedVHDs = Get-VHD | Where-Object -Property FileType -EQ "VHDX" | Where-Object -Property Attached -EQ $true
$devDriveVHD = $mountedVHDs | Where-Object {
$disk = Get-DiskImage -Path $_.Path | Get-Disk | Where-Object IsOffline -EQ $false
$partition = Get-Partition -DiskNumber $disk.Number | Where-Object DriveLetter -EQ $devDriveLetter
@jongalloway
jongalloway / FixMermaidSvg.js
Last active November 20, 2025 12:35
Mermaid diagrams use non-standard foreignObject and HTML instead of standard SVG. This snippet can be run in a browser console to get most of the way to SVG that can be edited in Inkscape and other SVG editors. More info about the issue this fixes here: https://github.com/mermaid-js/mermaid/issues/2688
(function() {
// Manually set x and y values for text elements since calculation isn't reliable. Set to what works for your theme.
const textX = 0;
const textY = 17;
// Optional feature to insert a white rectangle below the diagram for dark mode visibility
const addBackgroundRect = false;
// Get the SVG element
const svg = document.querySelector('svg');
@jongalloway
jongalloway / Program.cs
Created October 12, 2023 19:53
Simple AI Chat
using Microsoft.Extensions.Logging;
using Microsoft.SemanticKernel;
using Microsoft.SemanticKernel.AI.ChatCompletion;
using Microsoft.SemanticKernel.Memory;
using System.Text;
string aoaiEndpoint = Environment.GetEnvironmentVariable("AZUREOPENAI_ENDPOINT")!;
string aoaiApiKey = Environment.GetEnvironmentVariable("AZUREOPENAI_API_KEY")!;
string gptModelDeploymentName = Environment.GetEnvironmentVariable("AZUREOPENAI_GPT_NAME")!;
string adaTextDeploymentName = Environment.GetEnvironmentVariable("AZUREOPENAI_TEXT_EMBEDDING_NAME")!;
@jongalloway
jongalloway / starcounter.js
Last active January 11, 2023 20:15 — forked from yyx990803/starcounter.js
Count your total stars!
var https = require('https'),
user = process.argv[2],
opts = parseOpts(process.argv.slice(3))
request('/users/' + user, function (res) {
if (!res.public_repos) {
console.log(res.message)
return
}
var pages = Math.ceil(res.public_repos / 100),