This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env pwsh | |
param($srtFile, $shiftMiliseconds=0) | |
if (-not $srtFile) { | |
throw "Must set srtFile path." | |
return | |
} | |
$srtLines = Get-Content $srtFile |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Takes and ACL and SID, returns an ACL with the correct entry for read-only permissions added. | |
function Add-ReadAce { | |
[OutputType([System.Security.AccessControl.FileSystemSecurity])] | |
param( | |
[Parameter(Mandatory=$true, ValueFromPipeline=$false)] | |
[System.Security.Principal.IdentityReference]$SID, | |
[Parameter(Mandatory=$true, ValueFromPipeline=$true, Position=0)] | |
[System.Security.AccessControl.FileSystemSecurity]$ACL | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public string ToKvText(object entry) { | |
if (entry == null) return string.Empty; | |
StringBuilder sb = new StringBuilder(); | |
var properties = entry.GetType().GetProperties(); | |
var longestPropertyLength = properties.Select(x => x.Name.Length).Max(); | |
int indentation = longestPropertyLength + 3; | |
foreach (var p in properties) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-16"?> | |
<StorableColorTheme xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | |
<Keys> | |
<string>ErrorForegroundColor</string> | |
<string>ErrorBackgroundColor</string> | |
<string>WarningForegroundColor</string> | |
<string>WarningBackgroundColor</string> | |
<string>VerboseForegroundColor</string> | |
<string>VerboseBackgroundColor</string> | |
<string>DebugForegroundColor</string> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// Let's say you have a collection of things with an indeterminate ordering but when you | |
/// enumerate the things, you'd like a subset to be grouped together. That's what this | |
/// can do but there's no guarantee elements in the group parameter exist in the primaryCollection. | |
/// That can be seen as a bug or a feature, it's up to you. | |
/// </summary> | |
/// <typeparam name="T"></typeparam> | |
/// <param name="primaryCollection"></param> | |
/// <param name="group"></param> | |
/// <returns></returns> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Reflection; | |
using System.Text.RegularExpressions; | |
using Microsoft.VisualBasic.FileIO; | |
namespace SMM { | |
public class CsvFileReader { | |
string file_path; | |
private CsvFileReader(string FilePath) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/pwsh | |
#Requires -Version 5 | |
#region TimeKeeper | |
################################################################################ | |
## TimeKeeper ## | |
################################################################################ | |
class TimeEvent { | |
<# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Usage: | |
var five = 5000.FromMB(); | |
Console.WriteLine($"{five.ToKB()} KB"); | |
Console.WriteLine($"{five.ToMB()} MB"); | |
Console.WriteLine($"{five.ToGB()} GB"); | |
Console.WriteLine($"{five.ToTB()} TB"); | |
Console.WriteLine($"{five.ToPB()} PB"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function BeepOnChange { | |
<# | |
.Synopsis | |
Take pipeline input and beep when the input changes. | |
It will optionally stop when the change occurs. | |
.PARAMETER Skip | |
Number of lines to not consider for comparison. If you're piping | |
a long running command like ping /t, you want it to skip the | |
header of the command. Combine ping with the StopOnChange switch | |
for it to alert when a network connection comes back up and ping |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Save the output of this file and use kubectl create -f to import | |
# it into Kubernetes. | |
# | |
# Created with podman-4.0.2 | |
# | |
# Where you see: /bulk/*, update those paths to correlate with your filesystem. Note: /dev/dri is what | |
# passes through devices for Intel Quick Sync hardware encoding. For me that dropped CPU usage on 4k | |
# video from 90% to 2% on 8th gen i5. | |
# | |
# After running $ podman play kube jelly-kube.yml, run the following command to generate systemd unit files: |
NewerOlder