Skip to content

Instantly share code, notes, and snippets.

View pjmagee's full-sized avatar

Patrick Magee pjmagee

View GitHub Profile
void Main()
{
// Read the file and get the root PdxObject.
PdxObject root = MageeSoft.PDX.CE.PdxSaveReader
.Read(File.ReadAllText(@"D:\paradox-clausewitz-sav\SRC\MageeSoft.PDX.CE.Models\gamestate.csf").AsSpan());
root.Dump();
// Process the PdxObject structure into a schema.
var schema = Schema.From(root, "GameState");
@pjmagee
pjmagee / gamestate.g.cs
Last active April 7, 2025 18:54
my source generator wrote this
This file has been truncated, but you can view the full file.
// <auto-generated/>
#nullable enable
using System;
using System.Collections.Generic;
using System.Linq;
using MageeSoft.PDX.CE;
namespace MageeSoft.PDX.CE.Models
{
@pjmagee
pjmagee / example.d2
Last active February 8, 2025 10:39
D2 Example of API traffic
aws cname: "AWS CNAME" {
description: |md
api.example.com with an imperva dns
|
}
imperva: "WAF" {
description: |md
WAF to protect against bots, attacks
Forward traffic to APIGEE
@pjmagee
pjmagee / sample.cs
Last active January 31, 2025 22:04
Inspector / Suspect Simulation
using Microsoft.SemanticKernel;
using Microsoft.SemanticKernel.ChatCompletion;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
public class DigitalEvidence
{
public required string Type { get; set; } // SMS, Email, CallLog, GPS, etc.
using System.Net.Http;
using System.Text.Json;
using System.IO;
using System.Collections.Generic;
using System.Threading.Tasks;
// MediaWiki API URL
string wikiApiUrl = "https://www.poe2wiki.net/w/api.php";
string outputDirectory = @"D:\poe2dump\"; // Output directory
@pjmagee
pjmagee / poc-output.cs
Created December 24, 2024 19:17
Roslyn syntax
// This file is generated by DaggerSDK.SourceGenerator
#nullable enable
using System.Text.Json.Serialization;
/// <summary>
/// The `Boolean` scalar type represents `true` or `false`.
/// </summary>
[JsonConverter(typeof(ScalarIdConverter<Boolean>))]
public partial class Boolean : Scalar
{
@pjmagee
pjmagee / init.ps1
Created October 6, 2024 19:26
dagger run pwsh init.ps1
echo "Initializing the GraphQL schema..."
$authHeader = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes("${env:DAGGER_SESSION_TOKEN}:"))
dotnet graphql init `
--headers "content-type=application/json" `
--headers "Authorization=Basic $authHeader" `
--clientName DaggerClient `
"http://127.0.0.1:${env:DAGGER_SESSION_PORT}/query"
@pjmagee
pjmagee / extract.go
Last active September 2, 2024 17:05
package main
import (
"context"
"dagger/dsg-icis-openapi-kiota/internal/dagger"
"fmt"
"slices"
)
type Language string
type Fakedeploy struct {
Approved bool
}
func (m *Fakedeploy) WithApproval() (*Fakedeploy, error) {
response, _ := dag.Container().
From("alpine").
WithMountedCache("/tmp/replies", dag.CacheVolume(fmt.Sprintf("reply-%d", time.Now()))).
Terminal(dagger.ContainerTerminalOpts{