Skip to content

Instantly share code, notes, and snippets.

View shanselman's full-sized avatar

Scott Hanselman shanselman

View GitHub Profile
@shanselman
shanselman / copilot-cli-oh-my-posh-statusline.md
Last active May 15, 2026 00:54
Use Oh My Posh for the GitHub Copilot CLI statusline

Use Oh My Posh for the GitHub Copilot CLI statusline

GitHub Copilot CLI has an experimental statusline feature that can run a local command and render the command's output at the bottom of the Copilot terminal UI.

If you already use Oh My Posh, you can use the same engine, colors, and segments to render a Copilot-aware statusline in a few minutes.

This guide shows a Windows + PowerShell setup, but the idea is portable:

  1. Copilot calls a local script.
  2. Copilot sends session state to the script as JSON on stdin.
@shanselman
shanselman / yolo.ps1
Created January 26, 2026 05:39
PowerShell function to quickly jump to a GitHub repo and run Copilot CLI
function yolo {
param([Parameter(Mandatory=$true)][string]$RepoName)
Set-Location "D:\GitHub\$RepoName"
copilot --resume --yolo
}
@shanselman
shanselman / ralph-loop.ps1
Last active March 25, 2026 15:09
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 February 12, 2026 22:11
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
{
"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