Skip to content

Instantly share code, notes, and snippets.

View Hrxn's full-sized avatar
☯️
"He who knows, does not speak. He who speaks, does not know."

HRXN Hrxn

☯️
"He who knows, does not speak. He who speaks, does not know."
  • Germany
  • 01:04 (UTC +02:00)
View GitHub Profile
@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, 2024 14:51
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 May 6, 2024 09:48
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 26, 2024 18:17
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
@jborean93
jborean93 / Get-ModernCredential.ps1
Last active December 4, 2023 01:49
Get-Credential but with the modern Windows form - inspired from https://github.com/dopyrory3/Get-ModernCredential
# Copyright: (c) 2021, Jordan Borean (@jborean93) <jborean93@gmail.com>
# 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.
--[[
See script details on https://github.com/kevinlekiller/mpv_scripts
Valid --script-opts are (they are all optional):
autospeed-nircmd=false true/false - Use nircmd to change the refresh rate of your monitor.
autospeed-speed=false true/false - Adjust speed of the video?.
autospeed-nircmdc="nircmdc" String - Path to nircmdc executable file. If not set, nircmdc will be searched in Windows PATH variable.
autospeed-monitor=0 Number - Which monitor (display) to set the refresh rate on.
autospeed-dwidth=1920 Number - Display width.
autospeed-dheight=1080 Number - Display height.
@v-fox
v-fox / motioninterpolation.vpy
Last active September 19, 2023 00:48 — forked from phiresky/motioninterpolation.vpy
On-CPU motion interpolation for ≤480@144, ~720@120, ≥1080p@60 playback in mpv
#!/usr/bin/python
# vim: set ft=python:
# see the README at https://gist.github.com/v-fox/43c287426c366679afc4c65eece60cbc
# source: https://github.com/mpv-player/mpv/issues/2149
# source: https://github.com/mpv-player/mpv/issues/566
# source: https://github.com/haasn/gentoo-conf/blob/nanodesu/home/nand/.mpv/filters/mvtools.vpy
import vapoursynth as vs
import functools