Skip to content

Instantly share code, notes, and snippets.

View shanselman's full-sized avatar

Scott Hanselman shanselman

View GitHub Profile
@shanselman
shanselman / ralph-loop.ps1
Last active January 21, 2026 06:32
PowerShell Ralph Loop for GitHub Copilot CLI - Based on David Fowler's bash script and Geoffrey Huntley's Ralph pattern for autonomous AI coding agents
# Ralph Agent Loop Script for GitHub Copilot CLI (PowerShell)
# Continuously runs Copilot CLI on a task until completion criteria is met
# Usage: .\ralph-loop.ps1 <job-name>
param(
[Parameter(Mandatory=$true, Position=0)]
[string]$JobName
)
# Configuration (can be overridden via environment variables)
@shanselman
shanselman / agent-git-trees.ps1
Created December 28, 2025 22:58
agent-git-trees.ps1
# PowerShell functions for managing git worktrees with agent pattern
# Based on: https://gist.github.com/dhh/18575558fc5ee10f15b6cd3e108ed844
function ga {
<#
.SYNOPSIS
Create a new git worktree and branch
.DESCRIPTION
Creates a new git worktree with a branch name following the pattern:
../[current-dir]--[branch-name]
@shanselman
shanselman / moovtest.py
Created October 26, 2024 22:40
moovtest.py
from py532lib.i2c import *
from py532lib.frame import *
from py532lib.constants import *
from py532lib.mifare import *
import ndef
import logging
last_card_data = None
@shanselman
shanselman / setupmachine.bat
Last active November 17, 2025 20:57
WinGet Setup a New Machine
mkdir c:\github
winget install --id=Git.Git -e --accept-package-agreements --accept-source-agreements
winget install --id=Microsoft.VisualStudioCode -e
winget install --id=AgileBits.1Password -e
winget install --id=7zip.7zip -e
winget install --id=Twilio.Authy -e
winget install --id=Bethesda.Launcher -e
winget install --id=Microsoft.Bicep -e
winget install --id=Microsoft.bitsmanager -e
winget install --id=BrutalChess.BrutalChess -e
using namespace System.Management.Automation
using namespace System.Management.Automation.Language
if ($host.Name -eq 'ConsoleHost')
{
Import-Module PSReadLine
}
#Import-Module PSColors
#Import-Module posh-git
Import-Module -Name Terminal-Icons
@shanselman
shanselman / ohmyposhv3-v2.json
Last active January 14, 2026 23:42
ohmyposhv3-v2
{
"final_space": true,
"console_title": true,
"console_title_style": "folder",
"blocks": [
{
"type": "prompt",
"alignment": "left",
"horizontal_offset": 0,
"vertical_offset": 0,
using namespace System.Management.Automation
using namespace System.Management.Automation.Language
if ($host.Name -eq 'ConsoleHost')
{
Import-Module PSReadLine
}
Import-Module PSColors
#Import-Module posh-git
Import-Module -Name Terminal-Icons
@shanselman
shanselman / main.py
Last active April 30, 2022 08:44 — forked from JonDouglas/main.py
TikTok downloader
from TikTokApi import TikTokApi
import random
import string
proxy = "some_cool"
api = TikTokApi.get_instance(use_test_endpoints=True)
did = ''.join(random.choice(string.digits) for num in range(19))
count = 500
@shanselman
shanselman / ohmyposhv3.json
Created December 23, 2020 03:48
My ohMyPoshv3 json
{
"final_space": true,
"console_title": true,
"console_title_style": "folder",
"blocks": [
{
"type": "prompt",
"alignment": "left",
"horizontal_offset": 0,
"vertical_offset": 0,
@shanselman
shanselman / ParadoxGlucose.psm1
Created July 21, 2020 00:30
My oh-my-posh prompt with glucose values from nightscout-ps1
#requires -Version 2 -Modules posh-git
function Write-Theme {
param(
[bool]
$lastCommandFailed,
[string]
$with
)