Skip to content

Instantly share code, notes, and snippets.

@mesheets
mesheets / Rank-Input.ps1
Created January 5, 2025 04:52
Rank multi-response input
Param(
[string]$Path,
[char]$Delimiter = ',', # For tab, use "`t"
[bool]$HasColumnHeader = $True, # With use of *-CSV commandlets, a column header row is currently required.
[bool]$HasRowHeader = $True,
[int]$StartColumn = -1,
[int]$OptionCount = -1 # Use -1 to auto-calculate the number of options, or explicitly specify to exclude trailing columns
)
Set-StrictMode -Version Latest
@mesheets
mesheets / Convert-LinkFiles.ps1
Created August 29, 2024 21:01
Convert a Directory of Windows Link Files to a Markdown File
Set-StrictMode -Version Latest
$linkDir = 'C:\Path\to\Link\Files'
Function Get-IniContent {
<#
.Synopsis
Gets the content of an INI file
.Description
@mesheets
mesheets / Set-BravePrivate.ps1
Last active July 9, 2024 03:46
Open Brave in Private Mode by Default
# Set shortcuts and registry entries to launch Brave in private mode
# NOTE: This script will likely need to be executed as an administrator
# in order to complete some of the updates.
using namespace System.IO
Set-StrictMode -Version Latest
# Reference
# https://www.vbsedit.com/html/d91b9d23-a7e5-4ec2-8b55-ef6ffe9c777d.asp
@mesheets
mesheets / git-clone-vendor-refs.sh
Created July 6, 2024 18:51
Clone Git Vendor Refs (such as exist in the GNU GCC project)
# List the remote vendor refs
git ls-remote --refs git://gcc.gnu.org/git/gcc.git refs/vendors/st/\*
# Initialize an empty git repository
git init
# Add a remote for the GNU GCC repository: git remote add -t <branch> <remote name> <repository>
git remote add -t refs/vendors/st/heads/README gnu-st git://gcc.gnu.org/git/gcc.git
# The .git/config file is created with an improperly-formed fetch entry that must be manually corrected
@mesheets
mesheets / git-purge-history.sh
Last active July 9, 2024 01:21
Purge Git History (for Repositories without Submodules)
#!/bin/sh
# Purge Git history (for repositories without submodules)
# Useful for reducing the size of a repository when history is no longer needed
# Helpful also when needing to remove file(s) from Git history
# SUSE Bash - https://documentation.suse.com/sles/12-SP4/html/SLES-all/cha-adm-shell.html
# - General shell scripting - https://www.shellscript.sh/
# ** IMPORTANT NOTE: NOT FOR REPOSITORIES WITH SUBMODULES ** #
@mesheets
mesheets / Restore-Windows-Photo-Viewer.reg
Created June 15, 2024 19:56
Restore Windows Photo Viewer in Windows 10
Windows Registry Editor Version 5.00
; Description at the link below; however, that article (and its registry file)
; do not provide the more complete integration available through this file.
; This file eliminates some of the noted workarounds.
; https://www.techradar.com/uk/how-to/how-to-restore-and-use-windows-photo-viewer-in-windows-10
[HKEY_CLASSES_ROOT\Applications\PhotoViewer.dll]
[HKEY_CLASSES_ROOT\Applications\PhotoViewer.dll\shell]
@mesheets
mesheets / RollingActiveHours.ps1
Last active September 14, 2024 23:06
Continually adust the active hours to prevent Windows from automatically rebooting
# Continually adust the active hours to prevent Windows from automatically rebooting
# Based on https://superuser.com/a/1456571 and https://superuser.com/a/1208866
# From comment at https://superuser.com/a/1456571: Execute script from the web
# NOTE: The "subshell" is needed because setup.ps1 exits when finished
# powershell -Command { Invoke-RestMethod https://raw.githubusercontent.com/marcosbozzani/Win10ActiveHours/7a214576ee2681c3e677b6c017429934a2c8c7d2/setup.ps1 | Invoke-Expression }
# Constants
[int]$MaxActiveHours = 18
@mesheets
mesheets / HiFiBerry-Stage.diff
Created January 20, 2024 19:17
Add support for HiFiBerry Stage to Raspberry Pi Linux
diff --git a/arch/arm/boot/dts/overlays/hifiberry-dacplusadcpro-overlay.dts b/arch/arm/boot/dts/overlays/hifiberry-dacplusadcpro-overlay.dts
index cafa2ccd7ff7..561cd84bbb79 100644
--- a/arch/arm/boot/dts/overlays/hifiberry-dacplusadcpro-overlay.dts
+++ b/arch/arm/boot/dts/overlays/hifiberry-dacplusadcpro-overlay.dts
@@ -43,6 +43,11 @@
clocks = <&dacpro_osc>;
status = "okay";
};
+ hpamp: hpamp@60 {
+ compatible = "ti,tpa6130a2";
@mesheets
mesheets / pdfscan2tiff.sh
Last active November 10, 2024 03:07
Extracts images embedded in a PDF file to a TIFF image file
#!/bin/sh
# Extracts images embedded in a PDF file (such PDFs created from document scanning) to a TIFF image file.
# SUSE Bash - https://documentation.suse.com/sles/12-SP4/html/SLES-all/cha-adm-shell.html
# - General shell scripting - https://www.shellscript.sh/
# pdfimages manual - https://www.xpdfreader.com/pdfimages-man.html
# - NOTE: use the "-list" option to retreive details (including resolution) for each image
# - c.f https://stackoverflow.com/a/11699848
# - see also https://graphicdesign.stackexchange.com/q/5670
# tiffcp manual - https://libtiff.gitlab.io/libtiff/tools/tiffcp.html