Skip to content

Instantly share code, notes, and snippets.

View ShaunLawrie's full-sized avatar
🦄
Beep

Shaun Lawrie ShaunLawrie

🦄
Beep
View GitHub Profile
#requires -Modules @{ModuleName='PwshSpectreConsole'; ModuleVersion='2.1.2'}, @{ModuleName='PSBlueSky'; ModuleVersion='0.6.0'}
# REQUIRES WINDOWS TERMINAL PREVIEW 1.22+ FOR SIXEL https://devblogs.microsoft.com/commandline/windows-terminal-preview-1-22-release/
# Or another sixel capable terminal emulator but I've only tested on Windows Terminal Preview so far
# REQUIRES BLUE SKY CREDS TO BE SETUP
$timeline = Get-BskyTimeline -Limit 15
$formattedPosts = @()
foreach ($post in $timeline) {
@ShaunLawrie
ShaunLawrie / SixelTinkering.ps1
Last active February 21, 2025 08:26
Tinkering with sixel in powershell
<#
My rambling notes from trying to understand sixels and how to use them in Windows Terminal.
I read up on a bunch of github issues, https://vt100.net/shuford/terminal/all_about_sixels.txt and wikipedia sixels pages
Each vertically stacked "pixel" in a sixel has a value to the power of 2 starting with 1 and ending at 32.
[*] 1 = 2^0
[*] 2 = 2^1
[*] 4 = 2^2
@ShaunLawrie
ShaunLawrie / ChatTTY.ps1
Last active September 15, 2024 22:57
ChatTTY - A wireframe of a chat app in PwshSpectreConsole
#Requires -Modules @{ ModuleName = 'PwshSpectreConsole'; RequiredVersion = '2.1.1' }
Set-SpectreColors -AccentColor DeepPink1
# Build root layout scaffolding for:
# .--------------------------------.
# | Title | <- Update-TitleComponent will render the title
# |--------------------------------|
# | | <- Update-MessageListComponent will display the list of messages here
# | |
@ShaunLawrie
ShaunLawrie / PwshSpectreConsoleLiveDemo.ps1
Created September 1, 2024 10:16
Spectre.Console Live + Layouts
#Requires -Modules @{ ModuleName = 'PwshSpectreConsole'; RequiredVersion = '2.1.0' }
Set-SpectreColors -AccentColor BlueViolet
# Build root layout scaffolding for:
# .--------------------------------.
# | Header |
# |--------------------------------|
# | File List | Preview |
# | | |
using namespace System.Management.Automation.Subsystem.Feedback
using namespace System.Management.Automation.Subsystem
using namespace System.Threading
param (
# Just unregister the implementation
[switch] $UnregisterOnly
)
class TestingFeedback : IFeedbackProvider {
@ShaunLawrie
ShaunLawrie / spinner.ps1
Last active July 13, 2023 00:14
A Basic "Spinner" in PowerShell
# Do some work
Write-Host "Doing some work"
$job = Start-Job {
Start-Sleep -Seconds 5
}
# Spinner
$location = $Host.UI.RawUI.CursorPosition
$spinnerIcons = @(". ", ".. ", "...")
$spinnerIconIndex = 0
@ShaunLawrie
ShaunLawrie / GithubCodeSearch.psm1
Last active October 6, 2022 09:13
Quick script for extracting regex patterns from github codesearch
#requires -Version 7
function Invoke-GithubCodeSearchLogin {
param (
[Parameter(Mandatory)]
[string] $Username,
[Parameter(Mandatory)]
[securestring] $Password
)
Write-Verbose "This requires cookies across multiple domains so we're using a session like a web browser to keep state"