Skip to content

Instantly share code, notes, and snippets.

View Hrxn's full-sized avatar
🗺️
There is always a path...

HRXN Hrxn

🗺️
There is always a path...
  • Germany
  • 10:27 (UTC +02:00)
View GitHub Profile
@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
@sean-m
sean-m / TimeEstimator.ps1
Last active December 4, 2023 22:15
A time estimator for use with PowerShell's Write-Progress. Provided a total number of cycles, it tracks how long the last 100 or less itterations of your main loop took and calculates the remaining time based on velocity. Note: when ticks exceed total, it returns a seconds remaining of 0, but continues to track the rate that work is getting done.
<#
A time estimator for use with PowerShell's Write-Progress. Provided a total
number of cycles, it tracks how long the last 100 or less itterations of your
main loop took and calculates the remaining time based on velocity. Note: when
ticks exceed total, it returns a seconds remaining of 0, but continues to track
the rate that work is getting done.
The intended use case is with Write-Progress, calls to that cmdlet are really
slow on PowerShell 2-5, efforts have been made to maintain low overhead. If
you're after performance this is still useful, just log the progress yourself.
For instance, using [System.Diagnostics.Trace]::Write() and watching with
function Join-Array {
[CmdletBinding()]
param(
[parameter(ValueFromPipeline, Mandatory)]
[object[]] $InputObject,
[parameter(Mandatory)]
[string[]] $Columns
)
0..10 | ForEach-Object {
Measure-Command {&{
$fileA = (Get-Item .\lorem1.txt).OpenRead()
$fileB = (Get-Item .\lorem2.txt).OpenRead()
for(($i = 0), ($z = 0); $i -lt $fileA.Length -or $z -lt $fileB.Length; $i++, $z++) {
if(-not $fileA.ReadByte().Equals($fileB.ReadByte())) {
break
}
}
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Name
merge_gdl_archives - merge multiple download archives into one
Usage
merge_gdl_archives.py merged.sqlite old1.sqlite old2.sqlite ...
"""
@agyild
agyild / NVScaler.glsl
Last active May 3, 2025 05:35
NVIDIA Image Scaling v1.0.2 for mpv
// The MIT License(MIT)
//
// Copyright(c) 2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files(the "Software"), to deal in
// the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and / or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions :
@agyild
agyild / FSR.glsl
Last active April 19, 2025 04:58
AMD FidelityFX Super Resolution v1.0.2 for mpv
// Copyright (c) 2021 Advanced Micro Devices, Inc. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
@agyild
agyild / CAS-scaled.glsl
Last active April 2, 2025 08:21
AMD FidelityFX Contrast Adaptive Sharpening v1.0.2 for mpv
// LICENSE
// =======
// Copyright (c) 2017-2019 Advanced Micro Devices, Inc. All rights reserved.
// -------
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
// modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
// -------
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
@eizedev
eizedev / Get-CommandSourceCode.ps1
Last active December 9, 2024 19:27
Get SourceCode of any powershell cmdlet/function by using the command metadata
function Get-CommandSourceCode
{
<#
.SYNOPSIS
Get SourceCode of an powershell cmdlet
.DESCRIPTION
Get SourceCode of an powershell cmdlet
.PARAMETER Command
Must be a valid powershell cmdlet/function
.EXAMPLE
@jborean93
jborean93 / Get-ModernCredential.ps1
Last active June 21, 2024 15:27
Get-Credential but with the modern Windows form - inspired from https://github.com/dopyrory3/Get-ModernCredential
# Copyright: (c) 2021, Jordan Borean (@jborean93) <[email protected]>
# MIT License (see LICENSE or https://opensource.org/licenses/MIT)
Function Get-ModernCredential {
<#
.SYNOPSIS
Modern credential prompt.
.DESCRIPTION
Uses the modern Windows credential prompt to build a credential object.