Skip to content

Instantly share code, notes, and snippets.

View pa-0's full-sized avatar

Peter Abbasi pa-0

View GitHub Profile
@pa-0
pa-0 / Icon-Source-Finder.ps1
Created May 9, 2025 01:04 — forked from ThioJoe/Icon-Source-Finder.ps1
PowerShell script that finds the icon source for a given file, including system files.
# This PowerShell script finds the icon source for a given file.
# It first tries to extract the icon from the associated executable,
# and if not found, it looks up the icon in the Windows Registry.
# Author: ThioJoe / GitHub.com/ThioJoe
param(
[string]$initialFilePath # Initial file path parameter for direct execution
)
# Function to prompt the user for a file path.
@pa-0
pa-0 / port-cvs-to-git-with-reposurgeon.md
Created May 8, 2025 00:06 — forked from ryfactor/port-cvs-to-git-with-reposurgeon.md
Port CVS repositories to git with reposurgeon

Port CVS repositories to git with reposurgeon

In a rush to change your old CVS repositories to git? Don't be. Take your time and get it right with Eric Raymond's reposurgeon. (But make haste while SourceForge is still up...!)

Some folk believe that reposurgeon is complicated, and that a simple invocation of cvs-fast-export will do. Arguably this is not true, in fact cvs-fast-export is just one of the tools in the reposurgeon toolset, and while it can be used by itself it's really better used as part of the overarching reposurgeon suite. Moreover, using cvssync, cvs-fast-export and git fast-import together means you are using a jumble of command line steps, whereas reposurgeon (built on those tools) entails just setting up some config files and letting it rip. Reposurgeon also has options for updating author info, timezones, character encoding, and more. So reposurgeon is more straightforward than trying to use cvs-fast-export directly, is more feature

@pa-0
pa-0 / set_process_affinity.ps1
Created May 6, 2025 16:27 — forked from Philmist/set_process_affinity.ps1
Set affinity of target process (Escape of Tarkov)
# Path to Launcher
$ExecuteTarget = "C:\Games\Battlestate Games\BsgLauncher\BsgLauncher.exe"
# Target process to set affinity
$TargetProcess = "EscapeFromTarkov"
# Get Number of cpu's physical core
$PhysicalCores = 0
(Get-WmiObject Win32_Processor).NumberOfCores | %{ $PhysicalCores += $_ }
@pa-0
pa-0 / get-winrtversion.ps1
Created May 6, 2025 01:29 — forked from SteveL-MSFT/get-winrtversion.ps1
Example calling WnRT API from PS7 to get Windows version information
# adapted from https://community.idera.com/database-tools/powershell/powertips/b/tips/posts/identifying-windows-version-part-2
# download and unzip latest https://www.nuget.org/packages/Microsoft.Windows.SDK.NET.Ref and get these dlls from the 'lib' folder
Add-Type -AssemblyName ./winrt.runtime.dll
Add-Type -AssemblyName .\Microsoft.Windows.SDK.NET.dll
# define call and information to query
[Collections.Generic.List[System.String]]$names = 'DeviceFamily',
'OSVersionFull',
'FlightRing',
@pa-0
pa-0 / Microsoft.PowerShell_profile.ps1
Created May 2, 2025 02:40 — forked from ddieppa/Microsoft.PowerShell_profile.ps1
OhMyPosh Configuration and PowerShell Profile
# Handle PowerShell 7.4+ UTF-8 encoding issues
$previousOutputEncoding = [Console]::OutputEncoding
[Console]::OutputEncoding = [Text.Encoding]::UTF8
try {
# # PowerToys Command Not Found Integration (with safe handling)
# $powerToysModulePath = Join-Path $env:LocalAppData "PowerToys\WinGetCommandNotFound.psd1"
# if (Test-Path $powerToysModulePath) {
# try {
# # Enable PowerShell Experimental Features for PowerToys
@pa-0
pa-0 / Microsoft.PowerShell_profile.ps1
Created May 2, 2025 02:14 — forked from SteelPh0enix/Microsoft.PowerShell_profile.ps1
My PowerShell Profile script (put in $HOME/Documents/PowerShell)
$PROFILE_DIR = Split-Path -Parent $profile
$env:Path = "C:\Users\phoen\.local\bin;$env:Path"
Import-Module -Name Microsoft.WinGet.CommandNotFound
Set-PSReadLineOption -EditMode Emacs
Function superls { eza --header --classify=always --color=always --icons=always --group $args }
Function superls_list { eza --header --classify=always --color=always --icons=always --group --long $args }
Function superls_list_all { eza --header --classify=always --color=always --icons=always --group --long --all $args }
Function remove_force { rm -Force $args }
// Dump all links on a page to a text file, may need to disable adblock temporarily
window.open("data:text/csv;charset=utf-8," + encodeURIComponent(Array.from(document.links).map(e=>e.href).join("\n")))
@pa-0
pa-0 / Out-FileUtf8NoBom.ps1
Created May 2, 2025 01:58 — forked from mklement0/Out-FileUtf8NoBom.ps1
PowerShell function that emulates Out-File for creating UTF-8-encoded files *without a BOM* (byte-order mark).
<#
Prerequisites: PowerShell version 3 or above.
License: MIT
Author: Michael Klement <[email protected]>
DOWNLOAD and DEFINITION OF THE FUNCTION:
irm https://gist.github.com/mklement0/8689b9b5123a9ba11df7214f82a673be/raw/Out-FileUtf8NoBom.ps1 | iex
The above directly defines the function below in your session and offers guidance for making it available in future
@pa-0
pa-0 / $profile
Created May 2, 2025 01:57 — forked from eggbean/$profile
PowerShell $profile which automatically updates in the background when a new version number appears in this gist.
# Version 1.7.0
$gistUrl = "https://api.github.com/gists/81e7d1be5e7302c281ccc9b04134949e"
$gistFileName = '$profile' # Change this to match the filename in your Gist
$checkInterval = 4 # Check for updates every 4 hours
$updateCheckFile = [System.IO.Path]::Combine($HOME, ".profile_update_check")
$versionRegEx = "# Version (?<version>\d+\.\d+\.\d+)"
$localProfilePath = $Profile.CurrentUserCurrentHost
# Last update check timestamp
@pa-0
pa-0 / README.md
Created May 2, 2025 01:55 — forked from matusnovak/README.md
GPG + Git SSH Authentication and Signing on Windows 10

GPG + Git SSH Authentication and Signing on Windows 10

Introduction

This simple Gist will explain how to settup your GPG key to work for SSH authentication (with Git) and Git commit signing on Windows 10. This may seem straightforward on Linux, but there are certain tweaks needed on Windows.

No Cygwin, no MinGW, no Git Bash or any other Linux emulated environment. This works in pure Windows 10.

Software needed