Skip to content

Instantly share code, notes, and snippets.

View Hrxn's full-sized avatar
👓
"Bundle of joy has some other stuff bundled in."

HRXN Hrxn

👓
"Bundle of joy has some other stuff bundled in."
  • Germany
  • 10:30 (UTC +01:00)
View GitHub Profile
@sharedstuff
sharedstuff / gist:308c3339e507eef0b26eeec22bd48056
Created November 1, 2023 07:49
Testing & Validating PC Hardware (after a new build)
# Prerequisites
- a machine with installed Windows, including the following tools:
I recommend to use chocolatey as a package manager:
```choco install -y cpu-z hwinfo furmark gpu-z prime95```
- CPU-Z
- HWInfo
- Furmark
- GPU-Z
- Prime95
@ninmonkey
ninmonkey / Write-LogMessage.ps1.md
Created August 11, 2023 18:19
Write-LogMessage.ps1.md
Write-LogMessage Verbose -Message 'stuff' -Json @{ 'user' = 'bob'; id = 100 }
function New-SafeFileTimeNowString {
    <#
    .SYNOPSIS
        timenow for safe filepaths: "2022-08-17_12-46-47Z"
    .notes
@jborean93
jborean93 / AsyncPSCmdlet.cs
Last active May 29, 2024 07:38
Async PSCmdlet base class
using System;
using System.Collections.Concurrent;
using System.Management.Automation;
using System.Threading;
using System.Threading.Tasks;
public abstract class AsyncPSCmdlet : PSCmdlet, IDisposable
{
private enum PipelineType
{
$framework = 'netstandard2.0'
$folder = 'EventHubs'
$packages = 'Azure.Messaging.EventHubs', 'Azure.Messaging.EventHubs.Processor'
dotnet new classlib -f $framework -o "$folder.package" &&
Push-Location "$folder.package" &&
$packages | ForEach-Object { dotnet add package $_ } &&
dotnet publish --configuration Release -o lib &&
Add-Type -Path .\lib\*.dll &&
Pop-Location
@santisq
santisq / object equatable.ps1
Last active August 27, 2023 16:16
implementation of IStructuralEquatable
using namespace System.Collections
class PSCustomObjectEquatable : IEquatable[object] {
hidden [object[]] $Properties
hidden [object[]] $Values
[object] $Instance
PSCustomObjectEquatable([object] $Instance) {
$psProperties = $Instance.PSObject.Properties
$this.Instance = $Instance
@santisq
santisq / mergeZips.ps1
Last active August 27, 2023 07:08
split and merge file into zip chunks
$destination = 'path\to\destination'
$inFS = [System.IO.File]::OpenWrite($destination)
Get-ChildItem -Filter temp* | ForEach-Object {
$stream = $_.OpenRead()
$zip = [System.IO.Compression.ZipArchive]::new($stream, [System.IO.Compression.ZipArchiveMode]::Read)
$entry = $zip.GetEntry($_.Name)
$zipFS = $entry.Open()
$zipFS.CopyTo($inFS)
$zipFS, $zip, $stream | ForEach-Object Dispose
using namespace System.Drawing
Add-Type -AssemblyName System.Drawing
function Resize-Picture {
[CmdletBinding()]
param(
[Parameter(Mandatory)]
[string] $SourcePath,
@Nevember
Nevember / Light_Mode_Enable.xml
Last active October 24, 2022 09:35
Enable "Light Mode" at 6:30am daily using this Windows Task Scheduler XML file
<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
<RegistrationInfo>
<Date>2022-10-23T19:30:00.0000000</Date>
<Author>SCI\SpiralChaotic</Author>
<URI>\SCI\LightModeEnable</URI>
</RegistrationInfo>
<Triggers>
<CalendarTrigger>
<StartBoundary>2022-10-23T06:30:00</StartBoundary>
@Nevember
Nevember / Dark_Mode_Enable.xml
Last active October 24, 2022 09:35
Enable "Dark Mode" at 6:30pm daily using this Windows Task Scheduler XML file
<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
<RegistrationInfo>
<Date>2022-10-23T19:30:00.0000000</Date>
<Author>SCI\SpiralChaotic</Author>
<URI>\SCI\DarkModeEnable</URI>
</RegistrationInfo>
<Triggers>
<CalendarTrigger>
<StartBoundary>2022-10-23T18:30:00</StartBoundary>
@santisq
santisq / Get-DirectoryInfo.ps1
Last active September 11, 2023 02:42
gets file count and total (recursive) size of every folder
# This is not really good... if you want the real deal, check out:
# https://github.com/santisq/PSTree
function Get-DirectoryInfo {
[CmdletBinding()]
param(
[Parameter(Mandatory, ValueFromPipelineByPropertyName, ValueFromPipeline)]
[alias('FullName')]
[ValidateScript({
if(Test-Path $_ -PathType Container) {
return $true