Skip to content

Instantly share code, notes, and snippets.

View gsusI's full-sized avatar
💭
🛫

Jesus Iniesta gsusI

💭
🛫
View GitHub Profile
@MattJeanes
MattJeanes / GitHubCopilotCLIAlias.ps1
Last active August 15, 2024 23:41
Alias commands to use GitHub Copilot CLI in PowerShell
# You should insert this script into your PowerShell Profile script so it exists in every session
# Fun fact: This script was mostly generated by ChatGPT by giving it the bash version of the output
# from `github-copilot-cli alias -- "$0"` with a few fixes from me
function Invoke-CopilotWhatTheShell {
$TMPFILE = New-TemporaryFile;
try {
github-copilot-cli what-the-shell $args --shellout $TMPFILE
if ($LASTEXITCODE -eq 0) {
@gsusI
gsusI / convert-to-lf.ps1
Last active February 7, 2023 16:40
EOL from CRLF to LF recursively: this script will convert all files in the current directory and all subdirectories to unix line endings
# Set the parameters
$path = Get-Location
$numbOfThreads = 50
$exclude_patterns = "^.*(\.git|\.idea|node_modules|\.next|\.(jpeg|jpg|png|gif|mp4|mkv|mp3|wav)$).*$"
# Find filles to convert
$files = Get-ChildItem -Path $path -Recurse -Include * -File -Force | Where-Object {$_.FullName -notmatch $exclude_patterns}
Write-Host "Found $($files.Count) files"
$files | ForEach-Object -Parallel {