Skip to content

Instantly share code, notes, and snippets.

View J-Swift's full-sized avatar

Jimmy Reichley J-Swift

  • Rockledge, FL
View GitHub Profile
@J-Swift
J-Swift / fix-srt.rb
Created October 19, 2023 19:02
Fix issues with SRT files where simultaneous entries are split across multiple timestamp entries
#!/usr/bin/env ruby
IN_FILE = ARGV[0]
OUT_FILE = ARGV[1]
def usage
puts <<-EOF
USAGE: fix.rb {INFILE} {OUTFILE}
EOF
end
@J-Swift
J-Swift / !!Sonarr 4.md
Created October 18, 2023 14:19
Nix package for Sonarr 4

Sonarr 4

Current nix packages only supports Sonarr 3. It also downloads the release artifact instead of compiling from source.

NOTE(jpr): this version expects nix-npm-buildpackage to be accessible via its overlay.

@J-Swift
J-Swift / convert.rb
Created September 12, 2023 19:29
Convert iterm colors to hex
#!/usr/bin/env ruby
require 'json'
filename = 'iterm_colors.json'
mappings = [
"black",
"red",
"green",
@J-Swift
J-Swift / Profiler.cs
Created March 31, 2023 12:10
Drop in utility for profiling some code
public static class ProfilingService
{
private static Stopwatch? watch = null;
public static void StartMeasure()
{
lastMillis = 0;
watch = System.Diagnostics.Stopwatch.StartNew();
System.Console.WriteLine($"[START]");
}
public static void StopMeasure()
@J-Swift
J-Swift / provision.sh
Created March 1, 2023 20:19
nix auto-updating system with flakes
#!/usr/bin/env bash
set -euo pipefail
readonly flake_name='u3macbook'
readonly real_script_dir=$( dirname $(readlink $HOME/.config/nixpkgs/flake.nix) )
header() {
local -r msg="${1:-}"
@J-Swift
J-Swift / auto_reload.py
Created November 17, 2022 18:16
iterm2 script for reloading all panes in a window
#!/usr/bin/env python3.7
import iterm2
async def get_last_line(session):
async with session.get_screen_streamer() as streamer:
ready = False
while ready != True:
content = await streamer.async_get()
for i in range(content.number_of_lines):
line = content.line(content.number_of_lines-i-1)
@J-Swift
J-Swift / App.cs
Created October 23, 2022 17:51
Basic example of programmatic ResourceDictionary configuration
public class App : Application
{
public App()
{
StyleUtils.ConfigureResources(Resources, new ThemeLight());
...
}
}
@J-Swift
J-Swift / build-ios.ps1
Created October 4, 2022 19:44
Generate an ipa/dsyms in Maui
#!/usr/bin/env pwsh
param(
[Parameter(Mandatory = $true)][string] $AppName,
[Parameter(Mandatory = $true)][int] $BuildNumber
)
$ErrorActionPreference = 'Stop'
$outDir = Join-Path '.' 'artifacts' 'ios'
@J-Swift
J-Swift / GetStream.Bindings.csproj
Last active February 15, 2023 01:50
Scratch pad of building maui net6.0-ios bindings with fat xcframeworks
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net6.0-ios</TargetFrameworks>
<IsPackable>false</IsPackable>
<IsBindingProject>true</IsBindingProject>
<NoBindingEmbedding>true</NoBindingEmbedding>
<BindingPlatform>$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)'))</BindingPlatform>
</PropertyGroup>
<ItemGroup Condition="'$(BindingPlatform)' == 'ios'">
@J-Swift
J-Swift / code.swift
Created August 19, 2022 13:59
Runtime values of NSAttributedString.Key
print("attachment [\(NSAttributedString.Key.attachment.rawValue)]")
print("backgroundColor [\(NSAttributedString.Key.backgroundColor.rawValue)]")
print("baselineOffset [\(NSAttributedString.Key.baselineOffset.rawValue)]")
// print("cursor [\(NSAttributedString.Key.cursor.rawValue)]") // mac
print("expansion [\(NSAttributedString.Key.expansion.rawValue)]")
print("font [\(NSAttributedString.Key.font.rawValue)]")
print("foregroundColor [\(NSAttributedString.Key.foregroundColor.rawValue)]")
// print("glyphInfo [\(NSAttributedString.Key.glyphInfo.rawValue)]") // mac
print("kern [\(NSAttributedString.Key.kern.rawValue)]")
print("ligature [\(NSAttributedString.Key.ligature.rawValue)]")