Skip to content

Instantly share code, notes, and snippets.

View pjmagee's full-sized avatar
🤨

Patrick Magee pjmagee

🤨
View GitHub Profile
#load "BenchmarkDotNet"
public void Main()
{
Advanced();
Basic();
}
public string FilePath = @"C:\Users\patri\OneDrive\Desktop\AncestryDNA.txt";
@pjmagee
pjmagee / dna.cs
Created December 28, 2023 15:59
my DNA
void Main()
{
var data = Load(@"C:\Users\patri\OneDrive\Desktop\AncestryDNA.txt");
data.Dump();
}
public class GeneticData
{
private ReadOnlyMemory<char> Line { get; set; }
@pjmagee
pjmagee / nodes.cs
Created December 28, 2023 11:44
My scrappy nodes generator for a text based space rpg
void Main()
{
Galaxy galaxyNode = new Galaxy() { Name = "The galaxy", NodeType = NodeType.Galaxy };
foreach(var regionName in Enumerable.Range(0, 5).Select(x => $"Region {x}"))
{
SpaceRegion spaceNode = new SpaceRegion { Name = regionName, NodeType = NodeType.SpaceRegion };
foreach (var sectorName in Enumerable.Range(0, 3).Select(x => $"Sector : {x}"))
{
@pjmagee
pjmagee / parser.cs
Last active June 27, 2023 21:44
SWTOR Parser v2 Memory Spans
public static readonly string Settings = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments, System.Environment.SpecialFolderOption.None), "Star Wars - The Old Republic", "CombatLogs");
public static DirectoryInfo CombatLogsDirectory => new(Settings);
void Main()
{
foreach (var file in EnumerateCombatLogs())
{
foreach (var line in EnumerateCombatLogItems(file))
{
if (line.Value is not null)
@pjmagee
pjmagee / swtor-logger.cs
Created June 18, 2023 16:41
combat log file detector and line reader
void Main()
{
Util.AutoScrollResults = true;
DateTime? lastWriteTime = null;
string? lastFileName = null;
DirectoryInfo combatLogsDirectory = new DirectoryInfo(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments, System.Environment.SpecialFolderOption.None), "Star Wars - The Old Republic", "CombatLogs"));
using(var mre = new ManualResetEvent(false))
Character character = new Character();
var serializeOptions = new JsonSerializerOptions { WriteIndented = true, Converters = { new JsonStringEnumConverter() } };
var api = new OpenAIAPI(Util.GetPassword("openapi.apikey"));
var systemMessages = new List<string>()
{
"You only respond in JSON",
@pjmagee
pjmagee / PowerAutomate.md
Created December 22, 2022 07:37
Power Automate
IF (System.IfProcess.ProcessIsNotRunning ProcessName: $'''launcher''') THEN
    System.RunApplication.RunApplicationAndWaitToLoad ApplicationPath: $'''G:\\Star Wars - The Old Republic\\launcher.exe''' WindowStyle: System.ProcessWindowStyle.Normal Timeout: 0 ProcessId=> AppProcessId WindowHandle=> WindowHandle
END
Scripting.RunPowershellScript Script: $'''op item get SWTOR --format json''' ScriptOutput=> PowershellOutput
Variables.ConvertJsonToCustomObject Json: PowershellOutput CustomObject=> Secrets
SET username TO Secrets['fields'][0]['value']
SET password TO Secrets['fields'][1]['value']
SET otp TO Secrets['fields'][6]['totp']
UIAutomation.PopulateTextField TextField: appmask['Pane \'STAR WARS™: The Old Republic™\'']['username'] Text: username Mode: UIAutomation.PopulateTextMode.Replace ClickType: UIAutomation.PopulateMouseClickType.SingleClick
$pts = $true
# Path to SWTOR Install
$install = @{
path = $pts ? ("G:\Star Wars - The Old Republic\publictest\retailclient\swtor.exe") : "G:\Star Wars - The Old Republic\swtor\retailclient\swtor.exe"
workingDirectory = $pts ? ("G:\Star Wars - The Old Republic\publictest\retailclient") : "G:\Star Wars - The Old Republic\swtor\retailclient"
}
Get-Process *swtor* | Stop-Process

TECH RADAR 2024

My tech radar leaning towards .NET related technologies but not exclusive to .NET

Machine Learning

ML.NET
LMStudio

IaC / GitOps / Orchestration / DevOps

Terraform

@pjmagee
pjmagee / equals.cs
Last active June 26, 2022 13:29
dynamic field equals
void Main()
{
Model one = new() { Prop1 = null };
Model two = new() { Prop1 = null };
one.GetHashCode().Equals(two.GetHashCode()).Dump("hashcode");
one.Equals(two).Dump("equals");
}
public class Model
{